Ask Your Question
0

Problem with #include_next when cross compiling with arm-linux-g++

asked 2013-03-05 12:59:53 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

I am trying to cross-compile OPENCV on ARM-linux based system. For this purpose I created a toolchain cmake file with the following options

SET (CMAKE_SYSTEM_NAME Linux)
SET (CMAKE_SYSTEM_VERSION 1)
SET (CMAKE_SYSTEM_PROCESSOR arm)

SET (CMAKE_C_COMPILER "/usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-gcc")
SET (CMAKE_CXX_COMPILER "/usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-g++")

SET (CMAKE_FIND_ROOT_PATH "/usr/local/arm/4.3.1-eabi-armv6/")
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

SET (LIBRARY_OUTPUT_PATH "/home/xxx/OpenCV-2.4.3/lib")
SET (OPENCV_CONFIG_FILE_INCLUDE_DIR "/home/xxx/OpenCV-2.4.3")
SET (OPENCV_WARNINGS_ARE_ERRORS OFF)

After running the cmake command and make command I am getting the following error:

In file included from /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/bits/postypes.h:47,
             from /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/iosfwd:47,
             from /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/ios:44,
             from /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/ostream:45,
             from /usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/iostream:45,
             from /home/zwang/OpenCV-2.4.3/3rdparty/openexr/Half/half.h:88,
             from /home/zwang/OpenCV-2.4.3/3rdparty/openexr/Half/half.cpp:48:
/usr/local/arm/4.3.1-eabi-armv6/usr/bin-ccache/../lib/gcc/arm-samsung-linux-gnueabi/4.3.1/../../../../arm-samsung-linux-gnueabi/include/c++/4.3.1/cwchar:52:24: error: wchar.h: No such file or directory

Summarizing : the compiler is not able to find wchar.h, stdio.h, wctype.h, ctype.h. These headers are present in two locations 1) /usr/local/arm/4.3.1-eabi-armv6/usr/include and 2) /usr/local/arm/4.3.1-eabi-armv6/usr/arm-samsung-linux-gnueabi/include/c++/4.3.1/tr1.

I went deep in to the code and found cwchar includes wchar.h using directive #include_next<wchar.h>. I found all the errors the compiler produces is due to this preprocessor directive. Do I need to make any changes to cmake file?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-03-06 00:10:18 -0600

this post is marked as community wiki

This post is a wiki. Anyone with karma >50 is welcome to improve it.

  1. First, try to turn off ccache. It helps you to check include directories. Second, try to run make verbosely and check include path (-I gcc command line key):

    make -j4 VERBOSE=1

  2. It looks like your CMAKE_FIND_ROOT_PATH is invalid or you need to add additional directories. Verbose make helps you to check includes.

  3. Since version 2.4.4b OpenCV support cross compilation for ARM based Linux. There is ready toolchain for in in source code in platform/linux and tutorial. It is not applicable in your case directly, you need to make some modifications.

edit flag offensive delete link more

Comments

Thanks a lot Alexander. The command line is

[0mcd /home/xxx/OpenCV-2.4.3/build_4/3rdparty/libjpeg && /usr/local/arm/4.3.1-eabi-armv6/usr/bin/arm-linux-gcc -DHAVE_CVCONFIG_H -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -fdiagnostics-show-option -pthread -fomit-frame-pointer -ffunction-sections -fPIC -Wno-cast-align -Wno-shadow -Wno-unused -O3 -DNDEBUG -DNDEBUG -I/home/xxx/OpenCV-2.4.3/3rdparty/libjpeg -I/home/xxx/OpenCV-2.4.3/build_4 -o CMakeFiles/libjpeg.dir/jerror.c.o -c /home/xxx/OpenCV-2.4.3/3rdparty/libjpeg/jerror.c

Its getting compiled up to 10% and after that I am getting error. I guess the path is not included.

rgadde gravatar imagergadde ( 2013-03-06 10:31:08 -0600 )edit

-I/home/zwang/OpenCV-2.4.3/3rdparty/openexr/IlmImf -I/home/zwang/OpenCV-2.4.3/3rdparty/openexr/Imath -I/home/zwang/OpenCV-2.4.3/3rdparty/openexr/IlmThread -I/home/zwang/OpenCV-2.4.3/3rdparty/openexr/Iex -I/home/zwang/OpenCV-2.4.3/3rdparty/openexr/Half -I/home/zwang/OpenCV-2.4.3/build_4/3rdparty/openexr -I/home/zwang/OpenCV-2.4.3/build_4 -isystem /usr/local/arm/4.3.1-eabi-armv6/usr/include -o CMakeFiles/IlmImf.dir/Half/half.cpp.o -c /home/zwang/OpenCV-2.4.3/3rdparty/openexr/Half/half.cpp

rgadde gravatar imagergadde ( 2013-03-06 11:16:07 -0600 )edit

The first one is for gcc and second one for g++ . I think the path is not included properly. Can you please help me in including the path!

rgadde gravatar imagergadde ( 2013-03-06 11:17:46 -0600 )edit

Question Tools

Stats

Asked: 2013-03-05 12:59:53 -0600

Seen: 1,737 times

Last updated: Mar 06 '13