[CMake] Cross-compilation linking against host libc

Adolfo Rodríguez dofo79 at gmail.com
Mon Mar 30 04:42:28 EDT 2009


Hi,

I have set up a toolchain file [1] to enable cross-compiling a project. In
my current setup, both the host and target environments are
binary-compatible (both are x86 and are using gcc's with compatible ABIs).
When I generate a cross-compiled executable and run ldd, the paths to
libraries such as libc, libc++, and m show up rooted at /lib. I was
expecting something more in the line of ${CMAKE_FIND_ROOT_PATH}/lib.
Conversely, the external dependencies I explicitly added using
find_libraries appear rooted at ${CMAKE_FIND_ROOT_PATH}, which is what I
expected.

Is this behavior correct, or did I misunderstood something along the way?

In case it helps, my toolchain file looks something like this:

# Target system label
set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR i586)


# Specify the cross compiler
set(CMAKE_C_COMPILER   /path/to/i586-unknown-linux-gnu-gcc)
set(CMAKE_CXX_COMPILER  /path/to/ii586-unknown-linux-gnu-g++)

# Target environment location
set(CMAKE_FIND_ROOT_PATH  /my/root/path)


# Search for programs in the build host directories
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)

# Search for libraries and headers in the target directories
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)


Cheers,

-- 
Adolfo Rodríguez Tsouroukdissian

Robotics engineer
PAL ROBOTICS S.L
http://www.pal-robotics.com
Tel. +34.93.414.53.47
Fax.+34.93.209.11.09
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090330/ea866dd3/attachment-0001.htm>


More information about the CMake mailing list