PDA

View Full Version : Static linking problems.



Unplugged
29th January 2008, 08:10
Hi!
I am trying to build static .exe using Qt 4.3.2 under Windows Xp. Everything was ok with dynamic linking. My steps were: "configure -static" and "mingw32-make" to rebuild Qt. After rebuilding I tried to compile my program and got error:

In file included from main.cpp:2:
stat.h: In member function `void Stat::sendData(const QString&, const QString&)'
:
stat.h:41: error: `QSslSocket' undeclared (first use this function)
stat.h:41: error: (Each undeclared identifier is reported only once for each fun
ction it appears in.)
stat.h:41: error: `socket' undeclared (first use this function)
stat.h:41: error: `QSslSocket' has not been declared

line 41 in stat.h:


QSslSocket *socket = new QSslSocket;

jpn
29th January 2008, 08:15
Everything was ok with dynamic linking.
As in with pre-built binary installation?


My steps were: "configure -satic" and "mingw32-make" to rebuild Qt.
Do you have OpenSSL installed? Notice such line in configure output:

OpenSSL support.............<yes/no>

Unplugged
29th January 2008, 09:25
As in with pre-built binary installation?
Yes.


Do you have OpenSSL installed? Notice such line in configure output:
I have OpenSSL installed, but configure output:

OpenSSL support.............no

jpn
29th January 2008, 09:28
You will have to make it say "yes". :) Pass following parameters to configure (pointing to OpenSSL installation, of course):


-I <includepath>
-L <librarypath>
-l <libraryname>

See "configure -help" for more details.

Unplugged
29th January 2008, 09:47
I have OpenSSL 0.9.8g installed in "E:\Program Files\OpenSSl" , .h files are located in "E:\Program Files\OpenSSL\include\openssl", so includepath is

-I E:\Program Files\OpenSSL\include\openssl.
In lib directory there are three folders: Builder5, MiniGw and VC. How -L and -l have to look like?
And do i have to rebuild Qt any time i am passing some parameters to configure?

jpn
29th January 2008, 11:10
Well yes, configure is an utility which sets flags how Qt is built. But now that I re-look at configure -help, it might be enough to simply pass -openssl option. Could you try that?

Unplugged
29th January 2008, 11:46
I have passed -openssl to configure, the string in output changed to

OpenSSL .....yes, then i typeb make sub-src, rebuilding started, and after a while i received a lot of errors about SSL. However, the problem I mentioned above disappeared, but there is another.

cannot find -lQtNetworkd4 It seems that debug library is missing.
If I add
CONFIG += release the program is compiling, but not as static, even if
QMAKE_LFLAGS = -static added to project file.

jpn
29th January 2008, 11:52
Did you see this wiki article: Building static applications?

rishid
17th February 2008, 02:25
jpn: The wiki article states use using CONFIG += static in your pro file.

A. This does not do anything for me.
B. That option is not even supported by qmake. http://doc.trolltech.com/4.3/qmake-variable-reference.html#config

Here is what I have been doing. Any other ideas?

Thanks.


I have yet to be able to build my app statically. I am building qtopia-core-opensource-src-4.3.3 with configure:
./configure -static -embedded arm -xplatform qws/linux-arm-g++ -no-qvfb -depths 16 -no-largefile -no-accessibility -no-qt3support -no-gif -no-libjpeg -no-openssl -little-endian -no-libtiff -no-armfpa


And my project file looks like this:

TEMPLATE = app
TARGET = Facebook
QT += core \
gui \
xml
HEADERS += TopBar.h \
ProfileWin.h \
NameDelegate.h \
ClockWidget.h \
MainWin.h \
Recent.h \
Settings.h
SOURCES += main.cpp
FORMS += TopBar.ui \
ProfileWin.ui \
MainWin.ui \
Near.ui \
Poke.ui \
Recent.ui \
Settings.ui \
Syncing.ui
RESOURCES +=