[oe] [meta-qt5] [problem] Qt SDK Issue cstdlib:75:15: fatal error: stdlib.h: No such file or directory

Mustafa Özçelikörs mozcelikors at gmail.com
Wed Apr 18 08:45:15 UTC 2018


Hello everyone,

This is my first post to this mailing list. I will be trying my hardest to
explain a problem that has caused me a lot of headache until now.

The Idea:
My idea is to have a Qt SDK along my image which I can source and use to
cross-compile Qt apps easily with CMake (rather than QMake) from host PC
Linux shell.

Branches:
I have tried this approach with all master, all rocko, and all morty
branches and all of them gave the same results.

Platform:
Raspberry Pi ZeroW (ARMv6)

Steps:
In order to generate Qt5 + CMake SDK,
meta-qt5 layer added and the following is added:
TOOLCHAIN_HOST_TASK_append = " nativesdk-cmake nativesdk-cmake-dev "

In order to produce SDK,
bitbake meta-toolchain-qt5

App Cross-Development Workflow:
1) Sourcing SDK
2) cmake & make on the application

CMakeLists.txt for the application is given as follows:

cmake_minimum_required(VERSION 3.0)
> project(rpiDisplay)
> set (CMAKE_C_FLAGS "-fPIC ${CMAKE_C_FLAGS}")
> set (CMAKE_CXX_FLAGS "-std=c++11 -fPIC -Wno-write-strings
> -Wno-deprecated-declarations -Wno-unused-local-typedefs -O2 -pipe -g
> -feliminate-unused-debug-types  -fstack-protector-strong -pie -fpie
> -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -fvisibility-inlines-hidden
> ${CMAKE_CXX_FLAGS}")
>
>





*if(DEFINED ENV{SDKTARGETSYSROOT})    message(STATUS "SDK Detected")
set(SDK_EN 1)else(DEFINED ENV{SDKTARGETSYSROOT})    set(SDK_EN
0)endif(DEFINED ENV{SDKTARGETSYSROOT})*


*# Find includes in the build directories*
*set(CMAKE_INCLUDE_CURRENT_DIR ON)*

*# Turn on automatic invocation of the MOC*
*set(CMAKE_AUTOMOC ON)*

*find_package (Qt5Widgets REQUIRED)*
*find_package (Qt5Core REQUIRED)*

*# Find the QtWidgets library*
*find_package(Qt5Core REQUIRED)*
*find_package(Qt5Widgets REQUIRED)*

*# Generate code from ui files*
*qt5_wrap_ui(UI_HEADERS mainwindow.ui)*

*# Generate rules for building source files from the resources*
*qt5_add_resources(QRCS resources/resources.qrc)*

*# Tell CMake to create the helloworld executable*
*add_executable(rpiDisplay main.cpp mainwindow.cpp ${UI_HEADERS} ${QRCS})*

*# Add the Qt5 Widgets for linking*
*target_link_libraries(rpiDisplay Qt5::Widgets)*



*CMake is successfully able to run, finding cross-compiler, sysroot, and
Qt5 macros.*

*However, when "make" command is run I get the following error*

>
> *[ 50%] Building CXX object CMakeFiles/rpiDisplay.dir/main.cpp.o*
*In file included from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/c++/7.3.0/bits/stl_algo.h:59:0,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/c++/7.3.0/algorithm:62,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/qt5/QtCore/qglobal.h:109,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/qt5/QtGui/qtguiglobal.h:43,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/qt5/QtWidgets/qtwidgetsglobal.h:43,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/qt5/QtWidgets/qmainwindow.h:43,*
*                 from
/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/qt5/QtWidgets/QMainWindow:1,*
*                 from
/home/mozcelikors/qtCreatorWorkspace/rpiDisplay_CMake/mainwindow.h:4,*
*                 from
/home/mozcelikors/qtCreatorWorkspace/rpiDisplay_CMake/main.cpp:1:*
*/opt/embeddev/0.1.0/sysroots/arm1176jzfshf-vfp-embeddev-linux-gnueabi/usr/include/c++/7.3.0/cstdlib:75:15:
fatal error: stdlib.h: No such file or directory*
* #include_next <stdlib.h>*
*               ^~~~~~~~~~*
*compilation terminated.*



*This issue is encountered in the web by several different people. For
example, https://github.com/voidlinux/void-packages/issues/5254
<https://github.com/voidlinux/void-packages/issues/5254> encounters the
same problem when installing qtcreator. The suggested patch is already
included in master and does prevent some of the qt packages from
complaining about this issue. But what I do want to understand is how can
this issue be addressed in a case which uses Qt CMake SDK to build other
applications. It doesn't seem to solve my issue.*


*To reproduce the issue, I've tried the following solutions which did not
help:*

*1) Globally remove -isystem from the QMAKE_CFLAGS_ISYSTEM = -isystem line
> in /usr/lib/qt5/mkspecs/common/gcc-base.conf*
>
*2) Removing the last path /usr/include from the file
/usr/lib/qt5/mkspecs/qconfig.pri line QMAKE_DEFAULT_INCDIRS = ... *


*Any guidance as to how to tackle this problem is greately appreciated.*

*Kind regards,*
*Mustafa Özçelikörs*



More information about the Openembedded-devel mailing list