Missing stdlib.h with cmake project and yocto sdk

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Missing stdlib.h with cmake project and yocto sdk

5,712 Views
riccardo_cavedo
Contributor II

Good morning,

I have to compile a cmake project and I've available an SDK generated from yocto project.

In the local.conf is present also:

TOOLCHAIN_HOST_TASK = "nativesdk-cmake"

the sdk is installed in the home directory and I launch it in the project directory:

$ . /home/riccardo/va_sdk/environment-setup-cortexa9hf-neon-poky-linux-gnueabi

CMakeList.txt is the following:

cmake_minimum_required (VERSION 2.8)
project (VA)

set (CMAKE_CXX_FLAGS "-std=c++0x -pthread -O3 -Wall -g ${CMAKE_CXX_FLAGS}")

add_subdirectory (...)‍‍‍‍‍‍

Creating the cmake files the output is the following:

$ cmake CMakeLists.txt 
-- The C compiler identification is GNU 6.2.0
-- The CXX compiler identification is GNU 6.2.0
-- Check for working C compiler: /home/riccardo/va_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc
-- Check for working C compiler: /home/riccardo/va_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /home/riccardo/va_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++
-- Check for working CXX compiler: /home/riccardo/va_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr (found version "3.2.0") 
-- Found PkgConfig: /home/riccardo/va_sdk/sysroots/x86_64-pokysdk-linux/usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'libxml++-2.6'
--   Found libxml++-2.6, version 2.38.1
-- Found LibXML++: /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib/libxml++-2.6.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/riccardo/git/va

But the make command fails with:

In file included from /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/bits/stl_algo.h:59:0,
                 from /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/algorithm:62,
                 from /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/opencv2/core/base.hpp:55,
                 from /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/opencv2/core.hpp:54,
                 from /home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/opencv2/opencv.hpp:52,
/home/riccardo/va_sdk/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include/c++/6.2.0/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>
                         ^
compilation terminated.
‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

I tried to add in the CMakefile.txt:

include_directories(SYSTEM /home/riccardo/va_sdk/sysroot/cortexa9hf-neon-poky-linux-gnueabi/usr/include/)

In order to force the cmake to search the headers in the right folder, but without success.

Could you kindly help me? Please.

It's not clear to me where to search the issue whether into the yocto project settings or cmake project.

Thanks in advance for the help and don't hesitate to ask details.

Riccardo

2 Replies

4,240 Views
riccardo_cavedo
Contributor II

Thank Bio_TICFSL‌ to suggestion.

I found the solution.

It's necessary to add the following option in CMakeLists.txt:

set (CMAKE_NO_SYSTEM_FROM_IMPORTED ON)

And from my CMakeList.txt I also removed:

include_directories (...)

It's a bug reported here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129

4,240 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hi Riccardo,

Add and search path "-I/opt/fsl-imx-fb/4.9.88-2.0.0/sysroots/aarch64-poky-linux/usr/include/" and it works.

Regards

0 Kudos