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:
open qt creator 2
create new project (Qt GUI Application)
press --> next, next .... finish
add to the .pro file :
@
QT += svg
@rebuild (using qt4-4.6.3)
run
I get:
@
Starting /home/luca/test-build-desktop/test...
/home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
/home/luca/test-build-desktop/test exited with code 127
@While I have no problem with Qt Creator 1.3.1
-
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?
-
[quote author="Tobias Hunger" date="1278086866"]
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.
[/quote]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:
@
/test-build-desktop$ ldd test
linux-gate.so.1 => (0xffffe000)
libQtSvg.so.4 => /opt/qt4-4.6.3/lib/libQtSvg.so.4 (0xb783a000)
libQtGui.so.4 => /opt/qt4-4.6.3/lib/libQtGui.so.4 (0xb6dc4000)
libQtCore.so.4 => /opt/qt4-4.6.3/lib/libQtCore.so.4 (0xb6b52000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb6b12000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6a21000)
libm.so.6 => /lib/libm.so.6 (0xb69fb000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb69de000)
libc.so.6 => /lib/libc.so.6 (0xb687b000)
libz.so.1 => /usr/lib/libz.so.1 (0xb6867000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6862000)
librt.so.1 => /lib/librt.so.1 (0xb6859000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb6789000)
libpng14.so.14 => /usr/lib/libpng14.so.14 (0xb6763000)
libfreetype.so.6 => /usr/lib/libfreetype.so.6 (0xb66ed000)
libgobject-2.0.so.0 => /usr/lib/libgobject-2.0.so.0 (0xb66b3000)
libEGL.so.1 => /usr/lib/libEGL.so.1 (0xb66a5000)
libSM.so.6 => /usr/lib/libSM.so.6 (0xb669d000)
libICE.so.6 => /usr/lib/libICE.so.6 (0xb6686000)
libXrender.so.1 => /usr/lib/libXrender.so.1 (0xb667d000)
libfontconfig.so.1 => /usr/lib/libfontconfig.so.1 (0xb664f000)
libXext.so.6 => /usr/lib/libXext.so.6 (0xb6641000)
libX11.so.6 => /usr/lib/libX11.so.6 (0xb6525000)
libdl.so.2 => /lib/libdl.so.2 (0xb6521000)
/lib/ld-linux.so.2 (0xb7888000)
libuuid.so.1 => /lib/libuuid.so.1 (0xb651d000)
libexpat.so.1 => /usr/lib/libexpat.so.1 (0xb64fd000)
libxcb.so.1 => /usr/lib/libxcb.so.1 (0xb64e4000)
libXau.so.6 => /usr/lib/libXau.so.6 (0xb64e1000)
libXdmcp.so.6 => /usr/lib/libXdmcp.so.6 (0xb64dc000)
@If I execute from console I get no error:
@
luca@slack131:~/test-build-desktop$ ./test^C
luca@slack131:~/test-build-desktop$
@but if I run from qt creator 2 I get:
@
Starting /home/luca/test-build-desktop/test...
/home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
/home/luca/test-build-desktop/test exited with code 127
@I'm not using dbus, my test.pro is:
@
#-------------------------------------------------Project created by QtCreator 2010-07-02T19:15:44
#-------------------------------------------------
QT += core gui
QT += svgTARGET = test
TEMPLATE = appSOURCES += main.cpp
mainwindow.cppHEADERS += mainwindow.h
FORMS += mainwindow.ui
@
if I remove from .pro the line
@
QT += svg
@the problem disappear:
@
Starting /home/luca/test-build-desktop/test...
/home/luca/test-build-desktop/test exited with code 0
@ -
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.
-
I post some information in step from qtcreator:
I cleaned the test project:
@
Running build steps for project test...
Starting: "/usr/bin/make" clean -w
make: Entering directory/home/luca/test-build-desktop' rm -f moc_mainwindow.cpp rm -f ui_mainwindow.h rm -f main.o mainwindow.o moc_mainwindow.o rm -f *~ core *.core make: Leaving directory
/home/luca/test-build-desktop'
The process "/usr/bin/make" exited normally.
@run qmake:
@
Running build steps for project test...
Starting: "/opt/qt4-4.6.3/bin/qmake" /home/luca/test/test.pro -r -spec linux-g++
The process "/opt/qt4-4.6.3/bin/qmake" exited normally.
@build the project:
@
Running build steps for project test...
Configuration unchanged, skipping qmake step.
Starting: "/usr/bin/make" -w
make: Entering directory/home/luca/test-build-desktop' /opt/qt4-4.6.3/bin/uic ../test/mainwindow.ui -o ui_mainwindow.h 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 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 /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 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 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 make: Leaving directory
/home/luca/test-build-desktop'
The process "/usr/bin/make" exited normally.
@and finally run the application:
@
tarting /home/luca/test-build-desktop/test...
/home/luca/test-build-desktop/test: symbol lookup error: /home/luca/qtcreator-2.0.0/lib/libQtDBus.so.4: undefined symbol: _ZN9QMetaType15registerTypedefEPKci
/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:
@
/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:
@
/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
-
So is this issue solved now? Does it start from creator, too?
-
Yes, as said in the last part of my post, cleaning LD_LIBRARY_PATH (leaving it empty) now it start also from qtcreator.
-
If I set in qt creator 1.3.1 LD_LIBRARY_PATH from:
@
/home/luca/qtcreator-1.3.1/lib/qtcreator:
@
to:
@
/home/luca/qtcreator-1.3.1/lib:/home/luca/qtcreator-1.3.1/lib/qtcreator:
@
when running from qt creator I get this error:
@
Starting /home/luca/test/test...
Cannot mix incompatible Qt libraries
The program has unexpectedly finished.
/home/luca/test/test exited with code 0
@so I think the wrong part in LD_LIBRARY_PATH is:
@
/home/luca/qtcreator-1.3.1/lib
@
or (in qt creator 2):
@
/home/luca/qtcreator-2.0.0/lib
@ -
I correct me, in qtcreator 2 LD_LIBRARY_PATH must be empty because if I set it to:
@
/home/luca/qtcreator-2.0.0/lib/qtcreator:
@I get this error:
@
tarting /home/luca/test-build-desktop/test...
Cannot mix incompatible Qt libraries
The program has unexpectedly finished.
/home/luca/test-build-desktop/test exited with code 0
@ -
Great! Enjoy working with creator.
-
How can I set QtCreator 2 to have LD_LIBRARY_PATH empty for every project I create?
-
how about a sh script that sets/exports LD_LIBRARY_PATH and then launch the creator.. won't this work?