Missing flags when cross-compiling my QT app
-
Hello there,
I'm cross-compiling QT5.4 using ptxdist. It worked well until I tried to compile my own QT application. I have linker errors:
@libQt5DBus.so: undefined reference todbus_message_get_interface' ibQt5Core.so: undefined reference to
g_main_context_push_thread_default'
...@However, if I add the LDFLAGS manually (-ldbus-1 -lglib-2.0 -lz) it works fine but that's quiet annoying, I was expecting that QT could provide those flags itself!
Here is my mkspecs:
@#qmake configuration for linux-ptx-g++
include(../common/gcc-base-unix.conf)
include(../common/g++-unix.conf)
include(../common/linux.conf)MAKEFILE_GENERATOR = UNIX
TEMPLATE = app
CONFIG += qt warn_on release incremental link_prl
QT += core gui network
QMAKE_INCREMENTAL_STYLE = sublibmodifications to g++.conf
QMAKE_CC = arm-1136jfs-linux-gnueabihf-gcc
QMAKE_CFLAGS = -pipe
QMAKE_CXX = arm-1136jfs-linux-gnueabihf-g++
QMAKE_CXXFLAGS = -pipe
QMAKE_INCDIR = /home/admin/bsp/platform-ifc/sysroot-target/include /home/admin/bsp/platform-ifc/sysroot-target/usr/include
QMAKE_LIBDIR = /home/admin/bsp/platform-ifc/sysroot-target/lib /home/admin/bsp/platform-ifc/sysroot-target/usr/libQMAKE_LINK = arm-1136jfs-linux-gnueabihf-g++
QMAKE_LINK_SHLIB = arm-1136jfs-linux-gnueabihf-g++
QMAKE_LFLAGS =QMAKE_INCDIR_X11 =
QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL =
QMAKE_LIBDIR_OPENGL =
QMAKE_LIBS_OPENGL_ES1CL =
QMAKE_LIBS_OPENGL_ES1 =
QMAKE_LIBS_OPENGL_ES2 =modifications to linux.conf
QMAKE_AR = arm-1136jfs-linux-gnueabihf-ar cqs
QMAKE_OBJCOPY = arm-1136jfs-linux-gnueabihf-objcopy
QMAKE_STRIP = arm-1136jfs-linux-gnueabihf-stripload(qt_config)@
Are those missing flags supposed to be defined in the mkspecs I provide? How can I add or remove flags in the mkspecs depending on QT5 configuration (-dbus vs -dbus-link vs -no-dbus)? Should I include another mkspecs from QT? What am I missing? -
Hi and welcome to devnet,
Can you show your application pro file ?
-
Thanks! I wish I could contribute more often but most of the time the answer to my question is already somewhere in the Forum :)
Here is the most relevant part of my .pro file:
@QT += core dbus
QT -= guiTo handle gpio changes using local socket on pc
QT += network
TARGET = io-svc
CONFIG += console
CONFIG -= app_bundleTEMPLATE = app
SOURCES += ...
HEADERS += ...
linux-g++ {
message(Building on HOST machine)
DEFINES += RUN_ON_PC
DEFINES += NO_SYSTEMD_JOURNAL
}linux-ptx-g++ {
message(Building on IFC)
DEFINES += RUN_ON_IFC
LIBS += -lsystemd-journal -llzma# FIXME: We shouldn't need to specify those flags, those are depedencies from QTDbus and QTCore LIBS += -ldbus-1 -lglib-2.0 -lz
}
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../ifc-lib/release/ -lifc
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../ifc-lib/debug/ -lifc
else:symbian: LIBS += -lifc
else:unix: LIBS += -L$$OUT_PWD/../ifc-lib/ -lifcINCLUDEPATH += $$PWD/../ifc-lib
DEPENDPATH += $$PWD/../ifc-lib@ -
What is linux-ptx-g++ ?
-
linux-ptx-g++ is my mkspec file coming from the ptxdist toolchain.
-
Does it do any unusual variable assignment ?
-
Its content is shown on the first post. I don't think it does any "unusual" variable assignement but maybe there is something missing ... ??
Thanks for pointing this out!
-
What option did you use when cross-compiling Qt ?
-
It's difficult to say, QT is built by ptxdist and there are potentially many. Here is the flags from the ptxdist build instruction:
@ $(if $(filter 1,$(PTXDIST_VERBOSE)),-v)
$(if $(filter 0,$(PTXDIST_VERBOSE)),-silent)
-prefix /usr
-headerdir /usr/include/qt5
-archdatadir /usr/lib/qt5
-datadir /usr/share/qt5
-examplesdir /usr/lib/qt5/examples
-hostbindir /usr/bin/qt5
-release
-opensource
-confirm-license
-xplatform linux-ptx-g++
--$(call ptx/endis, PTXCONF_QT5_CXX11)-c++11
--enable-shared
--$(call ptx/endis, PTXCONF_GLOBAL_LARGE_FILE)-largefile
--$(call ptx/endis, PTXCONF_QT5_ACCESSIBILITY)-accessibility
--disable-sql-db2
--disable-sql-ibase
--disable-sql-mysql
--disable-sql-oci
--disable-sql-odbc
--disable-sql-psql
--disable-sql-sqlite2
--disable-sql-tds
--$(call ptx/endis, PTXCONF_QT5_MODULE_QTBASE_SQL_SQLITE)-sql-sqlite
-system-sqlite
--$(call ptx/endis, PTXCONF_QT5_MODULE_QTDECLARATIVE_DEBUG)-qml-debug
-pkg-config
-force-pkg-config
-system-zlib
--disable-journald
$(call ptx/ifdef, PTXCONF_QT5_GIF,,-no-gif)
$(call ptx/qt5-system, QT5_LIBPNG)-libpng
$(call ptx/qt5-system, QT5_LIBJPEG)-libjpeg
$(call ptx/qt5-system, QT5_GUI)-freetype
-qt-harfbuzz
--$(call ptx/endis, PTXCONF_QT5_OPENSSL)-openssl
-qt-pcre
-system-xcb
-make libs
-make tools
$(call ptx/ifdef, PTXCONF_QT5_PREPARE_EXAMPLES,-make examples)
-skip qtactiveqt
-skip qtandroidextras
$(call ptx/qt5-module, QTCONNECTIVITY, qtconnectivity)
$(call ptx/qt5-module, QTDECLARATIVE, qtdeclarative)
$(call ptx/qt5-module, QTENGINIO, qtenginio)
-skip qtdoc
$(call ptx/qt5-module, QTGRAPHICALEFFECTS, qtgraphicaleffects)
$(call ptx/qt5-module, QTIMAGEFORMATS, qtimageformats)
$(call ptx/qt5-module, QTLOCATION, qtlocation)
-skip qtmacextras
$(call ptx/qt5-module, QTMULTIMEDIA, qtmultimedia)
$(call ptx/qt5-module, QTQUICK1, qtquick1)
$(call ptx/qt5-module, QTQUICKCONTROLS, qtquickcontrols)
$(call ptx/qt5-module, QTSCRIPT, qtscript)
$(call ptx/qt5-module, QTSENSORS, qtsensors)
$(call ptx/qt5-module, QTSERIALPORT, qtserialport)
$(call ptx/qt5-module, QTSVG, qtsvg)
$(call ptx/qt5-module, QTTOOLS, qttools)
$(call ptx/qt5-module, QTTRANSLATIONS, qttranslations)
$(call ptx/qt5-module, QTWAYLAND, qtwayland)
$(call ptx/qt5-module, QTWEBCHANNEL, qtwebchannel)
$(call ptx/qt5-module, QTWEBENGINE, qtwebengine)
$(call ptx/qt5-module, QTWEBKIT, qtwebkit)
$(call ptx/qt5-module, QTWEBKIT_EXAMPLES, qtwebkit-examples)
$(call ptx/qt5-module, QTWEBSOCKETS, qtwebsockets)
-skip qtwinextras
$(call ptx/qt5-module, QTX11EXTRAS, qtx11extras)
$(call ptx/qt5-module, QTXMLPATTERNS, qtxmlpatterns)
--$(call ptx/endis, PTXCONF_QT5_PREPARE_EXAMPLES)-compile-examples
--$(call ptx/endis, PTXCONF_QT5_GUI)-gui
--$(call ptx/endis, PTXCONF_QT5_WIDGETS)-widgets
--disable-rpath
--disable-optimized-qmake
--disable-nis
--disable-cups
--disable-iconv
--$(call ptx/endis, PTXCONF_QT5_ICU)-icu
--$(call ptx/endis, PTXCONF_QT5_GUI)-fontconfig
--disable-strip
--disable-pch
--$(call ptx/endis, PTXCONF_QT5_DBUS)-dbus$(call ptx/ifdef, PTXCONF_QT5_DBUS,-linked,)
--disable-separate-debug-info
--$(call ptx/endis, PTXCONF_QT5_PLATFORM_XCB)-xcb
--$(call ptx/endis, PTXCONF_QT5_PLATFORM_EGLFS)-eglfs
--$(call ptx/endis, PTXCONF_QT5_PLATFORM_DIRECTFB)-directfb
--$(call ptx/endis, PTXCONF_QT5_PLATFORM_LINUXFB)-linuxfb
--$(call ptx/endis, PTXCONF_QT5_PLATFORM_KMS)-kms
$(call ptx/ifdef, PTXCONF_QT5_GUI,-qpa $(PTXCONF_QT5_PLATFORM_DEFAULT))
--opengl=$(call ptx/ifdef, PTXCONF_QT5_OPENGL,$(PTXCONF_QT5_OPENGL_API),no)
--disable-system-proxies
--$(call ptx/endis, PTXCONF_QT5_GLIB)-glib
--no-android-style-assets@
Is there any flag I should be more carfull? -
mmm ....I've just noticed that the -sysroot flag is not set, can it be this? There only one way to know it :-p!