Naix n00b
Joined: 28 Feb 2024 Posts: 3
|
Posted: Wed Feb 28, 2024 6:13 pm Post subject: Cross compile and static iperf3 v3.16 binary |
|
|
Hi all,
Recently iperf3 specifically version 3.16 has started to use stdatomic.h
this has resulted in some difficulties in cross compiling and static linking an iperf3 binary on Arm 32 bit
Tried the following commands (This command worked for v3.15 when they did not use stdatomic.h):
Code: | ./configure --host=arm-linux-gnueabi --enable-static-bin --disable-shared
make -j$(nproc) |
which resulted in this error:
Code: | /usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_tcp.c:68: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: ./.libs/libiperf.a(iperf_tcp.o): in function `iperf_tcp_send':
/root/Compile_Drop/iperf-3.16/src/iperf_tcp.c:100: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_tcp.c:101: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_tcp.c:105: undefined reference to `__atomic_load_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: ./.libs/libiperf.a(iperf_udp.o): in function `iperf_udp_recv':
/root/Compile_Drop/iperf-3.16/src/iperf_udp.c:96: undefined reference to `__atomic_load_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_udp.c:100: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_udp.c:101: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: ./.libs/libiperf.a(iperf_udp.o): in function `iperf_udp_send':
/root/Compile_Drop/iperf-3.16/src/iperf_udp.c:263: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_udp.c:264: undefined reference to `__atomic_fetch_add_8'
/usr/libexec/gcc/arm-linux-gnueabi/ld: /root/Compile_Drop/iperf-3.16/src/iperf_udp.c:267: undefined reference to `__atomic_load_8' |
I tried tweaking the configure a bit with the following:
Code: | ./configure --host=arm-linux-gnueabi --enable-static-bin --disable-shared LDFLAGS="-latomic"
make -j$(nproc) |
which resulted in this error:
Code: | /usr/libexec/gcc/arm-linux-gnueabi/ld: attempted static link of dynamic object `/usr/lib/gcc/arm-linux-gnueabi/13/libatomic.so'
/usr/libexec/gcc/arm-linux-gnueabi/ld: attempted static link of dynamic object `/usr/lib/gcc/arm-linux-gnueabi/13/libatomic.so'
/usr/libexec/gcc/arm-linux-gnueabi/ld: attempted static link of dynamic object `/usr/lib/gcc/arm-linux-gnueabi/13/libatomic.so'
/usr/libexec/gcc/arm-linux-gnueabi/ld: attempted static link of dynamic object `/usr/lib/gcc/arm-linux-gnueabi/13/libatomic.so'
/usr/libexec/gcc/arm-linux-gnueabi/ld: attempted static link of dynamic object `/usr/lib/gcc/arm-linux-gnueabi/13/libatomic.so'
collect2: error: ld returned 1 exit status
collect2: error: ld returned 1 exit status |
It seems that the compiling is picking the wrong object for some reason (libatomic.so instead of libatomic.a?)
For reference I tried to compile for Arm 64 bit
Quote: | ./configure --host=aarch64-unknown-linux-gnu --enable-static-bin
make -j$(nproc) |
and it succeeded and produced a cross compiled statically linked binary...
Why is this happening specifically on arm-linux-gnueabi?
Why is it picking the dynamic object instead? _________________ Kind regards, Naix |
|