[CMake] Cross-compilation linking against host libc

Adolfo Rodríguez dofo79 at gmail.com
Wed Apr 1 03:16:42 EDT 2009


On Tue, Mar 31, 2009 at 10:11 PM, Alexander Neundorf <
a.neundorf-work at gmx.net> wrote:

> On Tuesday 31 March 2009, Adolfo Rodríguez wrote:
> > 2009/3/30 Alexander Neundorf <a.neundorf-work at gmx.net>
> >
> ...
> > [1] In case you think it helps, these are my rpath settings:
> >
> > # Use, i.e. don't skip the full RPATH for the build tree
> > set(CMAKE_SKIP_BUILD_RPATH  FALSE)
> >
> > # When building, don't use the install RPATH already
> > # (but later on when installing)
> > set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
>
>
> > # The RPATH to be used when installing
> > set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
> >
> > # Add the automatically determined parts of the RPATH
> > # which point to directories outside the build tree to the install RPATH
> > set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
>
> I'm not sure these two settings are good for cross compiling.
> At least when I did cross compiling for really different targets, I usually
> installed the executables e.g. to ~/arm/inst/, but on the target platform
> this would be a different location, e.g. /opt or /usr/local (which could be
> NFS-mounted just from the local directory).
> So while the files where installed, but on the host system the RPATH
> was "wrong", but once they were moved to their final location the RPATH was
> then the correct one.
> This is also the case for you with the libc here. The executable doesn't
> have
> the RPATH set for the libc, so while it is on the build host system, ldd
> will
> show you the build host libc. Once you move it to the target system, ldd
> will
> automatically find the system libc there.
>
> If this is not what you want, I would suggest to
> 1) not use CMAKE_INSTALL_RPATH_USE_LINK_PATH when cross compiling
> 2) set CMAKE_INSTALL_RPATH explicitely to the directories you want on the
> target platform
>

What you're saying really makes sense. I'll give it a try. Thanks again for
all your help.

Adolfo


>
> Alex
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>



-- 
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/20090401/012e883a/attachment.htm>


More information about the CMake mailing list