[CMake] Problem with cmake cross-compiling - make complains of missing header.

Thomas Walwyn Thomas.Walwyn at uec.co.za
Wed Nov 9 11:51:42 EST 2011


Hi All,

I'm brand-new to cmake, and have run into a problem cross compiling for an Intel embedded platform:

Make complains about missing file 'curl/curl.h' when compiling against an Intel SDK for linux. 'curl/curl.h' resides in the cross-compile toolchain under [toolchain-folder]/include/curl/curl.h. The toolchain file 'toolchain.cmake' resides at the root of the SDK (toolchain.cmake attached to end).

The build is configured with the usual 'cmake -DCMAKE_TOOLCHAIN_FILE=[path-to-toolchain] ..' from a 'build' folder in the src directory of my application tree. cmake finds the compiler toolchain (gcc, gxx, ar, etc.) and completes the configuration all good (cmake output attached to end). The problem comes in when make is called. The strange thing is, the variable 'CURL_HEADER' contains the path of curl/curl.h if the following is added to the CMakeLists.txt:

FIND_FILE(
        CURL_HEADER
        curl/curl.h
        ONLY_CMAKE_FIND_ROOT_PATH
                  )

This means that cmake can 'see' the file that make is complaining about. My question is why, if cmake can see the file, does make complain that it cannot find the file? Something must be missing with the configuration of the cross-compilation.

For reference, the program compiles perfectly on the host system, without the -DCMAKE_TOOLCHAIN_FILE flag. The host system is Fedora 13 with curl and its headers installed.

I've also attached the important bits of the make output to the end for reference.

Any help is greatly appreciated.

Many thanks and kind regards,

Thomas Walwyn

#------------------------toolchain.cmake----------------------------------#

SET(CMAKE_SYSTEM_NAME Linux)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER [path-to-compiler]/[platform]-linux-gcc)
SET(CMAKE_FIND_ROOT_PATH [path-to-toolchain-folder])
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

#------------------------cmake output----------------------------------#

-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: [path-to-compiler]/[platform]-linux-gcc
-- Check for working C compiler: [path-to-compiler]/[platform]-linux-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: [path-to-compiler]/[platform]-linux-c++
-- Check for working CXX compiler: [path-to-compiler]/[platform]-linux-c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: [path-to-application-folder]/build

#-----------------------part of make which gives error------------------#

cd [path-to-application-source] && [path-to-compiler]/[platform]-linux-gcc  -DIPFrontend_EXPORTS -fPIC -I[path-to-application-source]/includes   -o [path-to-application-source]/[source-file].c.o   -c [path-to-application-source]/[source-file]/[path-to-application-source]/[source-file].c
[path-to-application-source]/[source-file].c:50:23: error: curl/curl.h: No such file or directory
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111109/954bdae6/attachment.htm>


More information about the CMake mailing list