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

Build From Source for aarch64/arm64v8 Static *Help it doesn't work* #1857

Open
MrX0r opened this issue Mar 17, 2025 · 3 comments
Open

Build From Source for aarch64/arm64v8 Static *Help it doesn't work* #1857

MrX0r opened this issue Mar 17, 2025 · 3 comments

Comments

@MrX0r
Copy link

MrX0r commented Mar 17, 2025

Hi, I have a problem. When I run this and build from source, the program doesn't run on an aarch64.
What did I do wrong? I need a static version!

Can anyone help me? Thank you very much.

sudo apt update
sudo apt install build-essential autoconf libtool
sudo apt install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu

git clone https://github.com/esnet/iperf.git
cd iperf
./bootstrap.sh
./configure --host=aarch64-linux-gnu --enable-static --disable-shared
make

file iperf3
iperf3: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=91f9359b27181196239db5c80142ef67d4ac96e1, for GNU/Linux 3.7.0, with debug_info, not stripped

Configure Log

checking for a BSD-compatible install... /usr/bin/install -c
checking whether sleep supports fractional seconds... yes
checking filesystem timestamp resolution... 0.01
checking whether build environment is sane... yes
checking for aarch64-linux-gnu-strip... aarch64-linux-gnu-strip
checking for a race-free mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking xargs -n works... yes
checking build system type... x86_64-pc-linux-gnu
checking host system type... aarch64-unknown-linux-gnu
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for aarch64-linux-gnu-gcc... aarch64-linux-gnu-gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether aarch64-linux-gnu-gcc accepts -g... yes
checking for aarch64-linux-gnu-gcc option to enable C11 features... none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o together... yes
checking dependency style of aarch64-linux-gnu-gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by aarch64-linux-gnu-gcc... /usr/aarch64-linux-gnu/bin/ld
checking if the linker (/usr/aarch64-linux-gnu/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/aarch64-linux-gnu-nm -B
checking the name lister (/usr/bin/aarch64-linux-gnu-nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking how to convert x86_64-pc-linux-gnu file names to aarch64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/aarch64-linux-gnu/bin/ld option to reload object files... -r
checking for file... file
checking for aarch64-linux-gnu-objdump... aarch64-linux-gnu-objdump
checking how to recognize dependent libraries... pass_all
checking for aarch64-linux-gnu-dlltool... no
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for aarch64-linux-gnu-ranlib... aarch64-linux-gnu-ranlib
checking for aarch64-linux-gnu-ar... aarch64-linux-gnu-ar
checking for archiver @FILE support... @
checking for aarch64-linux-gnu-strip... (cached) aarch64-linux-gnu-strip
checking command to parse /usr/bin/aarch64-linux-gnu-nm -B output from aarch64-linux-gnu-gcc object... ok
checking for sysroot... no
checking for a working dd... /usr/bin/dd
checking how to truncate binary pipes... /usr/bin/dd bs=4096 count=1
checking for aarch64-linux-gnu-mt... no
checking for mt... mt
configure: WARNING: using cross tools not prefixed with host triplet
checking if mt is a manifest tool... no
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if aarch64-linux-gnu-gcc supports -fno-rtti -fno-exceptions... no
checking for aarch64-linux-gnu-gcc option to produce PIC... -fPIC -DPIC
checking if aarch64-linux-gnu-gcc PIC flag -fPIC -DPIC works... yes
checking if aarch64-linux-gnu-gcc static flag -static works... yes
checking if aarch64-linux-gnu-gcc supports -c -o file.o... yes
checking if aarch64-linux-gnu-gcc supports -c -o file.o... (cached) yes
checking whether the aarch64-linux-gnu-gcc linker (/usr/aarch64-linux-gnu/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for aarch64-linux-gnu-gcc... (cached) aarch64-linux-gnu-gcc
checking whether the compiler supports GNU C... (cached) yes
checking whether aarch64-linux-gnu-gcc accepts -g... (cached) yes
checking for aarch64-linux-gnu-gcc option to enable C11 features... (cached) none needed
checking whether aarch64-linux-gnu-gcc understands -c and -o together... (cached) yes
checking dependency style of aarch64-linux-gnu-gcc... (cached) gcc3
checking whether ln -s works... yes
checking for library containing floor... -lm
checking for library containing socket... none required
checking for library containing inet_ntop... none required
checking for an ANSI C-conforming const... yes
checking how to run the C preprocessor... aarch64-linux-gnu-gcc -E
checking for egrep -e... (cached) /usr/bin/grep -E
checking whether aarch64-linux-gnu-gcc is Clang... no
checking whether pthreads work with "-pthread" and "-lpthread"... yes
checking for joinable pthread attribute... PTHREAD_CREATE_JOINABLE
checking whether more special flags are required for pthreads... no
checking for PTHREAD_PRIO_INHERIT... yes
checking for stdatomic.h... yes
checking whether libatomic is required... no
checking for poll.h... yes
checking for linux/tcp.h... yes
checking for sys/socket.h... yes
checking for netinet/sctp.h... no
checking for endian.h... yes
checking for aarch64-linux-gnu-pkg-config... no
checking for pkg-config... pkg-config
checking whether compiling and linking against OpenSSL works... no
checking TCP_CONGESTION socket option... yes
checking TCP_USER_TIMEOUT socket option... yes
checking TCP_KEEPIDLE socket option... yes
checking IPv6 flowlabel support... yes
checking for cpuset_setaffinity... no
checking for sched_setaffinity... yes
checking for SetProcessAffinityMask... no
checking for daemon... yes
checking for sendfile... yes
checking for getline... yes
checking SO_MAX_PACING_RATE socket option... yes
checking SO_BINDTODEVICE socket option... yes
checking IP_MTU_DISCOVER socket option... yes
checking IP_DONTFRAG socket option... no
checking IP_DONTFRAGMENT socket option... no
checking any kind of DF socket option... yes
checking for struct tcp_info.tcpi_snd_wnd... yes
checking MPTCP protocol... yes
checking for library containing clock_gettime... none required
checking for clock_gettime... yes
checking for library containing nanosleep... none required
checking for nanosleep... yes
checking for library containing clock_nanosleep... none required
checking for clock_nanosleep... yes
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/Makefile
config.status: creating src/version.h
config.status: creating examples/Makefile
config.status: creating iperf3.spec
config.status: creating src/iperf_config.h
config.status: executing depfiles commands
config.status: executing libtool commands
@userdocs
Copy link

probably a glibc thing. The iperf3 libs will be built statically but it won't link to glibc statically.

You can just use these if you only need the binary for another system: https://github.com/userdocs/iperf3-static

@MrX0r
Copy link
Author

MrX0r commented Mar 18, 2025

probably a glibc thing. The iperf3 libs will be built statically but it won't link to glibc statically.

You can just use these if you only need the binary for another system: https://github.com/userdocs/iperf3-static

@userdocs
Thanks! I know the iperf3-static project and it works, but it's not what I want!
Is there no way to include glibc in the source project? So that it has been integrated if it is missing on the target system!
How did you do it since you are the operator of iperf3-static
Thanks!

@userdocs
Copy link

I build on Alpine Linux against musl where static linking just works. glibc based system it's not so easy. Possible but not simple.

Now, from what I can understand here is that you are

1: cross compiling on a Debian based system to an unknown arm64 systems.
2: targeting a platform that does not use glibc or is not a Linux, or both

You say you want a static binary but then say you don't. It makes no sense.

If you are crossbuilding debian based to another glibc based OS people typically build on an older system to deal with the glibc linking limitations. They don't ever get a fully static binary and it only works on glibc systems.

So, unless you provide specific details of what you are trying to do, what platforms and arches are involved you are not going to get a better answer that to to use an existing static solution that is distro agnostic and works on any Linux based system, like openwrt.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants