Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compiling OpenCV for kinetic with GCC7 fails with fatal_error at stdlib include_next #22

Open
lusim123 opened this issue Jan 28, 2019 · 0 comments

Comments

@lusim123
Copy link

Hello,

we're currently developing ROS support for our modules. Therefore we need to compile ROS packages with the gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf toolchain.

I get the following error:

[ 63%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.o
In file included from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/ext/string_conversions.h:41:0,
                 from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/bits/basic_string.h:6349,
                 from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/string:52,
                 from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/stdexcept:39,
                 from /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1/array:39,
                 from /home/simnacher/Desktop/tcg4_ros/ros_files_comm_cv/src/opencv3/modules/core/include/opencv2/core/cvdef.h:438,
                 from /home/simnacher/Desktop/tcg4_ros/ros_files_comm_cv/src/opencv3/modules/core/include/opencv2/core.hpp:52,
                 from /home/simnacher/Desktop/tcg4_ros/ros_files_comm_cv/src/opencv3/modules/highgui/include/opencv2/highgui.hpp:46,
                 from /home/simnacher/Desktop/tcg4_ros/ros_files_comm_cv/src/opencv3/modules/highgui/src/precomp.hpp:45,
                 from /home/simnacher/Desktop/tcg4_ros/ros_files_comm_cv/src/opencv3/modules/highgui/src/window.cpp:42:
/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1**/cstdlib:75:15: fatal error: stdlib.h: No such file or directory
 #include_next <stdlib.h>**
               ^~~~~~~~~~
compilation terminated.
modules/highgui/CMakeFiles/opencv_highgui.dir/build.make:83: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.o' failed
make[2]: *** [modules/highgui/CMakeFiles/opencv_highgui.dir/src/window.cpp.o] Error 1
CMakeFiles/Makefile2:3404: recipe for target 'modules/highgui/CMakeFiles/opencv_highgui.dir/all' failed

My command looks like this:

sudo ./src/catkin/bin/catkin_make_isolated -DCMAKE_TOOLCHAIN_FILE=/home/simnacher/Desktop/tcg4_ros/toolchains/rostoolchain.cmake --install --install-space /opt/ros-tcg4 -DCMAKE_BUILD_TYPE=Release -DCATKIN_ENABLE_TESTING=false -DWITH_1394=OFF -DWITH_CUDA=OFF -DBUILD_opencv_gpu=OFF -DBUILD_opencv_videoio=OFF -DENABLE_PRECOMPILED_HEADERS=OFF

My rostoolchain file looks like this:

#File: rostoolchain.cmake
set(CMAKE_SYSTEM_PROCESSOR arm)
set(CMAKE_LIBRARY_PATH /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/lib/)
set(CMAKE_C_COMPILER /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++)
set(CMAKE_FIND_ROOT_PATH /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc)
set(CMAKE_INCLUDE_PATH /opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include/)
set(CMAKE_C_FLAGS -I/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/libc/usr/include)
`#Have to set this one to BOTH, to allow CMake to find rospack
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

I already found out that there was a problem when upgrading from GCC5 to GCC6. The problem was solved by adding -DENABLE_PRECOMPILED_HEADERS=OFF to the command. But this only shifts my error from 25% building to 62% building.
When I remove the '_next' at

/opt/gcc-linaro-7.2.1-2017.11-x86_64_arm-linux-gnueabihf/arm-linux-gnueabihf/include/c++/7.2.1**/cstdlib:75:15

#include_next <stdlib.h>

everything works fine.
But I need a solution that doesn't require a change in the toolchain. So I guess that probably there have to be some modifications made to the package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant