Qt World Summit: Submit your Presentation

qmake /bin/sh: OE_QMAKE_CXX: command not found?

  • QMake version 3.0
    Using Qt version 5.7.0 in /home/kevin/sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib

    I have a Qt project for which I have to build a toolchain. The toolchain is built using yocto's build system via "bitbake someproject_sdk". This generates the "environment-setup-cortexa9hf-neon-poky-linux-gnueabi" script which is used to setup my environment for application development. Mainly it sets up the env so that the correct compiler, assembler, linker, and debugger used for cross compilation are visible within the env.

    However, even after sourcing this environment setup script, qmake is having trouble with the environment variable OE_QMAKE_CXX and OE_QMAKE_CXXFLAGS. Sample output:

    /bin/sh: OE_QMAKE_CXX: command not found
    /bin/sh: OE_QMAKE_CXXFLAGS: command not found

    I see the above message in the "General Messages" tab in QtCreator (which is launched from the terminal session in which the env setup script was sourced). My first thought was to check to see if OE_QMAKE_CXX and OE_QMAKE_CXXFLAGS were defined by the env setup script, and sure enough they are:

    $ printenv | grep OE_QMAKE_CXX
    OE_QMAKE_CXX=arm-poky-linux-gnueabi-g++  -march=armv7-a -marm -mfpu=neon  -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/home/kevin/sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi
    OE_QMAKE_CXXFLAGS= -O2 -pipe -g -feliminate-unused-debug-types -fdebug-prefix-map=/home/kevin/vp_project/build/tmp/work/x86_64-nativesdk-oesdk-linux/meta-environment-vpro-9200/1.0-r8=/usr/src/debug/meta-environment-vpro-9200/1.0-r8 -fdebug-prefix-map=/home/kevin/vp_project/build/tmp/sysroots/x86_64-linux= -fdebug-prefix-map=/home/kevin/vp_project/build/tmp/sysroots/x86_64-nativesdk-oesdk-linux=

    I can also produce this outside of QtCreator by invoking qmake from a terminal session which has already sourced the env setup script. Here I attempted to build a tiny simple "hello_world" project:

    $ qmake -project
    sh: OE_QMAKE_CXX: command not found
    sh: OE_QMAKE_CXXFLAGS: command not found

    In summary, I can see the OE_QMAKE_CXX and OE_QMAKE_CXXFLAGS are both defined within my terminal session, but qmake seems to think otherwise. Can anyone think of why that would be?

  • Lifetime Qt Champion

    @kptt Can you show your .pro file? You're probably using these variables wrongly.

  • @jsulm This is my top level .pro file:

    1 TEMPLATE = subdirs
    2 SUBDIRS = \
    3     lib \
    4     examples
    6 !macx: { SUBDIRS += gpsd_plugin }
    8 #Some host installations have target dependencies installed in Qt root, not system root:
    9 !linux-oe-g++ {
    10     INCLUDEPATH += $$[QT_HOST_PREFIX]/usr/include
    11     LIBS += -L$$[QT_HOST_PREFIX]/usr/lib
    12 }
    14 examples.depends = lib

    I have three other small .pro files that build different parts of the project.

    I thought OE_QMAKE_CXX is supposed to point to the c++ cross compiler and OE_QMAKE_CXXFLAGS is supposed to contain all of the desired c++ compiler flags? Is it not? As far as I can tell, that's exactly what I'm doing.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you call arm-poky-linux-gnueabi-g++directly in your console ? If not then you should add the path to the folder containing it to the PATH environment variable.

  • Hi @SGaist,

    Yes, I can invoke arm-poky-linx-gnueabi-g++ directly in my console (w/o a full path):

    kevin at kp-workstation in ~
    $ cd ~/sdk
    kevin at kp-workstation in ~/sdk
    $ ls
    kevin at kp-workstation in ~/sdk
    $ . environment-setup-cortexa9hf-neon-poky-linux-gnueabi
    kevin at kp-workstation in ~/sdk
    $ cd ~/hello_world/
    kevin at kp-workstation in ~/hello_world
    $ ls
    kevin at kp-workstation in ~/hello_world
    $ qmake -project
    sh: OE_QMAKE_CXX: command not found
    sh: OE_QMAKE_CXXFLAGS: command not found
    kevin at kp-workstation in ~/hello_world
    $ arm-poky-linux-gnueabi-g++
    arm-poky-linux-gnueabi-g++: fatal error: no input files
    compilation terminated.

  • Lifetime Qt Champion

    Which mkspec are you using ?

  • @SGaist linux-oe-g++

  • @SGaist Looking at the build steps for my target in qtcreator, I found that the -spec option was omitted in the qmake step. I added it under additional arguments, but that didn't change anything.

  • Lifetime Qt Champion

    You should rather have a dedicated Kit where you configure that kind of stuff.

  • @SGaist Well, looking at the Details under the Qt Versions tab for my kit I do indeed see that mkspec, QMAKE_SPEC, QMAKE_XSPEC are all defined as "linux-oe-g++". That means the kit is configured for linux-oe-g++, correct?

    Screenshot of Qt Versions Tab at 2016-10-05 16:32:20.png

  • Lifetime Qt Champion

    Looks good.

    Did you check the makespec itself to see if there some hardcoded path ?

Log in to reply