Ich kompiliere eine dynamische und statische Version meiner Bibliothek auf Debian 7. Mein Benutzer möchte die Bibliothek auf RHEL6 verwenden, also nach dem Lesen vieler Beiträge schien es libstdC++ statisch zu verbinden, sollte das Problem beheben.libstdC++ - nicht statisch verbinden mit qmake
Ich verwende qmake
, so in der .pro
Datei I
unix: QMAKE_CXXFLAGS_RELEASE += -static-libstdc++ -static-libgcc -fvisibility=hidden -w
hinzugefügt Dann execute ich Befehl folgende:
qmake MyLibrary.pro -spec linux-g++-64 "CONFIG += release"
und der Ausgang ist
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexAbstraction.o MyLibrary/LexAbstraction.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o MyLibrary.o MyLibrary/MyLibrary.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexBotan.o MyLibrary/LexBotan.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexCrypter.o MyLibrary/LexCrypter.cpp
g++ -c -m64 -pipe -O2 -static-libstdc++ -static-libgcc -fvisibility=hidden -w -Wall -W -D_REENTRANT -fPIC -DMYLIBRARY_LIBRARY -DQT_NO_DEBUG -DQT_PLUGIN -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4 -IMyLibrary/Curl/include -I. -o LexHelper.o MyLibrary/LexHelper.cpp
rm -f libMyLibrary.so
g++ -m64 -Wl,-O1 -shared -o libMyLibrary.so LexAbstraction.o MyLibrary.o LexBotan.o LexCrypter.o LexHelper.o -L/usr/lib/x86_64-linux-gnu -lpthread
Aber als ich Führen Sie
ausldd -v libMyLibrary.so | grep GLIBCXX
Es ergibt folgende Ausgabe:
libstdc++.so.6 (GLIBCXX_3.4.15) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4.9) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
libstdc++.so.6 (GLIBCXX_3.4) => /usr/lib/x86_64-linux-gnu/libstdc++.so.6
Sie jemals bleiben herausgefunden? Ich bin auf die gleichen Probleme gestoßen, selbst wenn die richtigen Optionen an den Linker übergeben wurden. Es kompiliert, aber wenn es ausgeführt wird, sieht es immer noch das libstdC++, das sich im Pfad befindet, anstelle des statisch verknüpften. –