qmake fails to find libraries



  • I have cross-compiled qt 5.9.4 on a 64-bit Ubuntu host for a 32-bit ArchLinux target. I can use the cross-compilation toolchain to build a Qt application using CMAKE on the 64-bit Ubuntu host and run on the 32-bit target.

    I can build and run the same application also natively on 32-bit target using CMAKE.

    However, when I try to build the application natively with QMAKE, it gives the following error:

    Project ERROR: Unknown module(s) in QT: core gui widgets
    

    The QMAKE on the target device was generated by building qtbase natively on the 32-bit target, and copying the executables under /usr/lib/qt/bin. The qt.conf file is under the same directory and contains the following. How can I make sure QMAKE finds the qt libraries which are installed in /usr/lib? I have already tried adding Libraries=lib to the qt.conf file.

    [EffectivePaths]
    Prefix=..
    [DevicePaths]
    Prefix=/usr
    Documentation=share/doc/qt
    Headers=include/qt
    LibraryExecutables=lib/qt/libexec
    Plugins=lib/qt/plugins
    Imports=lib/qt/imports
    Qml2Imports=lib/qt/qml
    ArchData=lib/qt
    Data=share/qt
    Translations=share/qt/translations
    Examples=share/doc/qt/examples
    [Paths]
    Prefix=/usr
    Documentation=share/doc/qt
    Headers=include/qt
    LibraryExecutables=lib/qt/libexec
    Plugins=lib/qt/plugins
    Imports=lib/qt/imports
    Qml2Imports=lib/qt/qml
    ArchData=lib/qt
    Data=share/qt
    Translations=share/qt/translations
    Examples=share/doc/qt/examples
    HostPrefix=/usr
    HostData=lib/qt
    Sysroot=
    SysrootifyPrefix=false
    TargetSpec=linux-g++
    HostSpec=linux-g++
    [EffectiveSourcePaths]
    Prefix=/home/root/qt/sources
    

  • Moderators

    @fatih.erol Did you build QtCore, QtGui and QtWidgets modules as well (not only qmake)?



  • yes, but the libraries are cross-compiled. cmake finds them.
    qmake/qlalr/moc/rcc/uic are built natively on the target. but qmake fails to find them.


  • Moderators

    @fatih.erol If you use native compiled qmake you need Qt libs as well on the same machine.


  • Moderators

    @jsulm said in qmake fails to find libraries:

    @fatih.erol If you use native compiled qmake you need Qt libs as well on the same machine.

    He has the libs on the same machine :-) But not compiled natively, only cross-compiled. They should be bit-for-bit the same, though. I'd rather suspect that qmake does not pick up the paths from qt.conf and tries to load libs from compilation path instead.



  • It turns out that 'modules' directory was missing from '/usr/lib/qt/mkspecs' directory. Somehow, it was not installed properly (make install_mkspecs) on the target. I re-built qtbase on the target from scratch, and it seems to work now.

    Thank you for your answers.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.