Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Missing flags when cross-compiling my QT app
Forum Updated to NodeBB v4.3 + New Features

Missing flags when cross-compiling my QT app

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 2 Posters 2.9k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    morandg
    wrote on last edited by
    #1

    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 to dbus_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 = sublib

    modifications 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/lib

    QMAKE_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-strip

    load(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?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Can you show your application pro file ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • M Offline
        M Offline
        morandg
        wrote on last edited by
        #3

        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 -= gui

        To handle gpio changes using local socket on pc

        QT += network

        TARGET = io-svc
        CONFIG += console
        CONFIG -= app_bundle

        TEMPLATE = 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/ -lifc

        INCLUDEPATH += $$PWD/../ifc-lib
        DEPENDPATH += $$PWD/../ifc-lib@

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What is linux-ptx-g++ ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            morandg
            wrote on last edited by
            #5

            linux-ptx-g++ is my mkspec file coming from the ptxdist toolchain.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Does it do any unusual variable assignment ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • M Offline
                M Offline
                morandg
                wrote on last edited by
                #7

                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!

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  What option did you use when cross-compiling Qt ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    morandg
                    wrote on last edited by
                    #9

                    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?

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      morandg
                      wrote on last edited by
                      #10

                      mmm ....I've just noticed that the -sysroot flag is not set, can it be this? There only one way to know it :-p!

                      1 Reply Last reply
                      0

                      • Login

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved