PDA

View Full Version : Problems when running "configure -static" for 4.7.3



Cucus
16th August 2011, 15:01
Hi everyone,

I'm trying to qmake a static version from the original 4.7.3. I've been looking around for a while, trying lots of things but I don't know where does my problem come from.

I copy paste the source code of the 4.7.3 to make a new static version
from: C:\QtSDK\QtSources\4.7.3
to : C:\QtSDK\QtSources\4.7.3static

i execute the command:
C:\QtSDK\QtSources\4.7.3static>configure -static

And I get loooooooooots of errors, it looks like it is not linking properly:


C:\QtSDK\QtSources\4.7.3static>configure -static
Which edition of Qt do you want to use ?
Type 'c' if you want to use the Commercial Edition.
Type 'o' if you want to use the Open Source Edition.
o

This is the Qt for Windows Open Source Edition.

You are licensed to use this software under the terms of
the GNU Lesser General Public License (LGPL) version 2.1.

Type 'L' to view the Lesser GNU General Public License version 2.1 (LGPLv2.1).
Type 'y' to accept this license offer.
Type 'n' to decline this license offer.

Do you accept the terms of the license?
y

WARNING: Using static linking will disable the WebKit module.

Environment:
INCLUDE=
Unset
LIB=
Unset
PATH=
C:\QtSDK\Desktop\Qt\4.7.3\mingw\bin
C:\QtSDK\mingw\bin
C:\Windows\system32
C:\Windows
C:\Windows\System32\Wbem
C:\Windows\System32\WindowsPowerShell\v1.0\
C:\Program Files\MATLAB\R2009a\bin
C:\Program Files\MATLAB\R2009a\bin\win32
C:\LT\DLLwithEXE
C:\Program Files\Creaform\VXelements\
C:\Program Files\Creaform\VXelements\CTS
c:\Program Files\Microsoft SQL Server\100\Tools\Binn\
c:\Program Files\Microsoft SQL Server\100\DTS\Binn\
C:\Program Files\Druide\Antidote
You are licensed to use this software under the terms of the GNU GPL version 3.Y
ou are licensed to use this software under the terms of the Lesser GNU LGPL vers
ion 2.1.
See C:/QtSDK/QtSources/4.7.3static3

or C:/QtSDK/QtSources/4.7.3staticL

Configuration:
minimal-config
small-config
medium-config
large-config
full-config
build_all
debug
Qt Configuration:
release
debug
zlib
gif
tiff
jpeg
png
mng
accessibility
qt3support
opengl
s60
ipv6
script
scripttools
xmlpatterns
phonon
phonon-backend
multimedia
audio-backend
declarative
native-gestures
svg
minimal-config
small-config
medium-config
large-config
full-config

QMAKESPEC...................win32-g++ (detected)
Architecture................windows
Maketool....................mingw32-make
Debug symbols...............yes
Link Time Code Generation...no
Accessibility support.......yes
STL support.................yes
Exception support...........yes
RTTI support................yes
MMX support.................yes
3DNOW support...............yes
SSE support.................yes
SSE2 support................yes
IWMMXT support..............no
OpenGL support..............yes
OpenVG support..............no
OpenSSL support.............no
QtDBus support..............no
QtXmlPatterns support.......yes
Phonon support..............yes
QtMultimedia support........yes
WebKit support..............no
Declarative support.........yes
Declarative debugging.......yes
QtScript support............yes
QtScriptTools support.......yes
Graphics System.............raster
Qt3 compatibility...........yes

Third Party Libraries:
ZLIB support............qt
GIF support.............yes
TIFF support............yes
JPEG support............yes
PNG support.............yes
MNG support.............yes
FreeType support........no

Styles:
Windows.................yes
Windows XP..............yes
Windows Vista...........yes
Plastique...............yes
Cleanlooks..............yes
Motif...................yes
CDE.....................yes
Windows CE..............no
Windows Mobile..........no
S60.....................no

Sql Drivers:
ODBC....................no
MySQL...................no
OCI.....................no
PostgreSQL..............no
TDS.....................no
DB2.....................no
SQLite..................yes (qt)
SQLite2.................no
InterBase...............no

Sources are in..............C:\QtSDK\QtSources\4.7.3static
Build is done in............C:\QtSDK\QtSources\4.7.3static
Install prefix..............C:\QtSDK\QtSources\4.7.3static
Headers installed to........C:/QtSDK/QtSources/4.7.3static/include
Libraries installed to......C:/QtSDK/QtSources/4.7.3static/lib
Plugins installed to........C:/QtSDK/QtSources/4.7.3static/plugins
Imports installed to........C:/QtSDK/QtSources/4.7.3static/imports
Binaries installed to.......C:/QtSDK/QtSources/4.7.3static/bin
Docs installed to...........C:/QtSDK/QtSources/4.7.3static/doc
Data installed to...........C:/QtSDK/QtSources/4.7.3static
Translations installed to...C:/QtSDK/QtSources/4.7.3static/translations
Examples installed to.......C:/QtSDK/QtSources/4.7.3static/examples
Demos installed to..........C:/QtSDK/QtSources/4.7.3static/demos

WARNING: Using static linking will disable the use of plugins.
Make sure you compile ALL needed modules into the library.
Creating qmake...
g++ -c -oproject.o -O -I. -Igenerators -Igenerators/unix -Igenerators/win32 -Ige
nerators/mac -Igenerators/symbian -IC:\QtSDK\QtSources\4.7.3static/include -IC:\
QtSDK\QtSources\4.7.3static/include/QtCore -IC:\QtSDK\QtSources\4.7.3static/incl
ude -IC:\QtSDK\QtSources\4.7.3static/include/QtCore -IC:\QtSDK\QtSources\4.7.3st
atic/src/corelib/global -IC:\QtSDK\QtSources\4.7.3static/src/corelib/xml -IC:\Qt
SDK\QtSources\4.7.3static/mkspecs/win32-g++ -IC:\QtSDK\QtSources\4.7.3static/too
ls/shared -DQT_NO_TEXTCODEC -DQT_NO_UNICODETABLES -DQT_LITE_COMPONENT -DQT_NO_PC
RE -DQT_NODLL -DQT_NO_STL -DQT_NO_COMPRESS -DUNICODE -DHAVE_QCONFIG_CPP -DQT_BUI
LD_QMAKE -DQT_NO_THREAD -DQT_NO_QOBJECT -DQT_NO_GEOM_VARIANT -DQT_NO_DATASTREAM
-DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT -DQMAKE_OPENSOURCE_EDITION project.cpp

In file included from project.cpp:42:
project.h:45:25: error: qstringlist.h: No such file or directory
project.h:46:25: error: qtextstream.h: No such file or directory
project.h:47:21: error: qstring.h: No such file or directory
project.h:48:20: error: qstack.h: No such file or directory
project.h:49:18: error: qmap.h: No such file or directory
project.h:50:23: error: qmetatype.h: No such file or directory
In file included from property.h:45,
from project.cpp:43:
C:\QtSDK\QtSources\4.7.3static/src/corelib/global/qglobal.h:62:28: error: QtCore
/qconfig.h: No such file or directory

.............................................

mingw32-make: *** [project.o] Error 1
Building qmake failed, return code 2



I don't know if that could be a problem with the paths, I checked and run the qtenv.bat file, it looks like this (which correspond to the correct paths):


echo off
echo Setting up environment for Qt usage...
set QTDIR=C:\QtSDK\Desktop\Qt\4.7.3\mingw
set PATH=C:\QtSDK\mingw\bin;%PATH%
set PATH=%QTDIR%\bin;%PATH%


Thanks in advance!!

high_flyer
17th August 2011, 16:56
I don't know if that could be a problem with the paths, I checked and run the qtenv.bat file, it looks like this (which correspond to the correct paths):
Doesn't look correct to me:

Sources are in..............C:\QtSDK\QtSources\4.7.3static
and

set QTDIR=C:\QtSDK\Desktop\Qt\4.7.3\mingw
Don't exactly match.

Cucus
17th August 2011, 16:59
ooh thanks for your help!

I copy pasted the original source from C:\QtSDK\QtSources\4.7.3 to make a backup, even if I use this path it doesn't work.

and this path :
QTDIR=C:\QtSDK\Desktop\Qt\4.7.3\mingw
is the path for the compiler right? So they don't have to be in the same dir...

I don't know how is it supposed to be, it came like that when I installed QtSDK with sources.

wysota
17th August 2011, 17:27
QTDIR is not supposed to point to the compiler but to Qt, as the name suggests.

Cucus
18th August 2011, 23:12
I've tried several combinations with no success...
I set the environment variables like this: (as you said, QtDIR points to QtCreator) (there is no Qt dir in version 4.7.3)
set QTDIR=C:\QtSDK\QtCreator
set PATH=C:\QtSDK\mingw\bin;%PATH%
set PATH=%QTDIR%\bin;%PATH%
Both directories in the path should point to a \bin directory?
Thanks for your help

Cucus
23rd August 2011, 19:11
After lots of research on the web I realised that it is a known bug to build statically the QtSDK 4.7.1 or later.
http://developer.qt.nokia.com/forums/viewthread/7644

Could someone tell me where can I find the official and stable version of QtSDK 4.7.0?

Thanks.

wysota
24th August 2011, 08:40
Why do you want to build static Qt from the SDK? Download source code for the libraries and have fun.

Gokulnathvc
30th August 2011, 11:00
The following steps worked fine for me:

In summary, this is what worked (succeeded in both Windows Vista Home Premium 64-bit and Windows 7 Professional 64-bit):

1. Install QtSDK (2009.05)

2. Open your mkspecswin32-g++qmake.conf file (located in C:\Qt\2009.05\qt\mkspecs\win32-g++\qmake.conf) in an editor like notepad.

3. Find the line that starts with "QMAKE_LFLAGS = -enable-stdcall-fixup..." and ddd the phrase "-static" (without quotes) after the "=" sign and before the "-enable..." phrase, so it looks like:
QMAKE_LFLAGS = -static -enable-stdcall...

4. Save and close this file.

5. Set your environment variables. Right-click Computer >> Properties >> Advanced System Settings >> Click the "Environment Variables..." button.

6. Under "User variables," make sure QTDIR is set to your Qt path (C:\Qt\2009.05\qt). Make sure QMAKESPEC is set to win32-g++.

7. Under "System variables," edit the one called "Path." Add a semicolon ( ; ) to the end, and add the following:
C:\Qt\2009.05\mingw\lib;C:\Qt\2009.05\mingw\bin;C: \Qt\2009.05\qt\bin

8. When finished, relog or reboot.

9. Open a command prompt.

10. Change to your Qt directory by entering: cd C:\Qt\2009.05\qt

11. Enter the following: configure -static -no-phonon -no-phonon-backend -release -no-exceptions

12. When it asks which edition you want to use, enter "o" for open source.

13. When it asks you to accept the terms of the license, enter "y" for yes. This will take around maybe 10 minutes to complete.

14. When that finishes, enter the following: mingw32-make sub-src (or) nmake sub-src

15. Go out to dinner, this will take a while (took between 1-2 hours for me).

16. When this finishes, open your project in the Qt Creator.

17. Double-click the project (.pro) file to open it in edit mode.

18. Add the following line: CONFIG += static

19. qmake Hello.pro
nmake release (or) mingw32-make release

20. Navigate to your release directory and voila! Your standalone executable should be there.

Gokulnathvc
2nd September 2011, 07:59
I don't have any problem in using the above steps: But my another application needs to be run as an administrator, how to make the exe to work as an administrator??

high_flyer
2nd September 2011, 09:01
This has nothing to do with static linking, nor Qt.
On all systems that I know, the only way to run an application as admin, well, is to log in as admin, either in a prompt for this specific execution (when you are a regular user, such as 'sudo' or under windows "run as administrator") or, when you are logged on as as admin.
Read the docs on the matter in the documentation of your OS.

wysota
2nd September 2011, 09:25
You're wrong Daniel. At least on Linux and modern Windows you can elevate access rights. Well, on Linux it's a pseudo-elevation using PolicyKit, actually.

high_flyer
2nd September 2011, 09:32
I stand corrected then.
I'll have to read about it...
But on first thought, I makes little sense.
If you can as a developer elevate your applications rights, what is the point if having them?
If the system can't prohibit my application do access things the system deems as restricted, what is the point?
But this still has nothing to do with static linking (unless the goal is to avoid linking privileged libs? but with admin rights that should not be a problem...)

wysota
2nd September 2011, 09:40
You can elevate if the system policy lets you (i.e. you know the password or the system is configured to let the particular application gain superuser rights). Nothing to do with static linking though :)

high_flyer
2nd September 2011, 10:04
Ok, I still stand by what I said in post#10.
Basically "elevating" boils down to "automating" what I wrote is needed in post#10.

Off topic:
And this here, demonstrates exactly the "non-sense" in allowing such a mechanism...
http://www.withinwindows.com/2009/02/04/windows-7-auto-elevation-mistake-lets-malware-elevate-freely-easily/

Yes, its dues to a bug and not a design problem, but who can claim to have written an application (of any serious volume) which is bug free?
Such an feature is asking for security problems IMHO.

Gokulnathvc
2nd September 2011, 10:45
Actually, i did the static build by opening the command prompt as Administrator, but it fails to do the work after executing. I have tried "Run as administrator" still the same thing occurs. Nothing is happened, just the application window opens.

Cucus
5th September 2011, 16:48
Wow thank you very much for your reply Gokulnathvc!
It looks really complete the method you propose. I haven't tried it yet, I finally could manage it to work with version 4.8.0 beta and I saw that it also works with 4.7.4.

Gokulnathvc
6th September 2011, 06:29
You Are always welcome..