July 2, 2010

Luca Luca
Ant Farmer
638 posts

Qt Creator 2 && Qt 4.6.3

 

Hi all,
I upgraded QtCreator from 1.3.1 to 2.0.0 (using linux binaries from qt.nokia.com) but I get an error while running compiled application.

I’m using Qt 4.6.3 compiled my self on linux.

You can generate the error in this way:

  1. open qt creator 2
  2. create new project (Qt GUI Application)
  3. press —> next, next …. finish
  4. add to the .pro file :
    1. QT  += svg
  5. rebuild (using qt4-4.6.3)
  6. run

I get:

  1. Starting /home/luca/test-build-desktop/test...
  2. /home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
  3. /home/luca/test-build-desktop/test exited with code 127

While I have no problem with Qt Creator 1.3.1

11 replies

July 2, 2010

Tobias Hunger Tobias Hunger
Robot Herder
3387 posts

For reference: c++filt says the missing symbol’s demangled name is: QMetaType::registerTypedef(char const*, int).

Why is your application trying to use libQDBus from qtcreator-2.0.0/lib? Those are 4.7 snapshots meant for qt creator only. Please make sure the proper libraries are linked to your application.

Maybe you have no libQtDBus version 4.6.3 installed and the build is picking up creators version due to that, trying to link it to the installed libQtCore version 4.6.3?

July 2, 2010

Luca Luca
Ant Farmer
638 posts
Tobias Hunger wrote:
Why is your application trying to use libQDBus from qtcreator-2.0.0/lib? Those are 4.7 snapshots meant for qt creator only. Please make sure the proper libraries are linked to your application.

I don’t know why… The application is, as I said, as simple as possible (only an empty QMainWindow with nothing in it).
I think the libraries are linked correctly because if I compile with qt creator and the run the application from a console it start without problem. I get the error message only when I run from qt creator (CTRL+R).

Now I tried in another linux pc and it’s the same.

After building the test application if I execute ldd test I get:

  1. /test-build-desktop$ ldd test
  2.         linux-gate.so.1 =>  (0xffffe000)
  3.         libQtSvg.so.4 => /opt/qt4-4.6.3/lib/libQtSvg.so.4 (0xb783a000)
  4.         libQtGui.so.4 => /opt/qt4-4.6.3/lib/libQtGui.so.4 (0xb6dc4000)
  5.         libQtCore.so.4 => /opt/qt4-4.6.3/lib/libQtCore.so.4 (0xb6b52000)
  6.         libpthread.so.0 => /lib/libpthread.so.0 (0xb6b12000)
  7.         libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6a21000)
  8.         libm.so.6 => /lib/libm.so.6 (0xb69fb000)
  9.         libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb69de000)
  10.         libc.so.6 => /lib/libc.so.6 (0xb687b000)
  11.         libz.so.1 => /usr/lib/libz.so.1 (0xb6867000)
  12.         libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6862000)
  13.         librt.so.1 => /lib/librt.so.1 (0xb6859000)
  14.         libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb6789000)
  15.         libpng14.so.14 => /usr/lib/libpng14.so.14 (0xb6763000)
  16.         libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb66ed000)
  17.         libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb66b3000)
  18.         libEGL.so.1 => /usr/lib/libEGL.so.1 (0xb66a5000)
  19.         libSM.so.6 => /usr/lib/libSM.so.6 (0xb669d000)
  20.         libICE.so.6 => /usr/lib/libICE.so.6 (0xb6686000)
  21.         libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb667d000)
  22.         libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb664f000)
  23.         libXext.so.6 => /usr/lib/libXext.so.6 (0xb6641000)
  24.         libX11.so.6 => /usr/lib/libX11.so.6 (0xb6525000)
  25.         libdl.so.2 => /lib/libdl.so.2 (0xb6521000)
  26.         /lib/ld-linux.so.2 (0xb7888000)
  27.         libuuid.so.1 => /lib/libuuid.so.1 (0xb651d000)
  28.         libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb64fd000)
  29.         libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb64e4000)
  30.         libXau.so.6 => /usr/lib/libXau.so.6 (0xb64e1000)
  31.         libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb64dc000)

