-
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
Configuration does not generate statically linked executable #632
Comments
I confirm this is a problem (tested on CentOS 7 and FreeBSD 11, both native compiling and not necessary to cross-build to another platform), but I don't yet know why. We don't test this configure feature very often but I thought I'd seen it working at one point in the past. I notice that for some reason we never do a Note that iperf2 and iperf3 are completely separate programs with different build infrastructures. |
Also, I'm guessing this really does have something to do with libtool, which is not really my specialty, so if anyone has libtool skills, help would be greatly appreciated. |
OK. I revisited this a little bit on some CentOS 7 VMs. I relearned that All this means that I'm also having trouble actually building a statically linked iperf3 executable, but it's not due to anything in iperf3. |
This is indeed an issue with libtool that has been discussed for over 5 years now. See CRITICAL: libtool makes static linking impossible. I do not know what is the best way to fix it in To build
with
That is insert The problem is that libtool treats |
Perhaps a better workaround is to set
This builds a static executable however the following warning is produced:
|
@d1mach: Thanks for the info and workaround...that's quite interesting! |
That workaround worked fine for me compiling natively on CentOS 7 (x86_64). I had to have a machine with I am not sure how this would work in a cross-compiling environment...@doru91 do you think this workaround might help you? |
The solution is fine by me. Thanks a lot! |
I probably need to write this up for the FAQ...I'd wager you're not the only person who wants / needs to build a static executable. Optimistically keeping this issue open to remind me to do this. |
(With directions tested on CentOS 7 and FreeBSD 11.) Inspired by discussion in #632.
Added FAQ entry in 835ec5f, closing. Thanks all for the info and discussion! |
@d1mach thanks you so much. I have a big problem with issue. Your answer work well for me. |
@d1mach Here's a thank you from the future. That "--static" trick is one I scoured the internet for a fix for, not completely understanding what was wrong. This solved it, and will come in handy in the future. Much appreciated. |
This trick really helped me out, two minus -- stronger than one minus - file /opt/reiserfsprogs/sbin/reiserfsck ldd /opt/reiserfsprogs/sbin/reiserfsck @d1mach you are a genius, thank you Sir, thanks a lot, a ton of thanks to you. |
Context
Version of iperf3:
3.2
Hardware:
x86_64
Operating system (and distribution, if any):
Cross-compiling for ARM under Ubuntu
Bug Report
Expected Behavior
Builds a statically linked executable
Actual Behavior
Builds an executable with dynamically linked libraries
doru@doru-N551JK:~/Desktop/iperf$ file output/bin/iperf3
output/bin/iperf3: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=6d84258ed9cbe40710234da5f5b1cf8244d4a365, not stripped
clone the master branch
apply this patch: 423a2ec
configure
./configure --without-openssl --host=arm-none-linux-gnueabi CC=arm-linux-gnueabi-gcc LD=arm-linux-gnueabi-ld CXX=arm-linux-gnueabi-g++ CFLAGS=-static CXXFLAGS=-static --enable-static --disable-shared --prefix=/home/doru/Desktop/iperf3/output
If I build iperf2 (not iperf3) using the steps above, it results a statically linked executable:
doru@doru-N551JK:~/Desktop/iperf-2.0.5/output/bin$ file iperf
iperf: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked, for GNU/Linux 2.6.32, BuildID[sha1]=631918d87fb90840809bb5e5aa5b3d613bf1a775, not stripped
The configuration must be revised.
The text was updated successfully, but these errors were encountered: