PDA

View Full Version : I got two problems when I used static compiled library of QT4



qintm
16th April 2006, 09:00
static compile Qt4 libs on linux

configure shell under:

./configure --prefix=/usr/lib/qt-4.1.2-static -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-db2 -no-sql-oci -no-sql-tds -fast -static -release -no-qt3support

Error infomation under:

g++ -static -Wl,-rpath,/usr/lib/qt-4.1.2-static/lib -Wl,-rpath,/usr/lib/qt-4.1.2-static/lib -o complexwizard .obj/release-static/complexwizard.o .obj/release-static/licensewizard.o .obj/release-static/main.o .obj/release-static/moc_complexwizard.o -L/root/qt-x11-opensource-src-4.1.2/lib -lQtGui -L/root/qt-x11-opensource-src-4.1.2/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
/root/qt-x11-opensource-src-4.1.2/lib/libQtCore.a(qlibrary_unix.o)(.text+0x62c): In function `QLibraryPrivate::load_sys()':
: warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/root/qt-x11-opensource-src-4.1.2/lib/libQtCore.a(qfsfileengine_unix.o)(.text+0x22f4): In function `QFSFileEngine::owner(QAbstractFileEngine::FileOwn er) const':
: warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/root/qt-x11-opensource-src-4.1.2/lib/libQtGui.a(qapplication_x11.o)(.text+0x117aa): In function `sm_performSaveYourself(QSessionManagerPrivate*)':
: warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/X11R6/lib/libX11.a(GetDflt.o)(.text+0x9a): In function `GetHomeDir':
: warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/X11R6/lib/libX11.a(GetDflt.o)(.text+0xea): In function `GetHomeDir':
: warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/X11R6/lib/libICE.a(transport.o)(.text+0x35b): In function `_IceTransSocketOpen':
: warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
/usr/X11R6/lib/libICE.a(transport.o)(.text+0x3ef0): In function `_IceTransGetPeerNetworkId':
: warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
/usr/X11R6/lib/libICE.a(transport.o)(.text+0x1eab): In function `_IceTransSocketINETConnect':
: warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
/usr/X11R6/lib/libICE.a(transport.o)(.text+0x1493): In function `_IceTransSocketINETCreateListener':
: warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2857): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2985): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2ad0): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2c0c): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2c8d): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2d6a): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_X11_Font_Format'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2de6): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2e58): In function `FcFreeTypeQuery':
: undefined reference to `FT_Get_BDF_Property'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x498): In function `FcConfigMessage':
: undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x52a): In function `FcConfigMessage':
: undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1947): In function `FcConfigParseAndLoad':
: undefined reference to `XML_ParserCreate'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1984): In function `FcConfigParseAndLoad':
: undefined reference to `XML_SetUserData'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x199e): In function `FcConfigParseAndLoad':
: undefined reference to `XML_SetDoctypeDeclHandler'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19b8): In function `FcConfigParseAndLoad':
: undefined reference to `XML_SetElementHandler'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19c9): In function `FcConfigParseAndLoad':
: undefined reference to `XML_SetCharacterDataHandler'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19dd): In function `FcConfigParseAndLoad':
: undefined reference to `XML_GetBuffer'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1a23): In function `FcConfigParseAndLoad':
: undefined reference to `XML_ParseBuffer'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1a53): In function `FcConfigParseAndLoad':
: undefined reference to `XML_ParserFree'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1c44): In function `FcConfigParseAndLoad':
: undefined reference to `XML_GetErrorCode'
/usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1c4c): In function `FcConfigParseAndLoad':
: undefined reference to `XML_ErrorString'
collect2: ld returned 1 exit status
make: *** [complexwizard] 错误 1



The static compiled Qt4 lib seem not supprot i18n?

dimitri
16th April 2006, 11:57
static compile Qt4 libs on linux
Which exact version of Qt? Which exact Linux distribution?


Error infomation under:

g++ -static -Wl,-rpath,/usr/lib/qt-4.1.2-static-full/lib -Wl,-rpath,/usr/lib/qt-4.1.2-static/lib [...]
Strange, have you somehow modified Qt to add -static? This is not supposed to appear in the linker command line. Also why are two directories involved here, /usr/lib/qt-4.1.2-static-full and /usr/lib/qt-4.1.2-static?


The static compiled Qt4 lib seem not supprot i18n?
There's nothing related to i18n here.

qintm
16th April 2006, 12:30
I confirm the PATH have not problem.

qintm
16th April 2006, 12:38
Thanks for dimitri, at first

Which exact version of Qt? Which exact Linux distribution?

Linux Version : RedFlag Desktop 5.0(equate Fedora Core 4 update 2)
Use zh_CN.gb18030 encode within it.


Strange, have you somehow modified Qt to add -static? This is not supposed to appear in the linker command line. Also why are two directories involved here, /usr/lib/qt-4.1.2-static-full and /usr/lib/qt-4.1.2-static?

This is not supposed to appear in the linker command line.

Why? Are you introduce ,detailed please.

There's nothing related to i18n here.

"There's nothing related to i18n here"

Yes,but I need !

How to static compile the Qt4 libs?

dimitri
16th April 2006, 13:00
Linux Version : RedFlag Desktop 5.0(equate Fedora Core 4 update 2)
Fedora Core 4 update 2 does not exist. Maybe you mean Red Hat Enterprise 4 update 2 or plain Fedora Core 4?



This is not supposed to appear in the linker command line.

Why? Are you introduce ,detailed please.

As far as I can remember the build system doesn't put -static there. I suspect you have added it yourself.

Actually I suspect you have two versions of Qt 4.1.2, one in /usr/lib/qt-4.1.2-static-full which you have modified yourself by adding -static somewhere and the other in /usr/lib/qt-4.1.2-static. These versions of Qt are somehow interfering. You have to describe what you're doing precisely if you want us to be able to help.

What is in /usr/lib/qt-4.1.2-static-full?
What is in /usr/lib/qt-4.1.2-static?
What is the value of PATH and QTDIR while you're building Qt in /root/qt-x11-opensource-src-4.1.2?
How do you configure Qt?


"There's nothing related to i18n here"

Yes,but I need !
I understand you need i18n. What I'm saying is that I don't see anything related to i18n in what you've posted so far, so there should be no problem with i18n. Don't bother with i18n.

qintm
20th April 2006, 05:16
I got two problems when I used static compiled library of QT4. The first one is the error in using static compile and link. The second one is the disorder code in using Designer to make the interface.

The configure option is as below:

./configure --prefix=/usr/lib/qt-4.1.2-static -no-sql-ibase -no-sql-mysql -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-db2 -no-sql-oci -no-sql-tds -fast -static -release -no-qt3support

Warning appeared at the end of compilation: It can’t use plug-in in static compilation. I wonder whether there is a plug-in mode in QT4’s international processing.

In order to test the linking of static library, I used the program “complexwizard” which is belong to QT4. The error is as below:

1. g++ -static -Wl,-rpath,/usr/lib/qt-4.1.2-static/lib -Wl,-rpath,/usr/lib/qt-4.1.2-static/lib -o complexwizard .obj/release-static/complexwizard.o .obj/release-static/licensewizard.o .obj/release-static/main.o .obj/release-static/moc_complexwizard.o -L/root/qt-x11-opensource-src-4.1.2/lib -lQtGui -L/root/qt-x11-opensource-src-4.1.2/lib -L/usr/X11R6/lib -lpng -lSM -lICE -lXi -lXrender -lXrandr -lXcursor -lXinerama -lfreetype -lfontconfig -lXext -lX11 -lQtCore -lz -lm -ldl -lpthread
2. /root/qt-x11-opensource-src-4.1.2/lib/libQtCore.a(qlibrary_unix.o)(.text+0x62c): In function `QLibraryPrivate::load_sys()':
3. : warning: Using 'dlopen' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
4. /root/qt-x11-opensource-src-4.1.2/lib/libQtCore.a(qfsfileengine_unix.o)(.text+0x22f4): In function `QFSFileEngine::owner(QAbstractFileEngine::FileOwn er) const':
5. : warning: Using 'getgrgid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
6. /root/qt-x11-opensource-src-4.1.2/lib/libQtGui.a(qapplication_x11.o)(.text+0x117aa): In function `sm_performSaveYourself(QSessionManagerPrivate*)':
7. : warning: Using 'getpwuid' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
8. /usr/X11R6/lib/libX11.a(GetDflt.o)(.text+0x9a): In function `GetHomeDir':
9. : warning: Using 'getpwnam_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
10. /usr/X11R6/lib/libX11.a(GetDflt.o)(.text+0xea): In function `GetHomeDir':
11. : warning: Using 'getpwuid_r' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
12. /usr/X11R6/lib/libICE.a(transport.o)(.text+0x35b): In function `_IceTransSocketOpen':
13. : warning: Using 'getaddrinfo' in statically linked applications requires at runtime the shared libraries from the glibc version used for linking
14. /usr/X11R6/lib/libICE.a(transport.o)(.text+0x3ef0): In function `_IceTransGetPeerNetworkId':
15. : warning: Using 'gethostbyaddr' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
16. /usr/X11R6/lib/libICE.a(transport.o)(.text+0x1eab): In function `_IceTransSocketINETConnect':
17. : warning: Using 'gethostbyname' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
18. /usr/X11R6/lib/libICE.a(transport.o)(.text+0x1493): In function `_IceTransSocketINETCreateListener':
19. : warning: Using 'getservbyname' in statically linked applications requires at runtime the shared libraries from the glibcversion used for linking
20. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2857): In function `FcFreeTypeQuery':
21. : undefined reference to `FT_Get_BDF_Property'
22. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2985): In function `FcFreeTypeQuery':
23. : undefined reference to `FT_Get_BDF_Property'
24. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2ad0): In function `FcFreeTypeQuery':
25. : undefined reference to `FT_Get_BDF_Property'
26. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2c0c): In function `FcFreeTypeQuery':
27. : undefined reference to `FT_Get_BDF_Property'
28. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2c8d): In function `FcFreeTypeQuery':
29. : undefined reference to `FT_Get_BDF_Property'
30. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2d6a): In function `FcFreeTypeQuery':
31. : undefined reference to `FT_Get_X11_Font_Format'
32. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2de6): In function `FcFreeTypeQuery':
33. : undefined reference to `FT_Get_BDF_Property'
34. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcfreetype.o)(.text+0x2e58): In function `FcFreeTypeQuery':
35. : undefined reference to `FT_Get_BDF_Property'
36. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x498): In function `FcConfigMessage':
37. : undefined reference to `XML_GetCurrentLineNumber'
38. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x52a): In function `FcConfigMessage':
39. : undefined reference to `XML_GetCurrentLineNumber'
40. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1947): In function `FcConfigParseAndLoad':
41. : undefined reference to `XML_ParserCreate'
42. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1984): In function `FcConfigParseAndLoad':
43. : undefined reference to `XML_SetUserData'
44. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x199e): In function `FcConfigParseAndLoad':
45. : undefined reference to `XML_SetDoctypeDeclHandler'
46. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19b8): In function `FcConfigParseAndLoad':
47. : undefined reference to `XML_SetElementHandler'
48. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19c9): In function `FcConfigParseAndLoad':
49. : undefined reference to `XML_SetCharacterDataHandler'
50. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x19dd): In function `FcConfigParseAndLoad':
51. : undefined reference to `XML_GetBuffer'
52. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1a23): In function `FcConfigParseAndLoad':
53. : undefined reference to `XML_ParseBuffer'
54. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1a53): In function `FcConfigParseAndLoad':
55. : undefined reference to `XML_ParserFree'
56. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1c44): In function `FcConfigParseAndLoad':
57. : undefined reference to `XML_GetErrorCode'
58. /usr/lib/gcc/i386-redflag-linux/3.4.3/../../../libfontconfig.a(fcxml.o)(.text+0x1c4c): In function `FcConfigParseAndLoad':
59. : undefined reference to `XML_ErrorString'
60. collect2: ld returned 1 exit status
61. make: *** [complexwizard] error 1


