Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile on FreeBSD targeting ARMv6 (Raspberry Pi) #848

Merged
merged 5 commits into from Sep 14, 2018

Conversation

Projects
None yet
4 participants
@darkain
Copy link

darkain commented Sep 13, 2018

Attempting to compile ZeroTier on FreeBSD on ARM platforms such as older Raspberry Pi units results in the following error message:

fails to link: Source object ext/arm32-neon-salsa2012-asm/salsa2012.o has EABI version 0, but target zerotier-one has EABI version 5

EABI information has been added for the assembler.

Additionally, ARMv6 doesn't support NEON, and it is optional on ARMv7. NEON support is provided by a precompiler directive, so now we check if it exists before including NEON support.

With these changes, ZeroTier compiles and runs perfectly on my Raspberry Pi Zero (using USB NIC)

laduke and others added some commits Aug 29, 2018

@darkain darkain changed the title Fix compile on FreeBSD targeting ARMv6 Fix compile on FreeBSD targeting ARMv6 (Raspberry Pi) Sep 13, 2018

dch added a commit to skunkwerks/ports that referenced this pull request Sep 13, 2018

net/zerotier: require json.hpp v3.2.0 and build on arm
Summary:
- fixes PR#230629 reported by jbeich@ for libc++ 7
- correct combined LICENSEs to match source code
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Test Plan:
- poudriere bulk -t OK across 10.4, 11.1, 11.2 amd64+i386, 12.0-a1 amd64
- FAILs for 10.4 i386 with following stack trace

clang++ -O2 -pipe -flax-vector-conversions -fstack-protector -fno-strict-aliasing  -O2 -pipe  -flax-vector-conversions -fstack-protector -fno-strict-aliasing -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread  -DNDEBUG  -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=1 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -fno-rtti -std=c++11  -O2 -pipe  -flax-vector-conversions -fstack-protector -fno-strict-aliasing -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread  -DNDEBUG  -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=1 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -Wall -Werror -g -pthread   -DZT_TRACE -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=1 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -fno-rtti -std=c++11    -c -o one.o one.cpp
Stack dump:
0.	Program arguments: /usr/bin/clang++ -cc1 -triple i386-unknown-freebsd10.4 -emit-obj -disable-free -disable-llvm-verifier -main-file-name OSUtils.cpp -mrelocation-model pic -pic-level 2 -pie-level 2 -mdisable-fp-elim -relaxed-aliasing -masm-verbose -mconstructor-aliases -target-cpu i486 -gdwarf-2 -coverage-file /tmp/usr/ports/net/zerotier/work/ZeroTierOne-1.2.10/osdep/OSUtils.o -resource-dir /usr/bin/../lib/clang/3.4.1 -D NDEBUG -D ZT_BUILD_PLATFORM=7 -D ZT_BUILD_ARCHITECTURE=1 -D ZT_SOFTWARE_UPDATE_DEFAULT="disable" -D NDEBUG -D ZT_BUILD_PLATFORM=7 -D ZT_BUILD_ARCHITECTURE=1 -D ZT_SOFTWARE_UPDATE_DEFAULT="disable" -D ZT_TRACE -D ZT_BUILD_PLATFORM=7 -D ZT_BUILD_ARCHITECTURE=1 -D ZT_SOFTWARE_UPDATE_DEFAULT="disable" -internal-isystem /usr/include/c++/v1 -O2 -Wall -Wall -Wall -Werror -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /tmp/usr/ports/net/zerotier/work/ZeroTierOne-1.2.10 -ferror-limit 19 -fmessage-length 0 -fvisibility hidden -pthread -stack-protector 1 -mstackrealign -fno-rtti -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o osdep/OSUtils.o -x c++ osdep/OSUtils.cpp
1.	osdep/../ext/json/json.hpp:18807:52: current parser token 'value'
2.	osdep/../ext/json/json.hpp:18798:1: parsing namespace 'std'
clang++: error: unable to execute command: Segmentation fault (core dumped)
clang++: error: clang frontend command failed due to signal (use -v to see invocation)
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: i386-unknown-freebsd10.4
Thread model: posix
clang++: note: diagnostic msg: PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
clang++: note: diagnostic msg:

I'll report this issue upstream in zt project and update this as required

Reviewers: jbeich, jrm, swills

Reviewed By: jrm

Differential Revision: https://reviews.freebsd.org/D16880

uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Sep 13, 2018

dch
net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@479671 35697150-7ecd-e111-bb59-0022644237b5

uqs pushed a commit to freebsd/freebsd-ports that referenced this pull request Sep 13, 2018

net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880

swills pushed a commit to swills/freebsd-ports that referenced this pull request Sep 13, 2018

net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@479671 35697150-7ecd-e111-bb59-0022644237b5

Jehops pushed a commit to Jehops/freebsd-ports that referenced this pull request Sep 13, 2018

net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880


git-svn-id: svn+ssh://svn.freebsd.org/ports/head@479671 35697150-7ecd-e111-bb59-0022644237b5

mat813 pushed a commit to mat813/freebsd-ports that referenced this pull request Sep 14, 2018

net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880


git-svn-id: https://svn.freebsd.org/ports/head@479671 35697150-7ecd-e111-bb59-0022644237b5

