-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
How to statically compile iperf3? #544
Comments
./configure --enable-static --disable-shared ; make ; make install |
I haven't tried this for a long time, but that looks the right answer, thanks @TheRealDJ! |
This does not seem to work anymore. It builds the static library but not the executables. |
Hi,
build via: |
This worked for me: ./configure "LDFLAGS=--static" --disable-shared --without-sctp
make
make install $ ldd iperf3
not a dynamic executable It's also on the documentation: https://software.es.net/iperf/faq.html |
hi there, i used these configure options to create a static iperf3, but my ./configure gives me this:- ./configure "LDFLAGS=--static" --disable-shared --without-sctp a simple nothing in config.log stands out any ideas why i get "C compiler cannot create executables" ??? i have googled the heck out of it and also read https://software.es.net/iperf/faq.html multiple times.... my environment:- uname -a (all "base development" packages have been installed via [YAST)] |
Short AnswerYou are missing the libc static development files.
Long AnswerI found the error by trying to compile a simple Before glibc-devel-static install
Error = cannot find -lc After glibc-devel-static install
Without
|
Dear TheRealDJ, it works- you're a greek god mate! (I have just sacrificed a bull in your honor.....) Although in my defence I actually did have this library already installed just the "-32-bit" flavour which was not being used. ;) |
Hi again @TheRealDJ Thanks for helping me do the static build of iperf. just a small iteration to this usecase: is it possible to compile iperf with dynamic libraries, but force make to copy each required library into a side location ("./configure --prefix=/tmp/portable" ), where iperf can use the side-library on the foreign server ? BACKGROUND: |
You could, but I don't know why you would want to.
So the unstripped static binary is 1.8M, stripped 1.2M ... The dynamic method results in 752K. You would save ~460K using dynamic. On the remote server, you would have to create the prefix path, copy the files in, and create
Then run My opinion: Seems like quite a bit of effort to save 460K. |
Actually I meant it not just for iperf specifically, but rather any application where the resultant static binary would be too large. Ok so the secret sauce is:- ./configure --disable-static --prefix=/usr/local/iperf3 ....But unfortunately the target server is Holy and cannot be modified, so changing /etc/ld.so.conf.d cannot be done but I believe I can point to my portable libraries this way instead:- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/iperf3/lib ....and run it standalone:- /usr/local/iperf3/bin/iperf Thx! |
Just replying to confirming that this worked for me - statically compiling it on an AWS VM running Amazon Linux and SCP'ing it to an Azure VM running RHEL 8. The AWS VM had s/w repo access and already had iperf 3.16, but I needed 3.16 on the Azure VM which had no internet access and no s/w repo access. So I was able to DNF install gcc/make, the glibc dev static module (which was named slightly differently under Amazon Linux - but it was easy to find by grepping the output of 'DNF list' for 'glibc' and 'static'. |
|
Dear iperf3 developers,
I want to use iperf3 in a minimal filesystem with a linux kernel. i have to statically compile the programs to use inside the filesystem. Is that possible to statically compile iperf3?
I did
$ ./configure --build=arm-none-linux-gnueabi --host=arm-none-linux-gnueabi CFLAGS=-static CXXFLAGS=-static
$ make
But I get
/src$ file iperf3
iperf3: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=33df741e068aaf7a9ae8a24a6243de87c35c6ca5, not stripped
best regards,
Jiahuan
The text was updated successfully, but these errors were encountered: