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

Brad King brad.king at kitware.com
Tue Feb 28 08:23:50 EST 2017


On 02/27/2017 08:11 PM, Ray Donnelly wrote:
>> CMake passes the host rpath to the linker
> 
> CMake does this because it isn't *asking* the linker, it's making
> assumptions instead (and adding some predefined values like
> `/usr/lib32`). If we just ask the linker instead then everything
> should work just fine (I am ignore linkers that cannot tell us here
> like Apple's ld64. I'm not sure how to tackle that one yet).

The /usr/lib32 path is not coming from any assumption or from guessing
about the linker's rpath.  It is appearing because we add to the rpath
directories in which shared libraries appear that we include in our link.
When find_library discovers /usr/lib32/libfoo.so, and we link to that
library, then we add /usr/lib32 to the rpath if it is not in the implicit
list.  If we were to ask the linker what its rpath is it would say
"/usr/lib" and then we would say "/usr/lib32 != /usr/lib" and add it
anyway.  Jörg's problem is about this lack of symlink recognition, and
that is the issue I filed.

-Brad


More information about the CMake mailing list