Qt Creator - Wt - Static libraries
Added by Nilesh Chakraborty almost 14 years ago
Hi,
I installed wt 3.1.9 a month back, building it with SHARED_LIBS=ON...after downloading the latest git version, I built that with SHARED_LIBS=OFF and did make install..But while using Qt Creator to compile simple apps (It's basically a qt app which needs both QtCore and Wt classes), it cannot find my *.a static libs and complains that shared libs are unavailable.
My new wt build dir is: /home/nilesh/Documents/pro/wt-static/wt-/wt/build/
Qt .pro file:
QT += core
QT -= gui
LIBS += -L/usr/lib -lwt -lwthttp -rdynamic -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/http -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src -B /usr/lib/qt4-static/include/Qt/ -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/http/libwthttp.a -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/libwt.a -Wl,-Bstatic -lboost_regex -lboost_signals -lboost_system -Wl,-Bdynamic -lz -lssl -lcrypto -Wl,-Bstatic -lboost_thread -lboost_filesystem -lboost_program_options -lboost_date_time -Wl,-Bdynamic -lpthread
CONFIG += console no_keywords
CONFIG -= app_bundle
INCLUDEPATH += /home/nilesh/Documents/pro/wt-static/wt-/wt/src/
TEMPLATE = app
QMAKE_CXXFLAGS += -DNDEBUG
TARGET = Server
SOURCES += main.cpp
// It doesn't matter even if I put -lwt -lwthttp *after* -Bstatic -...
If I add the previous/old libwt.so.28 etc files to /usr/lib/ it doesn't complain, and builds finely. But I don't want to use dynamic linking! I'd be grateful to find a solution.
Thanks,
Nilesh
Replies (3)
RE: Qt Creator - Wt - Static libraries - Added by Wim Dumon almost 14 years ago
Hi Nilesh,
I have more success linking to static libraries if I don't use -lwt -Lpath/to/static/lib
, but simply /path/to/static/lib/libwt.a
instead (no -l, no -L).
Wim.
RE: Qt Creator - Wt - Static libraries - Added by Nilesh Chakraborty almost 14 years ago
It gives the same error that way, and even if I completely omit the LIBS and INCLUDEPATH. Strange. Something to do with default search paths/environment variables? Searched a lot, still no clue.
/home/nilesh/Documents/pro/lnPanel/test/Server: error while loading shared libraries: libwt.so.28: cannot open shared object file: No such file or directory
Nilesh
RE: Qt Creator - Wt - Static libraries - Added by Nilesh Chakraborty almost 14 years ago
It's solved. A simple mistake, make clean is all that was needed. And I also had to place -lwthttp before -lwt to compile properly.
These work perfect:
LIBS = -Wl,-Bstatic -L/usr/lib/qt4-static/lib/ -B/usr/lib/qt4-static/include/Qt/ -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/http/ -L/home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/ -lQtCore -L/usr/lib/qt4-static/lib -lwthttp -lwt -lboost_thread -lboost_filesystem -lboost_program_options -lboost_date_time -lboost_regex -lboost_signals -lboost_system -Wl,-Bdynamic -lz -lssl -lcrypto -ldl -lm -lgthread-2.0 -lrt -lglib-2.0 -lpthread
INCLUDEPATH += /home/nilesh/Documents/pro/wt-static/wt-/wt/build/src/ /home/nilesh/Documents/pro/wt-static/wt-/wt/build/http/
:)
Nilesh