dch added a commit to skunkwerks/ports that referenced this pull request Sep 14, 2018

net/zerotier: build on arm
- submitted by Vincent Milum <freebsd@darkain.com>
- PR#231335
- upstream zerotier/ZeroTierOne#848
@dch

This comment has been minimized.

Copy link
Contributor

dch commented Sep 14, 2018

@darkain awesome, that compiles on armv6 but I can't get this to build on armv7 (only available in 12.0-CURRENT, but still)... I've tried sprinkling -fPIC and still get issues. Any suggestions for what needs changing?

clang++ -O2 -pipe -flax-vector-conversions -fno-strict-aliasing  -O2 -pipe  -flax-vector-conversions -fno-strict-aliasing -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread  -DNDEBUG  -DZT_NO_TYPE_PUNNING -DZT_USE_ARM32_NEON_ASM_SALSA2012 -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=3 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -fno-rtti -std=c++11  -O2 -pipe  -flax-vector-conversions -fno-strict-aliasing -Wall -fPIE -fvisibility=hidden -fstack-protector -pthread  -DNDEBUG  -DZT_NO_TYPE_PUNNING -DZT_USE_ARM32_NEON_ASM_SALSA2012 -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=3 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -Wall -Werror -g -pthread   -DZT_TRACE -DZT_NO_TYPE_PUNNING -DZT_USE_ARM32_NEON_ASM_SALSA2012 -DZT_BUILD_PLATFORM=7 -DZT_BUILD_ARCHITECTURE=3 -DZT_SOFTWARE_UPDATE_DEFAULT="\"disable\"" -fno-rtti -std=c++11   -pie -Wl,-z,relro,-z,now  -o zerotier-one node/C25519.o node/Capability.o node/CertificateOfMembership.o node/CertificateOfOwnership.o node/Identity.o node/IncomingPacket.o node/InetAddress.o node/Membership.o node/Multicaster.o node/Network.o node/NetworkConfig.o node/Node.o node/OutboundMulticast.o node/Packet.o node/Path.o node/Peer.o node/Poly1305.o node/Revocation.o node/Salsa20.o node/SelfAwareness.o node/SHA512.o node/Switch.o node/Tag.o node/Topology.o node/Trace.o node/Utils.o ext/arm32-neon-salsa2012-asm/salsa2012.o controller/EmbeddedNetworkController.o controller/DB.o controller/FileDB.o controller/RethinkDB.o osdep/ManagedRoute.o osdep/Http.o osdep/OSUtils.o service/SoftwareUpdater.o service/OneService.o osdep/BSDEthernetTap.o ext/http-parser/http_parser.o one.o 
/usr/bin/ld: error: can't create dynamic relocation R_ARM_ABS32 against local symbol in readonly segment; recompile object files with -fPIC
>>> defined in ext/arm32-neon-salsa2012-asm/salsa2012.o
>>> referenced by ext/arm32-neon-salsa2012-asm/salsa2012.o:(.text+0x630)
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake[2]: *** [make-bsd.mk:136: one] Error 1
gmake[2]: Leaving directory '/tmp/usr/ports/net/zerotier/work/ZeroTierOne-1.2.12'
gmake[1]: *** [make-bsd.mk:163: debug] Error 2
gmake[1]: Leaving directory '/tmp/usr/ports/net/zerotier/work/ZeroTierOne-1.2.12'
*** Error code 1

@adamierymenko adamierymenko changed the base branch from master to dev Sep 14, 2018

@adamierymenko adamierymenko merged commit ef48d11 into zerotier:dev Sep 14, 2018

@adamierymenko

This comment has been minimized.

Copy link
Contributor

adamierymenko commented Sep 14, 2018

Merged into dev since that's where we do work. Merge looks great, but you might want to pull dev and test. We don't have an ARM/FreeBSD box handy.

@darkain

This comment has been minimized.

Copy link
Author

darkain commented Sep 14, 2018

@dch I currently only have physical boards for ARMv6, nothing for ARMv7. It might be best currently to entirely omit NEON support from the FreeBSD port for the time being.

Over my free time this weekend, I'll try messing around with QEMU to see if I can get this to build and run on virtual ARM units, but I know those don't perfectly match real-world hardware.

@darkain

This comment has been minimized.

Copy link
Author

darkain commented Sep 14, 2018

WALP, screw it. Amazon Prime free same-day shipping. I'll have a Pi 3B+ tonight to test both ARMv7 and ARMv8 builds on.

freqlabs added a commit to freenas/ports that referenced this pull request Feb 28, 2019

net/zerotier: build on arm and 10.4 x86/x64 & improve compiler settings
- use improved C++14 settings contributed by jbeich@
- correct LICENSE_FILES via mat@ and jbeich@
- fixes ARM build from PR#231335
- submitted by Vincent Milum <freebsd@darkain.com>
- upstream zerotier/ZeroTierOne#848

Submitted by:	Vincent Milum <freebsd@darkain.com>
Reported by:	jbeich
Approved by:	jrm (mentor)
Obtained from:	zerotier/ZeroTierOne#848
Differential Revision:	https://reviews.freebsd.org/D16880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.