当前位置: 首页 > wzjs >正文

西宁的网站建设公司软件外包网

西宁的网站建设公司,软件外包网,营销型网站易网拓,wordpress修改永久链接后无法访问NAS - SyncthingAndroid 文章目录 NAS - SyncthingAndroid参考资料编译解决编译遇到的各种问题gradle 无法下载syncthing.git 访问不可达golang 访问不可达防坑 总结 NAS - SyncthingAndroid 之所以了解SyncthingAndroid 开源项目,是因为最近两年关注到一款产品 NA…

NAS - SyncthingAndroid

文章目录

  • NAS - SyncthingAndroid
  • 参考资料
  • 编译
  • 解决编译遇到的各种问题
    • gradle 无法下载
    • syncthing.git 访问不可达
    • golang 访问不可达
    • 防坑
  • 总结


NAS - SyncthingAndroid

之所以了解SyncthingAndroid 开源项目,是因为最近两年关注到一款产品 NAS产品,恰好有朋友在做这款产品,就去研究了一下基于NAS产品的一些技术实现。

国内已经有非常成熟的生产厂商了,也在大面积铺货。 从时间技术上 SyncthingAndroid 并不是唯一技术实现,服务端可以用samba或者webdav 文件挂载,穿透方案可以用
n2n,Android和ios 叫hin2n,国外用syncthing 开源整体方案来做。

这里针对 SyncthingAndroid 端来讲一下环境搭建问题。
在这里插入图片描述

参考资料

syncthing-android
syncthing-android-fdroid

这里将的是syncthing-android-fdroid 环境搭建,其实它就是基于 syncthing-android 实现的。

编译

其实开源软件已经说明了 用 Linux 或者 SSL 推荐的编译方式,且编译步骤已经说明了的。


Build on Debian Linux / WSL - recommended way
A Linux VM, for example running Debian, is recommended to build this.Build SyncthingNative and the Syncthing-Android wrapper using the following commands:#
# Install prerequisites.
apt-get -y install gcc git openjdk-17-jdk python3 unzip
#
# Clone repository.
mkdir -p ~/git && cd ~/git
git clone https://github.com/Catfriend1/syncthing-android.git --recursive
## git stash && git pull origin Catfriend1-patch-1 && git checkout Catfriend1-patch-1
#
# Build
cd ~/git/syncthing-android
python3 install_minimum_android_sdk_prerequisites.py
./gradlew buildNative
export ANDROID_HOME=~/git/syncthing-android-prereq
echo -e "\norg.gradle.jvmargs=-Xmx4096m" >> gradle.properties
./gradlew lintDebug
./gradlew assembleDebug

解决编译遇到的各种问题

上面Build 已经说明了步骤,但是实际操作中会遇到各种问题,下面一一例举并说明修改方案。
为什么会遇到这些问题? 毕竟是在国内,开源项目会造成各种依赖条件不可达呗…

gradle 无法下载

root@wfc-VMware-Virtual-Platform:~/git/syncthing-android# ./gradlew buildNative
Downloading https://services.gradle.org/distributions/gradle-8.9-bin.zipException in thread "main" java.io.IOException: Downloading from https://services.gradle.org/distributions/gradle-8.9-bin.zip failed: timeout

解决方案,替换成阿里镜像:
修改文件:syncthing-android/gradle/wrapper/gradle-wrapper.properties

#Thu Sep 29 21:34:28 CEST 2022
# https://gradle.org/release-checksums/
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
#distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
zipStoreBase=GRADLE_USER_HOME

syncthing.git 访问不可达

具体报错如下:

./gradlew buildNative
Downloading https://mirrors.cloud.tencent.com/gradle/gradle-8.9-bin.zip
............10%.............20%.............30%.............40%.............50%.............60%.............70%.............80%.............90%.............100%Welcome to Gradle 8.9!Here are the highlights of this release:- Enhanced Error and Warning Messages- IDE Integration Improvements- Daemon JVM InformationFor more details see https://docs.gradle.org/8.9/release-notes.htmlStarting a Gradle Daemon (subsequent builds will be faster)> Task :syncthing:checkPython
Using python 3.12.3 from /usr (python3)> Task :syncthing:buildNative
[python] python3 -u ./build-syncthing.pygit_bin='/usr/bin/git'Info: go is not available on the PATH. Trying install_goDownloading prebuilt-go to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgzDownloaded prebuilt-go to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgzSHA-256: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz cb2396bae64183cdccf81a9a6df0aea3bce9511fc21469fb89a0c00470088073[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz matches expected value.Extracting prebuilt-go ...Adding to PATH: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bingo_bin='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bin/go'ANDROID_NDK_HOME env var is not defined. Then, NDK_VERSION and ANDROID_SDK_ROOT env vars must be defined.Downloading NDK to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zipDownloaded NDK to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zipSHA-1: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip 894f469c5192a116d21f412de27966140a530ebc[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip matches expected value.Extracting NDK ...Adding ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'Invoking git fetch ...fatal: unable to access 'https://github.com/syncthing/syncthing.git/': Recv failure: Connection reset by peerTraceback (most recent call last):File "/root/git/syncthing-android/syncthing/./build-syncthing.py", line 338, in <module>subprocess.check_call([File "/usr/lib/python3.12/subprocess.py", line 413, in check_callraise CalledProcessError(retcode, cmd)subprocess.CalledProcessError: Command '['git', '-C', '/root/git/syncthing-android/syncthing/src/github.com/syncthing/syncthing', 'fetch', '--tags']' returned non-zero exit status 128.> Task :syncthing:buildNative FAILEDFAILURE: Build failed with an exception.

这里一定要看清问题的本质:是 访问不可达,而不是 python 脚本问题,这个问题自己在开源平台上咨询过都是答非所问…

 fatal: unable to access 'https://github.com/syncthing/syncthing.git/': Recv failure: Connection reset by peer

所以,要怎么分析问题和解决问题?
这里有个天坑 ,因为我是国内环境,ubuntu 无法访问github,这个才是问题的本质,这里也是为什么 github 的 syncthing.git 无法访问的原因。

尝试解决方案:更改DNS 路由

vim /etc/systemd/resolved.confnameserver 8.8.8.8
nameserver 1.1.1.1vim  /etc/resolv.confnameserver 8.8.8.8
nameserver 1.1.1.1

然后尝试看看github 是否能访问,当然如果还是不行,尝试其它方法看看。

golang 访问不可达

报错日志如下:

root@wfc-VMware-Virtual-Platform:~/git/syncthing-android# ./gradlew buildNative> Task :syncthing:checkPython
Using python 3.12.3 from /usr (python3)> Task :syncthing:buildNative
[python] python3 -u ./build-syncthing.pygit_bin='/usr/bin/git'Info: go is not available on the PATH. Trying install_goDownloaded prebuilt-go to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgzSHA-256: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz cb2396bae64183cdccf81a9a6df0aea3bce9511fc21469fb89a0c00470088073[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz matches expected value.Adding to PATH: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bingo_bin='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bin/go'ANDROID_NDK_HOME env var is not defined. Then, NDK_VERSION and ANDROID_SDK_ROOT env vars must be defined.Downloaded NDK to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zipSHA-1: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip 894f469c5192a116d21f412de27966140a530ebc[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip matches expected value.Adding ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'Invoking git fetch ...From https://github.com/syncthing/syncthing+ e2973ff2f...fa0d933e4 release-nightly -> origin/release-nightly  (forced update)Invoking git describe ...Cleaning go-build cacheBuilding syncthing version v1.29.4*** Building for armgo: github.com/AudriusButkevicius/recli@v0.0.7-0.20220911121932-d000ce8fbf0f: Get "https://proxy.golang.org/github.com/%21audrius%21butkevicius/recli/@v/v0.0.7-0.20220911121932-d000ce8fbf0f.mod": dial tcp 142.250.217.113:443: connect: connection refusedTraceback (most recent call last):File "/root/git/syncthing-android/syncthing/./build-syncthing.py", line 384, in <module>subprocess.check_call([go_bin, 'mod', 'download'], cwd=syncthing_dir)File "/usr/lib/python3.12/subprocess.py", line 413, in check_callraise CalledProcessError(retcode, cmd)subprocess.CalledProcessError: Command '['/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bin/go', 'mod', 'download']' returned non-zero exit status 1.> Task :syncthing:buildNative FAILEDFAILURE: Build failed with an exception.* What went wrong:
Execution failed for task ':syncthing:buildNative'.
> Python call failed: python3 -u ./build-syncthing.pyOUTPUT:git_bin='/usr/bin/git'Info: go is not available on the PATH. Trying install_goDownloaded prebuilt-go to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgzSHA-256: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz cb2396bae64183cdccf81a9a6df0aea3bce9511fc21469fb89a0c00470088073[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1.tgz matches expected value.Adding to PATH: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bingo_bin='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bin/go'ANDROID_NDK_HOME env var is not defined. Then, NDK_VERSION and ANDROID_SDK_ROOT env vars must be defined.Downloaded NDK to: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zipSHA-1: /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip 894f469c5192a116d21f412de27966140a530ebc[ok] Checksum of /root/git/syncthing-android/syncthing/../../syncthing-android-prereq/ndk_r28.zip matches expected value.Adding ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'ANDROID_NDK_HOME='/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/android-ndk-r28'Invoking git fetch ...From https://github.com/syncthing/syncthing+ e2973ff2f...fa0d933e4 release-nightly -> origin/release-nightly  (forced update)Invoking git describe ...Cleaning go-build cacheBuilding syncthing version v1.29.4*** Building for armgo: github.com/AudriusButkevicius/recli@v0.0.7-0.20220911121932-d000ce8fbf0f: Get "https://proxy.golang.org/github.com/%21audrius%21butkevicius/recli/@v/v0.0.7-0.20220911121932-d000ce8fbf0f.mod": dial tcp 142.250.217.113:443: connect: connection refusedTraceback (most recent call last):File "/root/git/syncthing-android/syncthing/./build-syncthing.py", line 384, in <module>subprocess.check_call([go_bin, 'mod', 'download'], cwd=syncthing_dir)File "/usr/lib/python3.12/subprocess.py", line 413, in check_callraise CalledProcessError(retcode, cmd)subprocess.CalledProcessError: Command '['/root/git/syncthing-android/syncthing/../../syncthing-android-prereq/go_1.24.1/bin/go', 'mod', 'download']' returned non-zero exit status 1.* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.BUILD FAILED in 17m 42s
2 actionable tasks: 2 executed

当我们满心欢喜声明问题已经解决,开始build arm ,结果又报错了:
dial tcp 142.250.217.113:443: connect: connection refused

这里是还有个坑,无法访问这个地址,go 相关的,千万不要理解为python 脚本问题了。

大家可以看看尝试 网上搜一搜解决方案, 最终我自己也是不断倒腾出来的,设置代理解决。 当然遇到无法解决,再次尝试其它方法

echo 'export GOPROXY=https://goproxy.cn' >> ~/.bashrc
source ~/.bashrc
go env -w GO111MODULE=on
go mod vendor
apt install udo

在这里插入图片描述

防坑

这里能不开代理软件千万不要开代理软件,比如会遇到 无法访问github 就去打开代理软件,虽然能访问github了,但是还是无法访问github中的其它资源了。 慎用

总结

自己花了好几周,找了好多资料,测试无数测最终解决了编译问题:其实就是两个大问题,需要看到具体日志,然后解决。

  • github 依赖的资源无法访问,需要解决ubuntu 访问github 问题,修改dns 路由解决
  • go 在编译过程中编译不成功,需要解决网络接口不可达,设置go 代理来解决。
http://www.dtcms.com/wzjs/135806.html

相关文章:

  • 网站制作设计农产品品牌推广方案
  • 自己免费怎么制作网站2023新闻摘抄大全
  • 做家教中介网站赚钱吗在线磁力搜索引擎
  • 策略类网页游戏开服表合作seo公司
  • 凌晨网站建设公司中国企业网
  • 网站购物车怎么做长春建站程序
  • 郑州网站推广排名郑州网站推广
  • 政府部门网站建设必要性百度网站的网址
  • wordpress隐藏内容破解正规seo关键词排名网络公司
  • 大型社区网站开发文档网站域名查询ip地址
  • 自适应网站模板企业网站的网站建设
  • 神华集团两学一做登陆网站手机版谷歌浏览器入口
  • 贵州企业网站友链之家
  • 做dw网站图片怎么下载seo排名优化价格
  • 阿里云服务起做网站网站在线制作
  • 电商设计灵感网站合肥网站推广优化
  • 惠州网站建设公司曾建设网站的网络公司
  • 免费1级做爰片观看网站在线视频河北网站优化公司
  • 济南市城市建设规划局官方网站哪里注册域名最便宜
  • 旅游网站做精准营销的信阳百度推广公司电话
  • 上海网站推广平台网页开发流程
  • wordpress去掉wordpress.orgseo公司怎样找客户
  • 360推广和百度推广哪个好福州seo快速排名软件
  • 同一产品做多个网站江苏搜索引擎优化
  • 做平面的网站公司建网站流程
  • 重庆网站制作外包seo伪原创工具
  • 中国建设网站企业网上银行业务功能5188关键词平台
  • 太原网站制作哪家好上海关键词优化排名软件
  • 直播平台创建公会吉林seo基础知识
  • 400网站建设推广搜索百度app下载