If I execute from console I get no error:

  1. luca@slack131:~/test-build-desktop$ ./test
  2.  
  3. ^C
  4. luca@slack131:~/test-build-desktop$

but if I run from qt creator 2 I get:

  1. Starting /home/luca/test-build-desktop/test...
  2. /home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
  3. /home/luca/test-build-desktop/test exited with code 127

I’m not using dbus, my test.pro is:

  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2010-07-02T19:15:44
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT       += core gui
  8. QT       += svg
  9.  
  10. TARGET = test
  11. TEMPLATE = app
  12.  
  13.  
  14. SOURCES += main.cpp\
  15.         mainwindow.cpp
  16.  
  17. HEADERS  += mainwindow.h
  18.  
  19. FORMS    += mainwindow.ui

if I remove from .pro the line

  1. QT       += svg

the problem disappear:

  1. Starting /home/luca/test-build-desktop/test...
  2. /home/luca/test-build-desktop/test exited with code 0

July 2, 2010

Tobias Hunger Tobias Hunger
Robot Herder
3387 posts

Can you check the qmake command creator is using to configure the project? You can find it in right at the top of the compile output window after rerunning QMake.

Do you get the same error when running exactly that from the command line?

If no, then please check the build setting in the project mode (Ctrl-5). Is there anything strange in the environment used to build? Any LD_LIBRARY_PATH set, how about QTDIR and QT_PLUGIN_PATH? Are there any differences to what you see in your terminal?

If yes, then there is something seriously wrong.

July 3, 2010

Luca Luca
Ant Farmer
638 posts

I post some information in step from qtcreator:

  1. I cleaned the test project:
    1. Running build steps for project test...
    2. Starting: "/usr/bin/make" clean -w
    3. make: Entering directory `/home/luca/test-build-desktop'
    4. rm -f moc_mainwindow.cpp
    5. rm -f ui_mainwindow.h
    6. rm -f main.o mainwindow.o moc_mainwindow.o
    7. rm -f *~ core *.core
    8. make: Leaving directory `/home/luca/test-build-desktop'
    9. The process "/usr/bin/make" exited normally.
  2. run qmake:
    1. Running build steps for project test...
    2. Starting: "/opt/qt4-4.6.3/bin/qmake" /home/luca/test/test.pro -r -spec linux-g++
    3. The process "/opt/qt4-4.6.3/bin/qmake" exited normally.
  3. build the project:
    1. Running build steps for project test...
    2. Configuration unchanged, skipping qmake step.
    3. Starting: "/usr/bin/make" -w
    4. make: Entering directory `/home/luca/test-build-desktop'
    5. /opt/qt4-4.6.3/bin/uic ../test/mainwindow.ui -o ui_mainwindow.h
    6. g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt4-4.6.3/mkspecs/linux-g++ -I../test -I/opt/qt4-4.6.3/include/QtCore -I/opt/qt4-4.6.3/include/QtGui -I/opt/qt4-4.6.3/include/QtSvg -I/opt/qt4-4.6.3/include -I. -I. -I../test -I. -o main.o ../test/main.cpp
    7. g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt4-4.6.3/mkspecs/linux-g++ -I../test -I/opt/qt4-4.6.3/include/QtCore -I/opt/qt4-4.6.3/include/QtGui -I/opt/qt4-4.6.3/include/QtSvg -I/opt/qt4-4.6.3/include -I. -I. -I../test -I. -o mainwindow.o ../test/mainwindow.cpp
    8. /opt/qt4-4.6.3/bin/moc -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt4-4.6.3/mkspecs/linux-g++ -I../test -I/opt/qt4-4.6.3/include/QtCore -I/opt/qt4-4.6.3/include/QtGui -I/opt/qt4-4.6.3/include/QtSvg -I/opt/qt4-4.6.3/include -I. -I. -I../test -I. ../test/mainwindow.h -o moc_mainwindow.cpp
    9. g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SVG_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/opt/qt4-4.6.3/mkspecs/linux-g++ -I../test -I/opt/qt4-4.6.3/include/QtCore -I/opt/qt4-4.6.3/include/QtGui -I/opt/qt4-4.6.3/include/QtSvg -I/opt/qt4-4.6.3/include -I. -I. -I../test -I. -o moc_mainwindow.o moc_mainwindow.cpp
    10. g++ -Wl,-rpath,/opt/qt4-4.6.3/lib -o test main.o mainwindow.o moc_mainwindow.o -L/opt/qt4-4.6.3/lib -lQtSvg -L/opt/qt4-4.6.3/lib -L/usr/X11R6/lib -lQtGui -lQtCore -lpthread
    11. make: Leaving directory `/home/luca/test-build-desktop'
    12. The process "/usr/bin/make" exited normally.
  4. and finally run the application:
    1. tarting /home/luca/test-build-desktop/test...
    2. /home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
    3. /home/luca/test-build-desktop/test exited with code 127

