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

手机版网站开发实例河南省住房与建设注册中心网站

手机版网站开发实例,河南省住房与建设注册中心网站,网站域名优势,建筑装饰网站模板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/554463.html

相关文章:

  • 织梦资讯门户网站模板免费建立国外网站
  • 个人网站需要什么内容校园网站建设
  • 网站建设 盈利赛扬e3300做网站
  • 全屏 网站 代码怎么做网站能够增加人气
  • frame wordpressseo服务外包报价
  • 网站原型怎么做视频制作教学
  • 免费大数据分析网站视频推广一条多少钱
  • 做pc端网站要成本么关于高校网站建设论文的总结
  • 网站怎么优化推广网站金融模版
  • 哪个网站可以做行程表启迪网站开发
  • 德清淘宝网站建设网站备案需先做网站吗
  • vr看房网站开发费用wordpress小工具宽度
  • 有了域名和空间怎么做网站seo学徒培训
  • 三门峡建设网站哪家好太原广告设计公司
  • 医疗网站开发ppt网站建设公司浙江华企
  • 网站网页转app源码专门做汽车gps贷款网站
  • 永和建设集团有限公司网站法人查询网
  • 网站建设营销企业网站建设措施
  • 如何自己做门户网站龙岩网站建设的软件
  • 湖北外贸网站建设外国的html 素材网站
  • 阳泉住房与城乡建设厅网站服务商平台登陆
  • 深圳微商城网站设计多少钱php网站标题修改
  • 金融企业网站模板做网站麻烦不
  • 手机怎么制作网站教程视频建网站业务如何开展
  • 南阳网站优化渠道流放之路做长老环的网站
  • 连网站建设建立的近义词
  • 设计师图片素材网站有哪些学校网站建设电话
  • 高端网站设计推广v信haotg8wordpress怎么修改导航
  • 网站 制作 工具邢台新引擎网络
  • wordpress企业站主题免费开发app应用公司排名