[Qt-interest] static build problem with shared libraries

Matthias Kunz matthias.kunz at newcastle.ac.uk
Mon Aug 10 12:20:15 CEST 2009


I reinstalled Qt and now have a folder qt_static. I also included CONFIG += static.
But it still includes the shared libraries!?

I also get an error now with QApplication_X11.cpp. Here the error:


g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/local/qt_static/mkspecs/linux-g++ -I. -I/usr/local/qt_static/include/QtCore -I/usr/local/qt_static/include/QtGui -I/usr/local/qt_static/include -Idebug -I. -o debug/moc_smt.o debug/moc_smt.cpp
g++ -Wl,-rpath,/usr/local/qt_static/lib -o SMT debug/dude.o debug/showstatistics.o debug/definitions.o debug/main.o debug/smt.o debug/moc_dude.o debug/moc_showstatistics.o debug/moc_smt.o    -L/usr/local/qt_static/lib /usr/lib/gcc/i486-linux-gnu/4.2/libgfortran.a /usr/lib/libcblas.a /usr/share/CLAPACK/lapack_LINUX.a /usr/share/CLAPACK/F2CLIBS/libf2c.a /usr/share/CLAPACK/libcblaswr.a /usr/lib/libatlas.a /usr/local/lib/libCGAL.a /usr/local/lib/libCGAL_Qt4.a /usr/lib/libboost_filesystem.a /usr/lib/libboost_thread.a /usr/local/lib/libgmp.a /usr/lib/libz.a /usr/lib/libgthread-2.0.a /usr/local/qt_static/lib/libQtGui.a -L/usr/local/qt_static/lib -L/usr/X11R6/lib -pthread -pthread -pthread /usr/local/qt_static/lib/libQtCore.a -pthread /usr/lib/libglib-2.0.a /usr/lib/gcc/i486-linux-gnu/4.3/libstdc++.a /usr/local/qt_static/lib/libQtXml.a -pthread -pthread /usr/lib/libX11.a /usr/lib/libgdk-x11-2.0.a /usr/lib/libgtk-x11-2.0.a /usr/lib/libXfixes.a -lQtGui -pthread -lfreetype -lgobject-2.0 -pthread -pthread -lXrender -lXfixes -lfontconfig -lXext -lX11 -lQtCore -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -ldl -lpthread
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `sm_setProperty(char const*, char const*, int, SmPropValue*)':
qapplication_x11.cpp:(.text+0x815): undefined reference to `SmcDeleteProperties'
qapplication_x11.cpp:(.text+0x84e): undefined reference to `SmcSetProperties'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::release()':
qapplication_x11.cpp:(.text+0x89a): undefined reference to `SmcInteractDone'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::allowsErrorInteraction()':
qapplication_x11.cpp:(.text+0x9a0): undefined reference to `SmcInteractRequest'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::allowsInteraction()':
qapplication_x11.cpp:(.text+0xab8): undefined reference to `SmcInteractRequest'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::~QSessionManager()':
qapplication_x11.cpp:(.text+0xc36): undefined reference to `SmcCloseConnection'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::~QSessionManager()':
make[1]: Leaving directory `/home/matthias/SMT_RELEASE/SMT/SMT'
qapplication_x11.cpp:(.text+0xcd6): undefined reference to `SmcCloseConnection'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::~QSessionManager()':
qapplication_x11.cpp:(.text+0xd66): undefined reference to `SmcCloseConnection'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSmSocketReceiver::socketActivated(int)':
qapplication_x11.cpp:(.text+0xf4c): undefined reference to `SmcGetIceConnection'
qapplication_x11.cpp:(.text+0xf64): undefined reference to `IceProcessMessages'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::QSessionManager(QApplication*, QString&, QString&)':
qapplication_x11.cpp:(.text+0x8111): undefined reference to `SmcOpenConnection'
qapplication_x11.cpp:(.text+0x81ad): undefined reference to `SmcGetIceConnection'
qapplication_x11.cpp:(.text+0x81b5): undefined reference to `IceConnectionNumber'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `QSessionManager::QSessionManager(QApplication*, QString&, QString&)':
qapplication_x11.cpp:(.text+0x8631): undefined reference to `SmcOpenConnection'
qapplication_x11.cpp:(.text+0x86cd): undefined reference to `SmcGetIceConnection'
qapplication_x11.cpp:(.text+0x86d5): undefined reference to `IceConnectionNumber'
/usr/local/qt_static/lib/libQtGui.a(qapplication_x11.o): In function `sm_performSaveYourself(QSessionManagerPrivate*)':
qapplication_x11.cpp:(.text+0x9491): undefined reference to `SmcInteractDone'
qapplication_x11.cpp:(.text+0x9603): undefined reference to `SmcSaveYourselfDone'
qapplication_x11.cpp:(.text+0x977a): undefined reference to `SmcInteractDone'
qapplication_x11.cpp:(.text+0x9ae6): undefined reference to `SmcRequestSaveYourselfPhase2'
collect2: ld returned 1 exit status
make[1]: *** [SMT] Error 1
make: *** [debug] Error 2
________________________________________
From: qt-interest-bounces at trolltech.com [qt-interest-bounces at trolltech.com] On Behalf Of Vyacheslav V. Yurkov [uvv.mail at gmail.com]
Sent: 10 August 2009 07:34
To: qt-interest
Subject: Re: [Qt-interest] static build problem with shared libraries

2009/8/10 Matthias Kunz <matthias.kunz at newcastle.ac.uk<mailto:matthias.kunz at newcastle.ac.uk>>
Hello,

I want to make a static build of a project under Linux. Therefore I build Qt SDK static and include the files libQtGui.a and libQtCore.a in the .pro file.
However when I compile (with the Qt Eclipse Integration) the shared libraries libQtGui.so and libQtCore.so are added as well?
Why does that happen?

Matthias

Hello Matthias,
you can find more information about building Qt statically there:
http://wiki.qtcentre.org/index.php?title=Building_static_Qt_on_Linux
Please pay attention that it'd be better to specify a different installation directory for the static build of Qt.
You also can find there http://wiki.qtcentre.org/index.php?title=Building_static_applications
that you should use CONFIG += static for building static applications.
--
Vyacheslav V. Yurkov <uvv.mail at gmail.com<mailto:uvv.mail at gmail.com>>       Team Leader
Norilsk                                                                  Tel: +79069001870

Software Development Department
Joint Stock Company "Channel-7", ISP



More information about the Qt-interest-old mailing list