PDA

View Full Version : Error in static compilation of Qt 2010.05!



elton.lika
10th October 2010, 03:41
Hi!
I configured my system (WinXP) to statically compile Qt.
I have set up the mingw binaries in my path and everything needed for the compilation.
I configured the qt sources with:
configure -static -release -nomake demo -nomake examples -platform win32-g++
The configure ended perfectly with no errors.
I entered 'mingw32-make sub-src' and after a while these errors came up:


release/main.o:main.cpp:(.text+0x3e2a): undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text+0x3e81): undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text+0x3ebf): undefined reference to `QHashData::free_
helper(void (*)(QHashData::Node*))'
release/main.o:main.cpp:(.text+0x3ef8): undefined reference to `qt_assert_x(char
const*, char const*, char const*, int)'
release/main.o:main.cpp:(.text+0x3f41): undefined reference to `QByteArray::oper
ator=(QByteArray const&)'
release/main.o:main.cpp:(.text$_ZN5QListI7QStringE4freeEPN 9QListData4DataE[QList
<QString>::free(QListData::Data*)]+0x34): undefined reference to `QString::free(
QString::Data*)'
release/main.o:main.cpp:(.text$_ZN5QListI7QStringE4freeEPN 9QListData4DataE[QList
<QString>::free(QListData::Data*)]+0x57): undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text$_ZN5QListIN12Preprocessor11 IncludePathEE4freeEPN9
QListData4DataE[QList<Preprocessor::IncludePath>::free(QListData::Data*)]+0x42):
undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text$_ZN5QListIN12Preprocessor11 IncludePathEE4freeEPN9
QListData4DataE[QList<Preprocessor::IncludePath>::free(QListData::Data*)]+0x6f):
undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text$_ZN5QListIN12Preprocessor11 IncludePathEE6appendER
KS1_[QList<Preprocessor::IncludePath>::append(Preprocessor::IncludePath const&)]
+0x3e): undefined reference to `QListData::detach_grow(int*, int)'
release/main.o:main.cpp:(.text$_ZN5QListIN12Preprocessor11 IncludePathEE6appendER
KS1_[QList<Preprocessor::IncludePath>::append(Preprocessor::IncludePath const&)]
+0x15f): undefined reference to `QListData::append()'
release/main.o:main.cpp:(.text$_ZN4QMapI10QByteArrayS0_ED1 Ev[QMap<QByteArray, QB
yteArray>::~QMap()]+0x34): undefined reference to `QMapData::continueFreeData(in
t)'
release/main.o:main.cpp:(.text$_ZN4QMapI10QByteArrayS0_ED1 Ev[QMap<QByteArray, QB
yteArray>::~QMap()]+0x5a): undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text$_ZN4QMapI10QByteArrayS0_ED1 Ev[QMap<QByteArray, QB
yteArray>::~QMap()]+0x70): undefined reference to `qFree(void*)'
release/main.o:main.cpp:(.text$_ZN5QListI8ClassDefED1Ev[QList<ClassDef>::~QList(
)]+0x6d): undefined reference to `qFree(void*)'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [..\..\..\bin\moc.exe] Error 1
mingw32-make[2]: Leaving directory `C:/Qt/2010.05/qt/src/tools/moc'
mingw32-make[1]: *** [release] Error 2
mingw32-make[1]: Leaving directory `C:/Qt/2010.05/qt/src/tools/moc'
mingw32-make: *** [sub-moc-sub_src_target_ordered] Error 2

C:\Qt\2010.05\qt>

Please, can you tell me where the problem is?
What should I do so that these errors don't come up anymore and to build Qt statically correctly?

P.S.: This is my fifth attempt to compile Qt statically after four other attempts with four different versions of Qt in the past and each one of them ending in an error like this (mostly ending like this in the "moc" directory, if I remember correctly) in the "make" phase. It seems like building Qt statically is impossible!

marcvanriet
11th October 2010, 11:31
Hi,

Dont't know what the problem is, but can tell you that building Qt statically with MingW is possible. I downloaded the pre-build installer with MingW. This installer installed everything, including MinGw, but this is a dynamic build of course. Then I re-build it as you described, without problems. With VS, I did have the problem that I had to delete the old .dll files from the plugin directory first, because they were used instead of the static libraries.

Note there is still a dependency on a MingW DLL though. See Mingw static build (http://shanyunh.blog.163.com/blog/static/78878720097284512365/).

Best regards,
Marc

elton.lika
11th October 2010, 12:40
Hi,

Dont't know what the problem is, but can tell you that building Qt statically with MingW is possible. I downloaded the pre-build installer with MingW. This installer installed everything, including MinGw, but this is a dynamic build of course. Then I re-build it as you described, without problems. With VS, I did have the problem that I had to delete the old .dll files from the plugin directory first, because they were used instead of the static libraries.

Note there is still a dependency on a MingW DLL though. See Mingw static build (http://shanyunh.blog.163.com/blog/static/78878720097284512365/).

Best regards,
Marc

Hi!
Finally someone answered! Thank you!
I don't know but it seems to me that only few have gotten Qt to build statically.
Could you please describe in detail step-by-step your build procedure?
Which Qt version did you use?
Did you download the Qt Creator + SDK installer or only the Qt SDK?

marcvanriet
12th October 2010, 11:51
Hi,

It's been some time ago that I did the build, and also I used MSVC, so I can't really give you a step-by-step. I tried with MingW once, only to find that there was still a dependency on some small DLL.

I used hints from the folllowing webpages : Building static Qt on Windows (http://www.qtcentre.org/wiki/index.php?title=Building_static_Qt_on_Windows), Building Qt static and making it small with GCC, MSVC and Intel compiler. (http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/).

As far as I remember, I downloaded the pre-build SDK (the one that just installs itself including MingW, and that doesn't require building yourself) and then re-build with MingW with the options to make it static.

I have built 4.6.2 and 4.6.3.

For QtCreator, I downloaded the version 2.0 installer, and it worked fine. Only I can't build the debug helper for MSVC, but I think that is because QtCreator is build dynamically, and my Qt version is static.

Best regards,
Marc

elton.lika
12th October 2010, 19:13
I followed those instructions but still I get the same error.
I give up. I'm going to use Qt as is, shared, and distribute my apps with the required dll's.

zerbob
26th January 2011, 21:37
sorry wrong thread please delete my post