Page 1 of 1

Qcad 2.2.1 pro link problem: libQtGui.a

Posted: Thu Jun 04, 2009 4:58 pm
by ckomurlu
Hi,
I try to build Qcad 2.2.1 pro on Ubuntu 9.04 with Qt4.4.3 built statically. All modules of Qcad were built except qcad. The compilation of qcad module went alright but I got stuck at linking with the error below:

Code: Select all

/home/bilko/workbench/qt-all-opensource-src-4.4.3//lib/libQtGui.a(qapplication_x
11.o): In function `qt_wstate_iconified(unsigned long)':
qapplication_x11.cpp:(.text+0x76b): undefined reference to `XGetWindowProperty'
qapplication_x11.cpp:(.text+0x79c): undefined reference to `XFree'
/home/bilko/workbench/qt-all-opensource-src-4.4.3//lib/libQtGui.a(qapplication_x
11.o): In function `_ZL20qt_check_focus_modelv':
qapplication_x11.cpp:(.text+0x8e4): undefined reference to `XGetInputFocus'
/home/bilko/workbench/qt-all-opensource-src-4.4.3//lib/libQtGui.a(qapplication_x
11.o): In function `_ZL20qt_get_net_supportedv':
qapplication_x11.cpp:(.text+0xa0d): undefined reference to `XGetWindowProperty'
qapplication_x11.cpp:(.text+0xa1e): undefined reference to `XFree'
qapplication_x11.cpp:(.text+0xb0f): undefined reference to `XGetWindowProperty'
qapplication_x11.cpp:(.text+0xb33): undefined reference to `XFree'

and so on
I installed dev packages of X11 using Synaptic. Not only qapplication_x11.cpp but also other .cpp files throw such errors at this linking stage. I cheked the files in qt4.4.3/src/gui/kernel, there the files are. What can be the cause, any solution suggestion?

I can also post the whole error report.

Thanks a lot.
Best regards,

Posted: Fri Jun 05, 2009 1:05 pm
by ckomurlu
Hello,
In this problem, qcad cannot reach X11 lib at linking. Hence in Makefile, adding -lX11 option to the lib list is enough to solve X11 related problems. Then, a second undefined reference problem occurs. The error report is:

Code: Select all

In function `QTimerInfoList::getTime(timeval&)':
qeventdispatcher_unix.cpp:(.text+0x8c7): undefined reference to `clock_gettime'
collect2: ld returned 1 exit status
make: *** [qcad] Error 1
To solve it, again I added a lib into list: -lrt

Briefly, adding parameters -lX11 and -lrt to LIBS variable solves these link problems. Note that, it's a kind of workaround, since the Makefile is automatically generated using .pro file and qmake command. The exact solution is supposed to be related to .pro file, not to Makefile.

Regards