Linux – Qt error: c: command not found / qmake could not locate g++ compiler

bitbakelinuxqtqt-creatorqt5

I have 2 versions of SDK for Qt Creator: Compiled from Open Source and Compiled from bitbake.

The Open Source SDK is working fine, but the bitbake one is having trouble recognizing the compiler. I have added the g++ compiler to build & Run and source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabias well.

make: c: Command not found make: [moc_utils.o] Error 127 (ignored)

make:
Wl,-rpath-link,/opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib:

Command not found make: [quicknanobrowser] Error 127 (ignored)

Here is the error one Compiler Log:

14:27:55: Running steps for project quicknanobrowser…

14:27:55:
Starting:
"/opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake"
/home/hbulab/Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser/quicknanobrowser.pro
-r -spec linux-oe-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug

14:27:55: The process
"/opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake"
exited normally.

14:27:55: Starting: "/usr/bin/make"

c -pipe -g
-DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I.

and here is the one without error, we could see that the make could not find the g++ compiler. How do I fix it?

14:29:08: Running steps for project quicknanobrowser… 14:29:08:
Starting: "/opt/hio-imx6dl-board/opt/Qt5daisy/bin/qmake"
/home/hbulab/Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser/quicknanobrowser.pro
-r -spec devices/linux-imx6-g++ CONFIG+=debug CONFIG+=declarative_debug CONFIG+=qml_debug

14:29:09: The process
"/opt/hio-imx6dl-board/opt/Qt5daisy/bin/qmake" exited normally.

14:29:09: Starting: "/usr/bin/make"

/opt/poky/1.6.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
-c -pipe -march=armv7-a -mfpu=neon -DLINUX=1 -DEGL_API_FB=1 -mfloat-abi=hard -g -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I.

MakeFile Information:

MAKEFILE      = Makefile

####### Compiler, tools and options

CC            = $(OE_QMAKE_CC)
CXX           = $(OE_QMAKE_CXX)
DEFINES       = -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_WEBENGINE_LIB -DQT_QUICK_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB
CFLAGS        = -pipe $(OE_QMAKE_CFLAGS) -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS      = -pipe $(OE_QMAKE_CXXFLAGS) -g -DLINUX=1 -DEGL_API_FB=1 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH       = -I../../../Qt5.5.1/Examples/Qt-5.5/webengine/quicknanobrowser -I. -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5 -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWebEngine -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtQuick -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtWidgets -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtGui -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtQml -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtNetwork -isystem /opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/include/qt5/QtCore -I. -I/opt/poky/charles/sysroots/cortexa9hf-vfp-neon-poky-linux-gnueabi/usr/lib/qt5/mkspecs/linux-oe-g++
QMAKE         = /opt/poky/charles/sysroots/x86_64-pokysdk-linux/usr/bin/qt5/qmake

Best Answer

As ${OE_QMAKE_CXX} is empty, that indicates to me that you haven't source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabiasenvironment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi.

This should work to compile by hand:

 . /opt/poky/charles/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
 echo $OE_QMAKE_CXX
 qmake
 make

(Assuming you don't need to pass any extra arguments to qmake).

Then do the following:

 . /opt/poky/charles/environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi
 echo $OE_QMAKE_CXX
 qtcreator

Note that you should start qtcreator from the same shell that you source environment-setup-cortexa9hf-vfp-neon-poky-linux-gnueabi in.

This should get you going. Otherwise I'd suggest starting by getting a small, simple Qt appliction building correctly.

For more in configuring QtCreator, you could for instance have a look at how to setup QtCreator for cross-compilation.

Update

As it seems that Qt5 isn't included in the SDK at all, we first have to generate a suitable SDK. My preferred way:

 bitbake your-image -c populate_sdk

This works, as long as your image recipe includes

 inherit populate_sdk_qt5

That would give you an SDK, whose sysroot would match your image.

The "older" way, is to use a special toolchain recipe. For Qt5 that would be meta-toolchain-qt5, or some recipe that includes/requires that one. In this case, you would run:

  bitbake meta-toolchain-qt5

Though, the recommended way is to use the image specific SDK.

Related Topic