[CMake] RPATH cross-compile issue with CHECK_*_EXISTS

Jörg Krause joerg.krause at embedded.rocks
Tue Feb 28 05:25:40 EST 2017


On Mon, 2017-02-27 at 16:33 -0500, Brad King wrote:
> On 02/27/2017 03:50 PM, Jörg Krause wrote:
> > The problem is...
> 
> Thanks.  I've opened an issue for this here:
> 
>  https://gitlab.kitware.com/cmake/cmake/issues/16682

Great!

> > > These are set on by default in `Modules/Platform/UnixPaths.cmake`
> > > but
> > > disabled on Debian by `Modules/Platform/Linux.cmake` except when
> > > cross compiling.  If a toolchain file specifies CMAKE_SYSTEM_NAME
> > > such that a custom `Platform/MySystem.cmake` file is loaded then
> > > the latter can set them as needed for the target platform.
> > 
> > Thanks for the hint. We are discussing this setting as a
> > workaround.
> 
> It sounds like this target platform does not want the lib32/lib64
> suffixes to be searched so this would be an appropriate setting
> for the projects to use regardless of what is done about this in
> upstream CMake.  That will also fix it for using CMake 3.7.

Buildroot does not have any problems with searching for libraries in
lib32. It does have a problem with having a host rpath used for linking
with libraries.

So, turning of the search for lib32 is really just a workaround to get
rid of the host rpath.

>From my understanding, there are some possibilities to fix this issue:
1) Prefer to search in lib if FIND_LIBRARY_USE_LIB32_PATHS is enabled,
and only search in lib32 in case the target is not found in lib.
2) Make sure, in case lib32 is a symlink, to follow the symlink.
3) Make sure, in case lib32 is a symlink to lib and is not included in
the linker search paths, to add it to the implicit runtime search
paths.

Any thoughts?

Jörg


More information about the CMake mailing list