Jun 29

armv5 架构下用 Tomatoware 静态编译 Zerotier 会出现 atomic 原子操作错误,解决的办法就是增加 -latomic 和删除 -pie:

#atomic error, add -latomic and delete -pie

# Static builds, which are currently done for a number of Linux targets
ifeq ($(ZT_STATIC),1)
	override LDFLAGS+=-static
	LDLIBS+=-latomic
endif

LDFLAGS=-pie -Wl,-z,relro,-z,now  ----> LDFLAGS=-Wl,-z,relro,-z,now

VFP 相关错误则需要修改 make-linux.mk 文件:

# ARM32 hell -- use conservative CFLAGS
ifeq ($(ZT_ARCHITECTURE),3)
	ifeq ($(shell if [ -e /usr/bin/dpkg ]; then dpkg --print-architecture; fi),armel)
		override CFLAGS+=-march=armv5t -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
		override CXXFLAGS+=-march=armv5t -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
		ZT_USE_ARM32_NEON_ASM_CRYPTO=0
	else
		override CFLAGS+=-march=armv5t -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
		override CXXFLAGS+=-march=armv5t -mfloat-abi=soft -msoft-float -mno-unaligned-access -marm
		ZT_USE_ARM32_NEON_ASM_CRYPTO=0
	endif
endif

Phicomm N1 下 aarch64 编译应使用:

CC=aarch64-linux-gcc CXX=aarch64-linux-g++ make -j`nproc` ZT_STATIC=1 ZT_SSO_SUPPORTED=0 ZT_CONTROLLER=0

因为如果编译 ZT_CONTROLLER 就需要 Rust,耗时太长,没什么必要。

点击显示引用框
引用本文,复制粘贴...