Qcad 2.2.1 pro compilation problem: qjpcodecs qjpeg qgif

Post your question about installing or upgrading to QCAD 2.1/2.2. Be sure to search, and check the docs before you post!

Moderator: andrew

Locked
ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Qcad 2.2.1 pro compilation problem: qjpcodecs qjpeg qgif

Post by ckomurlu » Thu May 07, 2009 1:48 pm

Hello,
I'm trying to compile Qcad 2.2.1.0-1 on Ubuntu 9.04 with Qt4.5 which is installed via Synaptic. I used build_qcad.sh script located in scripts directory. At the stage of "--- building qcad ---"I got this error report:

Code: Select all

rm: cannot remove `qcad': No such file or directory
Project MESSAGE: Property Editor
Project MESSAGE: NO Property Editor
Project MESSAGE: Platform: Unix / Linux / OS X
Project MESSAGE: Product: QCad
g++ -static-libgcc -L. -Wl,-O1 -o qcad .obj/qc_applicationwindow.o .obj/qc_application.o .obj/main.o .obj/moc_qc_applicationwindow.o .obj/moc_qc_application.o .obj/qrc_qcad.o    -L/usr/lib -L/plugins/codecs -lqjpcodecs -lqcncodecs -lqkrcodecs -lqtwcodecs -L/plugins/imageformats -lqjpeg -lqgif -lQtAssistantClient -L../qcadguiqt/lib -lqcadguiqt -L../qcadactions/lib -lqcadactions -L../qcadprop/lib -lqcadprop -L../qcadlib/lib -lqcad -L../dxflib/lib -llibdxf -L../fparser/lib -lfparser -lQtGui -lQtCore -lpthread
/usr/bin/ld: cannot find -lqjpcodecs
collect2: ld returned 1 exit status
make: *** [qcad] Error 1
I tried to compile qcad manually. First I made a "make clean". Then qmake, and then make. I got the same result. I looked for qjpcodec library which is located at the path:
/usr/lib/qt4/plugins/codecs/libqjpcodecs.so
I manually edited Makefile which is not generally recommended and added the path to the LIB variable with -L prefix.
Then I get the same link error for qjpeg and qgif libraries. I also found them in the path:
/usr/lib/qt4/plugins/imageformats/libqjpeg.so
/usr/lib/qt4/plugins/imageformats/libqgif.so
For them also, I edited the Makefile and added the path to the LIB variable. I compiled via "make" again; this time I got a sequence of "undefined reference" error which exceeded the terminal buffer. I tried to redirect the stdout to a file so that I could post the error message here, it did not work for make command.

Any suggestion will be highly appreciated.
Thanks in advance.
Best Regards,
Caner Kömürlü
R&D Office
Bilko Co.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Fri May 08, 2009 11:59 am

Do you use static or dynamic Qt libraries?

This matters because image codecs are loaded as plugins if Qt is linked in dynamically. If Qt is linked in statically, the image codecs also have to be linked statically.

Note that QCAD might or might not compile with Qt 4.5. The last officially supported Qt version is Qt 4.4.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Fri May 08, 2009 5:22 pm

I've checked qt4 files in system directories. Lib files I found, e.g. those which are in /usr/share/lib, are so files. So as far as I know this means that they are dynamically linking libraries.

Regards
Caner Kömürlü
R&D Office
Bilko Co.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Re: Qcad 2.2.1 pro compilation problem: qjpcodecs qjpeg qgif

Post by andrew » Fri May 08, 2009 5:25 pm

ckomurlu wrote:

Code: Select all

-L/plugins/codecs
This indicates that the environment variable QTDIR is not set. If QTDIR is set correctly, this should be something like:

Code: Select all

-L/path/to/qt/plugins/codecs

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Fri May 08, 2009 5:30 pm

ckomurlu wrote:So as far as I know this means that they are dynamically linking libraries.
Note that the QCAD build script might not work with dynamic Qt libraries.

Please make sure that all libraries are linked in from the same Qt compilation. That is most likely from a path where you have previously installed Qt. If you have installed Qt in /usr/lib/qt4, that looks correct. If the Qt version in /usr/lib/qt4 came with your distribution, you are most likely mixing two different Qt versions or compilations.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Fri May 08, 2009 6:00 pm

You're right, $QTDIR and $QMAKESPEC were not set. I set them and retried to build. I get the final error of the first post at this topic. It means that, I no longer need to set codecs path explicitly in the makefile. What I wonder now is, how other qcad libraries were built without those environment variables.
Well, the undefined reference error may be due to the version difference, which you have pointed to.
I installed the Qt library using Synaptic in Ubuntu 8.04. Then later, I upgraded the system to 8.10 and then to 9.04 recently.

Thanks a lot.
Best regards,
Caner Kömürlü
R&D Office
Bilko Co.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Fri May 08, 2009 7:29 pm

I tried to downgrade Qt4 using Synaptic which is told, able to do it in Package menu. Unfortunately, this option is disabled for Qt4.
However, for libqt4-core, the package explanation is given as:
This is a dummy transitional package to enable installation of other Debian
packages linked against Qt 4.3 or earlier Qt 4 releases previously shipped
in Debian.
I don't exactly figure out what it does mean. Does it mean that Qt4.5 is compatible with apps requesting Qt4.4 or earlier.

Regards.
Caner Kömürlü
R&D Office
Bilko Co.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Fri May 08, 2009 8:01 pm

ckomurlu wrote: I don't exactly figure out what it does mean. Does it mean that Qt4.5 is compatible with apps requesting Qt4.4 or earlier.
You might have to ask that in a Debian Linux forum.

I recommend to get Qt from trolltech.com. This way you know what exactly you get.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Tue May 19, 2009 9:57 am

Hello,
This time, I tried to compile QCAD 2.2.1 in a fresh Ubuntu 9.04. Instead of Ubuntu repositories Qt4 libraries, I have downloaded Qt 4.4.3 from Trolltech, compiled it and then tried to compile QCAD. Qt seems to be compiled correctly, I cheked the lib and include paths. They are just as told in INSTALL guide.
I tried to compile QCAD using build_qcad.sh. All libraries except qcad, have been well done. For qcad I got an error as following:

Code: Select all

--- building qcad ---
rm: cannot remove `qcad': No such file or directory
Project MESSAGE: Property Editor
Project MESSAGE: NO Property Editor
Project MESSAGE: Platform: Unix / Linux / OS X
Project MESSAGE: Product: QCad
g++ -m32 -static-libgcc -L. -Wl,-rpath,/usr/local/Trolltech/Qt-4.4.3/lib -o qcad .obj/qc_applicationwindow.o .obj/qc_application.o .obj/main.o .obj/moc_qc_applicationwindow.o .obj/moc_qc_application.o .obj/qrc_qcad.o    -L/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/local/Trolltech/Qt-4.4.3/plugins/codecs -lqjpcodecs -lqcncodecs -lqkrcodecs -lqtwcodecs -L/usr/local/Trolltech/Qt-4.4.3/plugins/imageformats -lqjpeg -lqgif -lQtAssistantClient -L../qcadguiqt/lib -lqcadguiqt -L../qcadactions/lib -lqcadactions -L../qcadprop/lib -lqcadprop -L../qcadlib/lib -lqcad -L../dxflib/lib -llibdxf -L../fparser/lib -lfparser -lQtGui -L/usr/local/Trolltech/Qt-4.4.3/lib -L/usr/X11R6/lib -lXext -lX11 -lQtCore -lm -lrt -ldl -lpthread
.obj/main.o: In function `global constructors keyed to splash':
main.cpp:(.text+0x79d): undefined reference to `qt_plugin_instance_QJpegPlugin()'
main.cpp:(.text+0x7a9): undefined reference to `qt_plugin_instance_QGifPlugin()'
main.cpp:(.text+0x7b5): undefined reference to `qt_plugin_instance_qcncodecs()'
main.cpp:(.text+0x7c1): undefined reference to `qt_plugin_instance_qjpcodecs()'
main.cpp:(.text+0x7cd): undefined reference to `qt_plugin_instance_qkrcodecs()'
main.cpp:(.text+0x7d9): undefined reference to `qt_plugin_instance_qtwcodecs()'
collect2: ld returned 1 exit status
make: *** [qcad] Error 1
bilko@jackalopeVbox:~/workbench/qcadlib-2.2.1.0-1-prof.src/scripts$
Apparently, it is a linking problem.

I checked environment variables QTDIR and QMAKESPEC. They were assigned the right values. I checked codecs and imageformats directories, they exist and contain the right libraries. Note that they are shared objects.

A final remark is that, I tried to compile QCAD professional, with Qt community edition.

Thanks a lot.
Best Regards,
Caner Kömürlü
R&D Office
Bilko Co.

User avatar
andrew
Site Admin
Posts: 9019
Joined: Fri Mar 30, 2007 6:07 am

Post by andrew » Tue May 19, 2009 7:39 pm

ckomurlu wrote:I checked codecs and imageformats directories, they exist and contain the right libraries. Note that they are shared objects.
That might be the problem. QCAD expects them to be statically linked in.

We configure Qt under Linux with the arguments below:

Code: Select all

./configure -static -qt-libpng -qt-libjpeg -qt-gif -qt-libtiff -qt-zlib -release -no-xfixes -no-stl -fast -no-xinerama -no-exceptions -no-separate-debug-info -no-glib -no-largefile -no-openssl -prefix /home/andrew/local/qt
Where -static seems to be the most relevant. Note that the linker will always link against the dynamic libraries if they are in the library path, so you might have to move them away if you rebuild Qt statically or do a make confclean before configuring and building the static Qt libraries.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Wed Jun 03, 2009 8:32 am

Hi,
I'm trying to compile Qt since then using the command of the previous post, I'm stuck at an error occurring at `make´. The error message is:

