I'm trying to build an static-linked GNU x86 binary on an 64bit CentOS system using the automake configure script. I am able able to build a static 64bit binary and a dynamic 32bit with no problems but I can't seem to figure out how to build a static 32bit binary.
I've tried the following configure command:
./configure --build=i686-pc-linux-gnu CFLAGS='-static -m32' CXXFLAGS='-static -m32'
But I get the following error message:
# ./configure --build=i686-pc-linux-gnu CFLAGS='-static -m32' CXXFLAGS='-static -m32'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for g++... g++
checking whether the C++ compiler works... no
configure: error: in `/tmp/iperf-2.0.5':
configure: error: C++ compiler cannot create executables
See `config.log' for more details.
If I try to build just a 32bit binary passing -m32 to CFLAGS, CXXFLAGS and LDFLAGS, it works fine.
From the config.log file, I see:
configure:3104: $? = 1
configure:3124: checking whether the C++ compiler works
configure:3146: g++ -static -m32 conftest.cpp >&5
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
But I have both the 32 and 64bit versions of libstdc++ installed.
Any suggestions?