Note : The above error almost existed on every platform I used (For example: Fedora 5,RedFlag 4、5、workstation5.0,Mandriva 2006 free)

I originally considered it as the problem of fontconfig. But the problem appeared as of old when I download the original code of fontconfig which is the up-to-date version to compile again. I don’t know why.

--------------------------------------------------------------------------------------------------------
Another important question for me is that when I used Chinese input method in Designer it produced disordered code which happened not in the mode of static complication but in dynamic complication.

I am going at a setup program. I can’t expect all the machines which will use my program have the QT4 surrounding. So I am going to compile my program in the mode of static complication. I have reached good result in the surrounding of QT3 whether it is used to link or international process. I wonder how to use QT4 to obtain the perfect result. Is there anybody can help me? Thank you !

dimitri
20th April 2006, 05:46
I got two problems when I used static compiled library of QT4. The first one is the error in using static compile and link.

If you answer the questions asked, I might be able to help. Asking the same question again in a new thread will probably not get you anywhere. There's an issue with -static. Have you somehow added -static anywhere, except of course for the -static option of configure?


In order to test the linking of static library, I used the program “complexwizard” which is belong to QT4. The error is as below:
Ah! The complexwizard example should have been built while building Qt itself. Isn't that the case?

OK, I understand Qt has been built without problems. You now have problems linking your own programs (or Qt examples) using the -static linker option which you have added yourself. Am I correct?

dimitri
20th April 2006, 06:00
Warning appeared at the end of compilation: It can’t use plug-in in static compilation. I wonder whether there is a plug-in mode in QT4’s international processing.
Some input methods and JCK codecs are available as plugins when building a shared Qt library:

$ ls plugins/codecs plugins/inputmethods
plugins/codecs:
libqcncodecs_debug.so libqjpcodecs.so libqtwcodecs_debug.so
libqcncodecs.so libqkrcodecs_debug.so libqtwcodecs.so
libqjpcodecs_debug.so libqkrcodecs.so

plugins/inputmethods:
libqimsw-multi_debug.so libqimsw-multi.so
$
With a static Qt library, you probably need to build them into the Qt library, or maybe into your application. Do you have any specific problem?

wysota
20th April 2006, 09:52
Threads merged.