undefined reference to `qt_plugin_instance_qsqlite()'

Indeed, the original message is much longer, unfortunately, I've lost it.
I know this problem may be irrelevant for Qcad's forum, but I just thought that, maybe you have already dealt with the same problem and hopefully solved it.

Even, I tried g++ 4.2.4 and 4.3.3. It didn't work.

Thanks a lot.
Best regards,
Caner Kömürlü
R&D Office
Bilko Co.

ckomurlu
Junior Member
Posts: 11
Joined: Thu May 07, 2009 12:27 pm

Post by ckomurlu » Wed Jun 03, 2009 12:56 pm

Hi,
Related to the previous post, I just added three parameters to configure command which andrew suggested. The configure command I run:

Code: Select all

./configure -static -qt-libpng -qt-libjpeg -qt-gif -qt-libtiff -qt-zlib -release -no-xfixes -no-stl -fast -no-xinerama -no-exceptions -no-separate-debug-info -no-glib -no-largefile -no-openssl -nomake demos -nomake examples -qt-sql-sqlite -prefix /home/bilko/workbench/qt-all-opensource-src-4.4.3/
In this command, the parameters which I added are -nomake demos, -nomake examples and -qt-sql-sqlite. The first two prevent demos and examples codes being compiled. The third forces sqlite plugin to be compiled.

Then I build via

Code: Select all

make
Apparently, there's no problem.

Best regards,
Caner Kömürlü
R&D Office
Bilko Co.

Locked

Return to “QCAD 2.1/2.2 Installation and Upgrades”