If I run from console (in kde konsole) the application start without problem and I see the empty QMainWondow.

EDIT.

Finally, thanks to your suggestions, I find how to make the application running from qt-creator.
The problem is in the environment variable LD_LIBRARY_PATH from qtcreator build environment:

  1.  /home/luca/qtcreator-2.0.0/lib:/home/luca/qtcreator-2.0.0/lib/qtcreator:

If I delete this variable and then rebuild the application starts without problem.

I seen that in my console LD_LIBRARY_PATH is not set.

The strange thing is that in qt creator 1.3.1 LD_LIBRARY_PATH is set to:

  1. /home/luca/qtcreator-1.3.1/lib/qtcreator:

but it give no problem…

Why is LD_LIBRARY_PATH set in qt creator…?

Thanks a lot for your help

July 3, 2010

Tobias Hunger Tobias Hunger
Robot Herder
3387 posts

So is this issue solved now? Does it start from creator, too?

July 3, 2010

Luca Luca
Ant Farmer
638 posts

Yes, as said in the last part of my post, cleaning LD_LIBRARY_PATH (leaving it empty) now it start also from qtcreator.

July 3, 2010

Luca Luca
Ant Farmer
638 posts

If I set in qt creator 1.3.1 LD_LIBRARY_PATH from:

  1. /home/luca/qtcreator-1.3.1/lib/qtcreator:

to:
  1.  /home/luca/qtcreator-1.3.1/lib:/home/luca/qtcreator-1.3.1/lib/qtcreator:

when running from qt creator I get this error:
  1.  Starting /home/luca/test/test...
  2. Cannot mix incompatible Qt libraries
  3. The program has unexpectedly finished.
  4. /home/luca/test/test exited with code 0

so I think the wrong part in LD_LIBRARY_PATH is:

  1.  /home/luca/qtcreator-1.3.1/lib

or (in qt creator 2):
  1. /home/luca/qtcreator-2.0.0/lib

July 3, 2010

Luca Luca
Ant Farmer
638 posts

I correct me, in qtcreator 2 LD_LIBRARY_PATH must be empty because if I set it to:

  1. /home/luca/qtcreator-2.0.0/lib/qtcreator:

I get this error:

  1. tarting /home/luca/test-build-desktop/test...
  2. Cannot mix incompatible Qt libraries
  3. The program has unexpectedly finished.
  4. /home/luca/test-build-desktop/test exited with code 0

July 3, 2010

Tobias Hunger Tobias Hunger
Robot Herder
3387 posts

Great! Enjoy working with creator.

July 5, 2010

Luca Luca
Ant Farmer
638 posts

How can I set QtCreator 2 to have LD_LIBRARY_PATH empty for every project I create?

August 5, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1481 posts

how about a sh script that sets/exports LD_LIBRARY_PATH and then launch the creator.. won’t this work?

 
  ‹‹ What about qt-labs/opencl      Qt containers inadequate to x64 ››

You must log in to post a reply. Not a member yet? Register here!