PDA

View Full Version : Application compiling under QtCreator, but not from command line with pure qmake.



googie
22nd December 2013, 23:50
Hi,

My projects compiles and runs fine from QtCreator, but when I build it from command line I get errors:
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QByteArray::realloc(int)'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `qHash(QString const&)'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::fromAscii(char const*, int)'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `qt_message_output(QtMsgType, char const*)'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::operator==(QString const&) const'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::operator==(QLatin1String const&) const'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::shared_null'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QHashData::detach_helper2(void (*)(QHashData::Node*, void*), void (*)(QHashData::Node*), int, int)'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::codecForCStrings'
/tmp/a/app/SQLiteStudio/../coreSQLiteStudio//libcoreSQLiteStudio.so: undefined reference to `QString::free(QString::Data*)'
collect2: error: ld returned 1 exit status

Note, that I have 3 qt versions installed in system:
/usr/lib/qt/bin/qmake
/opt/qt5/Qt5.2.0/5.2.0/gcc/bin/qmake
/opt/qt5/Qt5.1.0/5.1.0/gcc/bin/qmake

I ran /opt/qt5/Qt5.2.0/5.2.0/gcc/bin/qmake and then make. It compiled for a while just fine and then - at the final step - this came out.

The application is made of one shared library and one final executable, that links to the shared library.
Linker command was:
g++ -Wl,-O1 -Wl,-rpath,/opt/qt5/Qt5.2.0/5.2.0/gcc -Wl,-rpath,/opt/qt5/Qt5.2.0/5.2.0/gcc/lib
-o SQLiteStudio
main.o mainwindow.o iconmanager.o dbtreemodel.o dbtreeitem.o dbtree.o
dbtreeview.o actionentry.o dbdialog.o uiutils.o dbtreeitemdelegate.o dbtreeitemfactory.o
sqleditor.o sqlitesyntaxhighlighter.o sqlquerymodel.o dblistmodel.o mdiarea.o statusfield.o
tablewidget.o sqlqueryitem.o sqlqueryview.o sqlquerymodelcolumn.o sqlqueryitemdelegate.o
extlineedit.o intvalidator.o widgetcover.o mdiwindow.o mdichild.o taskbar.o multieditor.o
multieditorwidget.o widgetresizer.o multieditortext.o multieditornumeric.o numericspinbox.o
multieditordatetime.o multieditordate.o multieditortime.o formview.o multieditorbool.o
multieditorhex.o xbytearray.o qhexedit_p.o qhexedit.o commands.o multieditordialog.o
completerwindow.o completermodel.o completeritemdelegate.o completerview.o
searchtextdialog.o searchtextlocator.o tablewindow.o editorwindow.o sqltablemodel.o
dataview.o tablestructuremodel.o tableconstraintsmodel.o columndialog.o
columndialogconstraintsmodel.o extactioncontainer.o extaction.o tableprimarykeypanel.o
constraintpanel.o tableforeignkeypanel.o tableuniquepanel.o tablepkanduniquepanel.o
tablecheckpanel.o columncheckpanel.o constraintcheckpanel.o columnforeignkeypanel.o
columnprimarykeypanel.o columnuniquepanel.o columnuniqueandnotnullpanel.o
columnnotnullpanel.o columncollatepanel.o columndefaultpanel.o constraintdialog.o
newconstraintdialog.o constrainttabmodel.o messagelistdialog.o viewwindow.o
configdialog.o uiconfig.o indexdialog.o sqlview.o triggerdialog.o triggercolumnsdialog.o
dbobjectdialogs.o moc_mainwindow.o moc_dbtreemodel.o moc_dbtreeitem.o
moc_dbtree.o moc_dbtreeview.o moc_dbdialog.o moc_dbtreeitemdelegate.o
moc_sqleditor.o moc_sqlitesyntaxhighlighter.o moc_sqlquerymodel.o moc_dblistmodel.o
moc_mdiarea.o moc_statusfield.o moc_tablewidget.o moc_sqlqueryitem.o
moc_sqlqueryview.o moc_sqlqueryitemdelegate.o moc_extlineedit.o moc_intvalidator.o
moc_widgetcover.o moc_mdiwindow.o moc_mdichild.o moc_taskbar.o
moc_multieditor.o moc_multieditorwidget.o moc_widgetresizer.o moc_multieditortext.o
moc_numericspinbox.o moc_multieditordatetime.o moc_formview.o moc_multieditorhex.o
moc_qhexedit_p.o moc_qhexedit.o moc_multieditordialog.o moc_completerwindow.o
moc_completeritemdelegate.o moc_completerview.o moc_searchtextdialog.o
moc_searchtextlocator.o moc_tablewindow.o moc_editorwindow.o moc_sqltablemodel.o
moc_dataview.o moc_tablestructuremodel.o moc_tableconstraintsmodel.o
moc_columndialog.o moc_columndialogconstraintsmodel.o moc_tableprimarykeypanel.o
moc_constraintpanel.o moc_tableforeignkeypanel.o moc_tableuniquepanel.o
moc_tablepkanduniquepanel.o moc_tablecheckpanel.o moc_columncheckpanel.o
moc_constraintcheckpanel.o moc_columnforeignkeypanel.o moc_columnprimarykeypanel.o
moc_columnuniquepanel.o moc_columnuniqueandnotnullpanel.o moc_columnnotnullpanel.o
moc_columncollatepanel.o moc_columndefaultpanel.o moc_constraintdialog.o
moc_newconstraintdialog.o moc_constrainttabmodel.o moc_messagelistdialog.o
moc_viewwindow.o moc_configdialog.o moc_indexdialog.o moc_sqlview.o
moc_triggerdialog.o moc_triggercolumnsdialog.o
-L/tmp/a/app/SQLiteStudio/../coreSQLiteStudio/ -lcoreSQLiteStudio
-L/opt/qt5/Qt5.2.0/5.2.0/gcc/lib -lQt5UiTools -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread

