[CMake] Cross-compilation linking against host libc

Alexander Neundorf a.neundorf-work at gmx.net
Mon Mar 30 13:40:01 EDT 2009


On Monday 30 March 2009, Adolfo Rodríguez wrote:
> 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:

Looks ok.
Did you check the executable in the build tree or installed ? This matters 
because this changes the RPATH. If you build without RPATH, you will get what 
ld finds, which is probably libc in /lib.

Alex


More information about the CMake mailing list