次のコマンドを使用して、静的にリンクされたバイナリを作成したいと思います。
g++ -o bin/target_binary objs/obj1.o objs/obj2.o objs/obj3.o -I/usr/include/c++/4.1.1/ -O3 -Wall -static -static-libstdc++ -static-libgcc -L /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32 -Wl,-verbose
出力の関連部分:
attempt to open /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/libstdc++.a succeeded
attempt to open /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libstdc++.a failed
attempt to open /usr/lib/gcc/x86_64-redhat-linux/4.1.2/libstdc++.a failed
attempt to open /usr/lib/gcc/x86_64-redhat-linux/4.1.2/../../../../lib64/libstdc++.a failed
attempt to open /lib/../lib64/libstdc++.a failed
attempt to open /usr/lib/../lib64/libstdc++.a failed
attempt to open /usr/x86_64-redhat-linux/lib64/libstdc++.a failed
attempt to open /usr/local/lib64/libstdc++.a failed
attempt to open /lib64/libstdc++.a failed
attempt to open /usr/lib64/libstdc++.a failed
attempt to open /usr/x86_64-redhat-linux/lib/libstdc++.a failed
attempt to open /usr/lib64/libstdc++.a failed
attempt to open /usr/local/lib/libstdc++.a failed
attempt to open /lib/libstdc++.a failed
attempt to open /usr/lib/libstdc++.a failed
/usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-redhat-linux/4.1.1/32/libstdc++.a when searching for -lstdc++
/usr/bin/ld: cannot find -lstdc++
collect2: ld returned 1 exit status
g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --disable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-51)
uname -a
Linux vmh-caipi-reporting.lsy.fra.dlh.de 2.6.18-274.18.1.el5 #1 SMP Fri Jan 20 15:11:18 EST 2012 x86_64 x86_64 x86_64 GNU/Linux
lsb_release -a
LSB Version: :core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.7 (Tikanga)
Release: 5.7
Codename: Tikanga
なにが問題ですか?
前もって感謝します!