PDA

View Full Version : building qt statically



eleanor
8th May 2009, 06:55
Hi, I'm trying to build qt statically. I configured with this command.


./configure -static --prefix=/sources/qt/ && make



But when I issued make, I got this error:


ct-2.0 -lSM -lICE -pthread -pthread -lXrender -lfontconfig -lXext -lX11 -lQtNetwork -pthread -pthread -lQtCore -lz -lm -pthread -lgthread-2.0 -lrt -lglib-2.0 -lpthread -ldl
.obj/release-static/main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x1b): undefined reference to `qt_plugin_instance_qsqlite()'
collect2: ld returned 1 exit status
make[4]: *** [../../../../bin/assistant] Error 1
make[4]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant/tools/assistant'
make[3]: *** [sub-assistant-make_default-ordered] Error 2
make[3]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant/tools'
make[2]: *** [sub-tools-make_default-ordered] Error 2
make[2]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant'
make[1]: *** [sub-assistant-make_default-ordered] Error 2
make[1]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools'
make: *** [sub-tools-make_default-ordered] Error 2


Any ideas?

wysota
8th May 2009, 07:16
You didn't build the static plugins. But anyway it's not worth building the tools in static mode so you don't have to have assistant compiled.

eleanor
8th May 2009, 09:49
Hi, I tried compiling it like this:



./configure -static --prefix=/sources/qt/ -release -no-exceptions && make && make sub-src


and I get this error:


.obj/release-static/main.o: In function `__static_initialization_and_destruction_0(int, int)':
main.cpp:(.text+0x1b): undefined reference to `qt_plugin_instance_qsqlite()'
collect2: ld returned 1 exit status
make[4]: *** [../../../../bin/assistant] Error 1
make[4]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant/tools/assistant'
make[3]: *** [sub-assistant-install_subtargets-ordered] Error 2
make[3]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant/tools'
make[2]: *** [sub-tools-install_subtargets-ordered] Error 2
make[2]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools/assistant'
make[1]: *** [sub-assistant-install_subtargets-ordered] Error 2
make[1]: Leaving directory `/sources/qt-x11-opensource-src-4.5.0/tools'
make: *** [sub-tools-install_subtargets-ordered] Error 2



so, pretty much the same error as above. Can you tell me how to not build with assistant support?

wysota
8th May 2009, 10:36
You should only make sub-src, not everything (so remove the first "make").

eleanor
8th May 2009, 19:16
Hi, ok the package was build successfully...then I added the "CONFIG += static" to the *.pro file and run "make distclean && qmake && make" but it's still not build statically, look at this:



eleanor-laptop client # file ./client
./client: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), not stripped
eleanor-laptop client # ldd ./client
linux-gate.so.1 => (0xb7fe8000)
libxerces-c-3.0.so => /usr/lib/libxerces-c-3.0.so (0xb7c38000)
libpng12.so.0 => /usr/lib/libpng12.so.0 (0x4d9ee000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0x44d68000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0x450cb000)
libSM.so.6 => /usr/lib/libSM.so.6 (0x45115000)
libICE.so.6 => /usr/lib/libICE.so.6 (0x45121000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0x44fa6000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0x4d9b6000)
libXext.so.6 => /usr/lib/libXext.so.6 (0x44e07000)
libX11.so.6 => /usr/lib/libX11.so.6 (0x44c4c000)
libz.so.1 => /lib/libz.so.1 (0x44c34000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0x44149000)
librt.so.1 => /lib/librt.so.1 (0x43fe2000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0x44fde000)
libdl.so.2 => /lib/libdl.so.2 (0x44c15000)
libpthread.so.0 => /lib/libpthread.so.0 (0x44c1b000)
libstdc++.so.6 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libstdc++.so.6 (0x44e49000)
libm.so.6 => /lib/libm.so.6 (0x44bed000)
libgcc_s.so.1 => /usr/lib/gcc/i686-pc-linux-gnu/4.1.2/libgcc_s.so.1 (0x44f36000)
libc.so.6 => /lib/libc.so.6 (0x44abb000)
libnsl.so.1 => /lib/libnsl.so.1 (0x445f1000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0x4d988000)
libXau.so.6 => /usr/lib/libXau.so.6 (0x44d59000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0x44d5f000)
/lib/ld-linux.so.2 (0x43fc4000)
eleanor-laptop client #


So, what seems to be the problem? Any ideas are appreciated!

wysota
8th May 2009, 20:50
Sure it is built statically - look that the appliation doesn't have Qt listed in its dependencies. If you want other libs embedded statically, you need them available in static version when building Qt and your application.

eleanor
8th May 2009, 22:57
And how to do that? Can you provide a link to some tutotrial?

wysota
9th May 2009, 09:03
You need a static version of each of the libraries. Most popular ones usually have dedicated packages with static versions, others you'd have to compile yourself.