Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

To what command in the Makefile does "Sysroot" from QtCreator transfer?

I'm cross compiling using Qmake and QtCreator. In the settings for the Kits (toolchain and qmake details are set there) there is a field called Sysroot:. (Example here)

Since QtCreator and Qmake are, at the end, responsible for generating a Makefile, my question is, to what does that option translate to in the Makefile and how does it get passed to the toolchain?


Motivation for the question

I have the Sysroot: pointing to ~/path-to-sysroot. ~/path-to-sysroot contains the regular sysroot structure cross compiled for an embedded target.

~/path-to-sysroot
   ├── bin
   ├── include
   ├── lib
   ├── sbin
   ├── share
   └── usr

When I try to cross compile some code which depends on the libraries in ~/path-to-sysroot/usr/lib, it fails with a message that the libs are missing, but the exist there. I have parsed the generated makefile and found no traces of ~/path-to-sysroot/usr/lib.

like image 992
TheMeaningfulEngineer Avatar asked Apr 08 '15 12:04

TheMeaningfulEngineer


1 Answers

from :http://doc.qt.io/qt-5/qt-conf.html

The qt.conf file can be used to override the hard-coded paths that are compiled into the Qt library. These paths are accessible using the QLibraryInfo class. Without qt.conf, the functions in QLibraryInfo return these hard-coded paths; otherwise they return the paths as specified in qt.conf.

Without qt.conf, the Qt libraries will use the hard-coded paths to look for plugins, translations, and so on. These paths may not exist on the target system, or they may not be accessible. Because of this, you may need qt.conf to make the Qt libraries look elsewhere.

qmake -query
QT_SYSROOT:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux
QT_INSTALL_PREFIX:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr
QT_INSTALL_PREFIX/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr
QT_INSTALL_ARCHDATA:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5
QT_INSTALL_ARCHDATA/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5
QT_INSTALL_DATA:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5
QT_INSTALL_DATA/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5
QT_INSTALL_DOCS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/doc/qt5
QT_INSTALL_DOCS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/doc/qt5
QT_INSTALL_HEADERS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/include/qt5
QT_INSTALL_HEADERS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/include/qt5
QT_INSTALL_LIBS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib
QT_INSTALL_LIBS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib
QT_INSTALL_LIBEXECS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/libexec
QT_INSTALL_LIBEXECS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/libexec
QT_INSTALL_BINS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/bin/qt5
QT_INSTALL_BINS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/bin/qt5
QT_INSTALL_TESTS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5/tests
QT_INSTALL_TESTS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5/tests
QT_INSTALL_PLUGINS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/plugins
QT_INSTALL_PLUGINS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/plugins
QT_INSTALL_IMPORTS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/imports
QT_INSTALL_IMPORTS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/imports
QT_INSTALL_QML:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/qml
QT_INSTALL_QML/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5/qml
QT_INSTALL_TRANSLATIONS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5/translations
QT_INSTALL_TRANSLATIONS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/share/qt5/translations
QT_INSTALL_CONFIGURATION:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/etc/qt5
QT_INSTALL_CONFIGURATION/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/etc/qt5
QT_INSTALL_EXAMPLES:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/examples
QT_INSTALL_EXAMPLES/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/examples
QT_INSTALL_DEMOS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/examples
QT_INSTALL_DEMOS/raw:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/examples
QT_HOST_PREFIX:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr
QT_HOST_DATA:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib/qt5
QT_HOST_BINS:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/bin/qt5
QT_HOST_LIBS:/opt/mel/next+snapshot/sysroots/i686-melsdk-linux/usr/lib
QT_EXTERNAL_HOST_BINS:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/usr/bin/qt5
QMAKE_SPEC:/home/mentor/work/git/mel_repos/mel_cedar/build/tmp/sysroots/x86_64-linux/usr/lib/qt5/mkspecs/linux-oe-g++
QMAKE_XSPEC:linux-oe-g++
QMAKE_VERSION:3.0
QT_VERSION:5.4.1

qmake doesnot uses a sysroot argument it has all the paths in it. You can customize qmake by overriding those paths in qt.conf but still it has no path which shows sysroot. And I don't think it has any option to specify sysroot. You have to manually set the sysroot in Compiler flags in qtcreator

like image 176
theadnangondal Avatar answered Oct 14 '22 21:10

theadnangondal