All paths looks correct. I tried "ldd" on the libcoreSQLiteStudio.so requested here and it says:
$ ldd libcoreSQLiteStudio.so.1.0.0
linux-gate.so.1 (0xffffe000)
libQt5Sql.so.5 => /opt/qt5/Qt5.2.0/5.2.0/gcc/lib/libQt5Sql.so.5 (0xb7599000)
libQt5Core.so.5 => /opt/qt5/Qt5.2.0/5.2.0/gcc/lib/libQt5Core.so.5 (0xb70d0000)
libpthread.so.0 => /lib/libpthread.so.0 (0xb7083000)
libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0xb6f9b000)
libm.so.6 => /lib/libm.so.6 (0xb6f58000)
libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0xb6f3c000)
libc.so.6 => /lib/libc.so.6 (0xb6db1000)
libicui18n.so.51 => /opt/qt5/Qt5.2.0/5.2.0/gcc/lib/libicui18n.so.51 (0xb6b8f000)
libicuuc.so.51 => /opt/qt5/Qt5.2.0/5.2.0/gcc/lib/libicuuc.so.51 (0xb6a16000)
libdl.so.2 => /lib/libdl.so.2 (0xb6a10000)
libgthread-2.0.so.0 => /usr/lib/libgthread-2.0.so.0 (0xb6a0e000)
librt.so.1 => /lib/librt.so.1 (0xb6a05000)
libglib-2.0.so.0 => /usr/lib/libglib-2.0.so.0 (0xb68d7000)
/lib/ld-linux.so.2 (0xb773c000)
libicudata.so.51 => /opt/qt5/Qt5.2.0/5.2.0/gcc/lib/libicudata.so.51 (0xb538e000)
which is expected. This also matches to what libraries are linked in my problematic linker command, but it still fails :(

Anyone has any idea why?

The strangest thing is that it works just fine when compiled from QtCreator! :(

Added after 1 38 minutes:

Okay, never mind. I don't know what was wrong, but when I cleaned, rebuild with debug config, then cleaned and rebuild in release config (as it was initially) it works fine now.