* Build error on ARM device due to ld flags @ 2019-01-23 21:07 John 2019-01-24 3:14 ` Sebastian Gottschall 0 siblings, 1 reply; 6+ messages in thread From: John @ 2019-01-23 21:07 UTC (permalink / raw) To: WireGuard mailing list I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. Arch ARM which ships with the following LDFLAGS as defaults, "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" When I build wireguard on this device as shown below, I get this error but am unsure why: ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' ld: use the --help option for usage information make[2]: *** [scripts/Makefile.build:393: /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 make[1]: *** [Makefile:1358: _module_/scratch/WireGuard-0.0.20190123/src] Error 2 make: *** [Makefile:36: module] Error 2 If I remove the '-Wl' switch from the distro default, it builds without error. Any advice is appreciated. Complete build log and my FLAGS: % export CPPFLAGS="-D_FORTIFY_SOURCE=2" % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" % cd WireGuard-0.0.20190123 % make -j5 -C src make: Entering directory '/scratch/WireGuard-0.0.20190123/src' CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o CC /scratch/WireGuard-0.0.20190123/src/tools/config.o CC /scratch/WireGuard-0.0.20190123/src/tools/show.o CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o CC /scratch/WireGuard-0.0.20190123/src/tools/set.o CC [M] /scratch/WireGuard-0.0.20190123/src/main.o CC [M] /scratch/WireGuard-0.0.20190123/src/device.o CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o CC [M] /scratch/WireGuard-0.0.20190123/src/send.o CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o LD /scratch/WireGuard-0.0.20190123/src/tools/wg CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' ld: use the --help option for usage information make[2]: *** [scripts/Makefile.build:393: /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 make[1]: *** [Makefile:1358: _module_/scratch/WireGuard-0.0.20190123/src] Error 2 make: *** [Makefile:36: module] Error 2 make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Build error on ARM device due to ld flags 2019-01-23 21:07 Build error on ARM device due to ld flags John @ 2019-01-24 3:14 ` Sebastian Gottschall 2019-01-24 8:57 ` John 0 siblings, 1 reply; 6+ messages in thread From: Sebastian Gottschall @ 2019-01-24 3:14 UTC (permalink / raw) To: wireguard -Wl etc is not a valid linker flag, its a flag for gcc which passes the following flags to the linker. so basicly the LDFLAGS are just wrong. in general no CFLAGS or LDFLAGS should be overriden, since wireguard uses exact he same flags which is used for compiling the kernel. so setting custom flags should be avoided Am 23.01.2019 um 22:07 schrieb John: > I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. > Arch ARM which ships with the following LDFLAGS as defaults, > "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > > When I build wireguard on this device as shown below, I get this error > but am unsure why: > > ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > ld: use the --help option for usage information > make[2]: *** [scripts/Makefile.build:393: > /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > make[1]: *** [Makefile:1358: > _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > make: *** [Makefile:36: module] Error 2 > > If I remove the '-Wl' switch from the distro default, it builds > without error. Any advice is appreciated. > > Complete build log and my FLAGS: > > % export CPPFLAGS="-D_FORTIFY_SOURCE=2" > % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" > % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" > > % cd WireGuard-0.0.20190123 > % make -j5 -C src > make: Entering directory '/scratch/WireGuard-0.0.20190123/src' > CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o > CC /scratch/WireGuard-0.0.20190123/src/tools/config.o > CC /scratch/WireGuard-0.0.20190123/src/tools/show.o > CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o > CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o > CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o > CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o > CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o > CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o > CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o > CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o > CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o > CC /scratch/WireGuard-0.0.20190123/src/tools/set.o > CC [M] /scratch/WireGuard-0.0.20190123/src/main.o > CC [M] /scratch/WireGuard-0.0.20190123/src/device.o > CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o > CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o > CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o > CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o > CC [M] /scratch/WireGuard-0.0.20190123/src/send.o > CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o > CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o > CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o > CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o > CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o > CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o > CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o > PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o > PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o > LD /scratch/WireGuard-0.0.20190123/src/tools/wg > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o > AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o > AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o > LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o > ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > ld: use the --help option for usage information > make[2]: *** [scripts/Makefile.build:393: > /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > make[1]: *** [Makefile:1358: > _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > make: *** [Makefile:36: module] Error 2 > make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' > _______________________________________________ > WireGuard mailing list > WireGuard@lists.zx2c4.com > https://lists.zx2c4.com/mailman/listinfo/wireguard > _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Build error on ARM device due to ld flags 2019-01-24 3:14 ` Sebastian Gottschall @ 2019-01-24 8:57 ` John 2019-01-24 9:40 ` Sebastian Gottschall 0 siblings, 1 reply; 6+ messages in thread From: John @ 2019-01-24 8:57 UTC (permalink / raw) To: Sebastian Gottschall; +Cc: WireGuard mailing list Thank you for the reply. What is odd is that I can build just fine on Arch x86_64 which uses the identical LDFLAGS. In any case, is your recommendation to drop the -Wl portion of the LDFLAGS or so unset all ie: unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DEBUG_CFLAGS DEBUG_CXXFLAGS On Wed, Jan 23, 2019 at 11:02 PM Sebastian Gottschall <s.gottschall@newmedia-net.de> wrote: > > -Wl etc is not a valid linker flag, its a flag for gcc which passes the > following flags to the linker. so basicly the LDFLAGS are just wrong. > in general no CFLAGS or LDFLAGS should be overriden, since wireguard > uses exact he same flags which is used for compiling the kernel. so setting > custom flags should be avoided > > Am 23.01.2019 um 22:07 schrieb John: > > I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. > > Arch ARM which ships with the following LDFLAGS as defaults, > > "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > > > > When I build wireguard on this device as shown below, I get this error > > but am unsure why: > > > > ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > > ld: use the --help option for usage information > > make[2]: *** [scripts/Makefile.build:393: > > /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > > make[1]: *** [Makefile:1358: > > _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > > make: *** [Makefile:36: module] Error 2 > > > > If I remove the '-Wl' switch from the distro default, it builds > > without error. Any advice is appreciated. > > > > Complete build log and my FLAGS: > > > > % export CPPFLAGS="-D_FORTIFY_SOURCE=2" > > % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > > % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > > % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > > % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" > > % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" > > > > % cd WireGuard-0.0.20190123 > > % make -j5 -C src > > make: Entering directory '/scratch/WireGuard-0.0.20190123/src' > > CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/config.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/show.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o > > CC /scratch/WireGuard-0.0.20190123/src/tools/set.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/main.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/device.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/send.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o > > PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S > > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o > > PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S > > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o > > LD /scratch/WireGuard-0.0.20190123/src/tools/wg > > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o > > CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o > > AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o > > AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o > > LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o > > ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > > ld: use the --help option for usage information > > make[2]: *** [scripts/Makefile.build:393: > > /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > > make[1]: *** [Makefile:1358: > > _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > > make: *** [Makefile:36: module] Error 2 > > make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' > > _______________________________________________ > > WireGuard mailing list > > WireGuard@lists.zx2c4.com > > https://lists.zx2c4.com/mailman/listinfo/wireguard > > > _______________________________________________ > WireGuard mailing list > WireGuard@lists.zx2c4.com > https://lists.zx2c4.com/mailman/listinfo/wireguard _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Build error on ARM device due to ld flags 2019-01-24 8:57 ` John @ 2019-01-24 9:40 ` Sebastian Gottschall 2019-01-24 19:33 ` John 0 siblings, 1 reply; 6+ messages in thread From: Sebastian Gottschall @ 2019-01-24 9:40 UTC (permalink / raw) To: John, wireguard@lists.zx2c4.com >> WireGuard mailing list the kernel makefiles used for building on different architectures can be very different. (see kernel sourcdir/arch/arm/Makefile or arch/x86/Makefile) so some of them might also overwrite existing flags. what makes me wonder. according to your build log you're setting various flags before entering the wireguard dir and compiling. why? Am 24.01.2019 um 09:57 schrieb John: > Thank you for the reply. What is odd is that I can build just fine on > Arch x86_64 which uses the identical LDFLAGS. In any case, is your > recommendation to drop the -Wl portion of the LDFLAGS or so unset all > ie: > > unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DEBUG_CFLAGS DEBUG_CXXFLAGS > > On Wed, Jan 23, 2019 at 11:02 PM Sebastian Gottschall > <s.gottschall@newmedia-net.de> wrote: >> -Wl etc is not a valid linker flag, its a flag for gcc which passes the >> following flags to the linker. so basicly the LDFLAGS are just wrong. >> in general no CFLAGS or LDFLAGS should be overriden, since wireguard >> uses exact he same flags which is used for compiling the kernel. so setting >> custom flags should be avoided >> >> Am 23.01.2019 um 22:07 schrieb John: >>> I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. >>> Arch ARM which ships with the following LDFLAGS as defaults, >>> "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" >>> >>> When I build wireguard on this device as shown below, I get this error >>> but am unsure why: >>> >>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' >>> ld: use the --help option for usage information >>> make[2]: *** [scripts/Makefile.build:393: >>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 >>> make[1]: *** [Makefile:1358: >>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 >>> make: *** [Makefile:36: module] Error 2 >>> >>> If I remove the '-Wl' switch from the distro default, it builds >>> without error. Any advice is appreciated. >>> >>> Complete build log and my FLAGS: >>> >>> % export CPPFLAGS="-D_FORTIFY_SOURCE=2" >>> % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" >>> % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" >>> % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" >>> % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" >>> % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" >>> >>> % cd WireGuard-0.0.20190123 >>> % make -j5 -C src >>> make: Entering directory '/scratch/WireGuard-0.0.20190123/src' >>> CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/config.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/show.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o >>> CC /scratch/WireGuard-0.0.20190123/src/tools/set.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/main.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/device.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/send.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o >>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o >>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o >>> LD /scratch/WireGuard-0.0.20190123/src/tools/wg >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o >>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o >>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o >>> LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o >>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' >>> ld: use the --help option for usage information >>> make[2]: *** [scripts/Makefile.build:393: >>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 >>> make[1]: *** [Makefile:1358: >>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 >>> make: *** [Makefile:36: module] Error 2 >>> make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' >>> _______________________________________________ >>> WireGuard mailing list >>> WireGuard@lists.zx2c4.com >>> https://lists.zx2c4.com/mailman/listinfo/wireguard >>> >> _______________________________________________ >> WireGuard mailing list >> WireGuard@lists.zx2c4.com >> https://lists.zx2c4.com/mailman/listinfo/wireguard _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Build error on ARM device due to ld flags 2019-01-24 9:40 ` Sebastian Gottschall @ 2019-01-24 19:33 ` John 2019-01-25 11:54 ` Sebastian Gottschall 0 siblings, 1 reply; 6+ messages in thread From: John @ 2019-01-24 19:33 UTC (permalink / raw) To: Sebastian Gottschall Cc: wireguard@lists.zx2c4.com >> WireGuard mailing list On Thu, Jan 24, 2019 at 4:40 AM Sebastian Gottschall <s.gottschall@newmedia-net.de> wrote: > > the kernel makefiles used for building on different architectures can be > very different. (see kernel sourcdir/arch/arm/Makefile or arch/x86/Makefile) > so some of them might also overwrite existing flags. what makes me wonder The Makefile you mentioned for this system would seem to be /usr/lib/modules/3.16.62-1-ARCH/build/arch/arm64/Makefile % grep FLAG /usr/lib/modules/3.16.62-1-ARCH/build/arch/arm64/Makefile LDFLAGS_vmlinux :=-p --no-undefined -X CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET) OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S GZFLAGS :=-9 LIBGCC := $(shell $(CC) $(KBUILD_CFLAGS) -print-libgcc-file-name) KBUILD_CFLAGS += -mgeneral-regs-only KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) KBUILD_CPPFLAGS += -mbig-endian KBUILD_CPPFLAGS += -mlittle-endian CHECKFLAGS += -D__aarch64__ KBUILD_CFLAGS_MODULE += -mcmodel=large KBUILD_CFLAGS_MODULE += $(call cc-option, -mpc-relative-literal-loads) export TEXT_OFFSET GZFLAGS I actually don't see a plain LDFLAGS in it... just LDFLAGS_vmlinux. > according to your build log you're setting various flags before > entering the wireguard dir and compiling. > why? The packager on Arch (makepkg) has a config file (/etc/makepkg.conf) that is read when a package is built by it which sets the build flags. I just exported the flags therein on the shell then built manually to keep it simple (ie without explaining about the packager). I can tell you that I get the identical error when I build manually as shown or with the packager. Curiously, I only get this error when I build Wireguard on this platform (again reading from /etc/makepkg.conf which sets those flags). I can build anything else without the error (linux kernel, ffmpeg, owncloud, nginx, etc.) > Am 24.01.2019 um 09:57 schrieb John: > > Thank you for the reply. What is odd is that I can build just fine on > > Arch x86_64 which uses the identical LDFLAGS. In any case, is your > > recommendation to drop the -Wl portion of the LDFLAGS or so unset all > > ie: > > > > unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DEBUG_CFLAGS DEBUG_CXXFLAGS > > > > On Wed, Jan 23, 2019 at 11:02 PM Sebastian Gottschall > > <s.gottschall@newmedia-net.de> wrote: > >> -Wl etc is not a valid linker flag, its a flag for gcc which passes the > >> following flags to the linker. so basicly the LDFLAGS are just wrong. > >> in general no CFLAGS or LDFLAGS should be overriden, since wireguard > >> uses exact he same flags which is used for compiling the kernel. so setting > >> custom flags should be avoided > >> > >> Am 23.01.2019 um 22:07 schrieb John: > >>> I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. > >>> Arch ARM which ships with the following LDFLAGS as defaults, > >>> "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > >>> > >>> When I build wireguard on this device as shown below, I get this error > >>> but am unsure why: > >>> > >>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > >>> ld: use the --help option for usage information > >>> make[2]: *** [scripts/Makefile.build:393: > >>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > >>> make[1]: *** [Makefile:1358: > >>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > >>> make: *** [Makefile:36: module] Error 2 > >>> > >>> If I remove the '-Wl' switch from the distro default, it builds > >>> without error. Any advice is appreciated. > >>> > >>> Complete build log and my FLAGS: > >>> > >>> % export CPPFLAGS="-D_FORTIFY_SOURCE=2" > >>> % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > >>> % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" > >>> % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" > >>> % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" > >>> % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" > >>> > >>> % cd WireGuard-0.0.20190123 > >>> % make -j5 -C src > >>> make: Entering directory '/scratch/WireGuard-0.0.20190123/src' > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/config.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/show.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o > >>> CC /scratch/WireGuard-0.0.20190123/src/tools/set.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/main.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/device.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/send.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o > >>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o > >>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o > >>> LD /scratch/WireGuard-0.0.20190123/src/tools/wg > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o > >>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o > >>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o > >>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o > >>> LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o > >>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' > >>> ld: use the --help option for usage information > >>> make[2]: *** [scripts/Makefile.build:393: > >>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 > >>> make[1]: *** [Makefile:1358: > >>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 > >>> make: *** [Makefile:36: module] Error 2 > >>> make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Build error on ARM device due to ld flags 2019-01-24 19:33 ` John @ 2019-01-25 11:54 ` Sebastian Gottschall 0 siblings, 0 replies; 6+ messages in thread From: Sebastian Gottschall @ 2019-01-25 11:54 UTC (permalink / raw) To: John; +Cc: wireguard@lists.zx2c4.com >> WireGuard mailing list > The packager on Arch (makepkg) has a config file (/etc/makepkg.conf) > that is read when a package is built by it which sets the build flags. > I just exported the flags therein on the shell then built manually to > keep it simple (ie without explaining about the packager). I can tell > you that I get the identical error when I build manually as shown or > with the packager. the problem here is that no external flags should be set for kernel related builds. the kernel has its own flags and exakt these flags must be used for wireguard and this is how it works. otherwise strange things will happen. but i also never used makepkg. a plain make / make install does the job by itself > > Curiously, I only get this error when I build Wireguard on this > platform (again reading from /etc/makepkg.conf which sets those > flags). I can build anything else without the error (linux kernel, > ffmpeg, owncloud, nginx, etc.) > >> Am 24.01.2019 um 09:57 schrieb John: >>> Thank you for the reply. What is odd is that I can build just fine on >>> Arch x86_64 which uses the identical LDFLAGS. In any case, is your >>> recommendation to drop the -Wl portion of the LDFLAGS or so unset all >>> ie: >>> >>> unset CPPFLAGS CFLAGS CXXFLAGS LDFLAGS DEBUG_CFLAGS DEBUG_CXXFLAGS >>> >>> On Wed, Jan 23, 2019 at 11:02 PM Sebastian Gottschall >>> <s.gottschall@newmedia-net.de> wrote: >>>> -Wl etc is not a valid linker flag, its a flag for gcc which passes the >>>> following flags to the linker. so basicly the LDFLAGS are just wrong. >>>> in general no CFLAGS or LDFLAGS should be overriden, since wireguard >>>> uses exact he same flags which is used for compiling the kernel. so setting >>>> custom flags should be avoided >>>> >>>> Am 23.01.2019 um 22:07 schrieb John: >>>>> I am running Arch ARM (aarch64) on an ODROID-C2 using gcc v8.2.1. >>>>> Arch ARM which ships with the following LDFLAGS as defaults, >>>>> "-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" >>>>> >>>>> When I build wireguard on this device as shown below, I get this error >>>>> but am unsure why: >>>>> >>>>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' >>>>> ld: use the --help option for usage information >>>>> make[2]: *** [scripts/Makefile.build:393: >>>>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 >>>>> make[1]: *** [Makefile:1358: >>>>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 >>>>> make: *** [Makefile:36: module] Error 2 >>>>> >>>>> If I remove the '-Wl' switch from the distro default, it builds >>>>> without error. Any advice is appreciated. >>>>> >>>>> Complete build log and my FLAGS: >>>>> >>>>> % export CPPFLAGS="-D_FORTIFY_SOURCE=2" >>>>> % export CFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" >>>>> % export CXXFLAGS="-march=armv8-a -O2 -pipe -fstack-protector-strong -fno-plt" >>>>> % export LDFLAGS="-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now" >>>>> % export DEBUG_CFLAGS="-g -fvar-tracking-assignments" >>>>> % export DEBUG_CXXFLAGS="-g -fvar-tracking-assignments" >>>>> >>>>> % cd WireGuard-0.0.20190123 >>>>> % make -j5 -C src >>>>> make: Entering directory '/scratch/WireGuard-0.0.20190123/src' >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/wg.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/config.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/show.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/terminal.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/ipc.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/mnlg.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/encoding.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/curve25519.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/setconf.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/genkey.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/showconf.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/pubkey.o >>>>> CC /scratch/WireGuard-0.0.20190123/src/tools/set.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/main.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/device.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/noise.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/peer.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/timers.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/queueing.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/send.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/receive.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/socket.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/hashtables.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/allowedips.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/ratelimiter.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/cookie.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/netlink.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20.o >>>>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.S >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305.o >>>>> PERLASM /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.S >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20poly1305.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/blake2s/blake2s.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/curve25519/curve25519.o >>>>> LD /scratch/WireGuard-0.0.20190123/src/tools/wg >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/siphash/siphash.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/dst_cache/dst_cache.o >>>>> CC [M] /scratch/WireGuard-0.0.20190123/src/compat/udp_tunnel/udp_tunnel.o >>>>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/chacha20/chacha20-arm64.o >>>>> AS [M] /scratch/WireGuard-0.0.20190123/src/crypto/zinc/poly1305/poly1305-arm64.o >>>>> LD [M] /scratch/WireGuard-0.0.20190123/src/wireguard.o >>>>> ld: unrecognized option '-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now' >>>>> ld: use the --help option for usage information >>>>> make[2]: *** [scripts/Makefile.build:393: >>>>> /scratch/WireGuard-0.0.20190123/src/wireguard.o] Error 1 >>>>> make[1]: *** [Makefile:1358: >>>>> _module_/scratch/WireGuard-0.0.20190123/src] Error 2 >>>>> make: *** [Makefile:36: module] Error 2 >>>>> make: Leaving directory '/scratch/WireGuard-0.0.20190123/src' _______________________________________________ WireGuard mailing list WireGuard@lists.zx2c4.com https://lists.zx2c4.com/mailman/listinfo/wireguard ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-01-25 11:54 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-01-23 21:07 Build error on ARM device due to ld flags John 2019-01-24 3:14 ` Sebastian Gottschall 2019-01-24 8:57 ` John 2019-01-24 9:40 ` Sebastian Gottschall 2019-01-24 19:33 ` John 2019-01-25 11:54 ` Sebastian Gottschall
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.