[Buildroot] [autobuild.buildroot.net] Build results for 2017-01-24

Jörg Krause joerg.krause at embedded.rocks
Thu Feb 9 20:02:49 UTC 2017


Hi,

On Tue, 2017-02-07 at 14:29 +0100, Samuel Martin wrote:
> On Tue, Feb 7, 2017 at 2:00 PM, Jörg Krause <joerg.krause at embedded.ro
> cks> wrote:
> > Hi Samuel,
> > 
> > On Tue, 2017-02-07 at 12:28 +0100, Samuel Martin wrote:
> > > Jörg, all,
> > > 
> > > On Tue, Feb 7, 2017 at 12:38 AM, Jörg Krause
> > > <joerg.krause at embedded.rocks> wrote:
> > > > Hi Samuel,
> > > > 
> > 
> > [snip]
> > 
> > > > 
> > > > Version 3.6.3 works, too. So, I did a git bisect. The rpath
> > > > issue
> > > > was
> > > > introduced in "Teach find_library and find_package to search
> > > > lib32
> > > > paths" [1].
> > > 
> > > Thanks for the investigation!
> > > 
> > > > 
> > > > Any ideas how to fix this?
> > > 
> > > Not so far :-/
> > 
> > Ray Donnely proposed a potential fix for this issue [1] on the
> > CMake
> > mailing list. I have not tried the patch so far.
> 
> Good to know CMake folks are already on this issue.

I had a closer look on why the rpath '/usr/lib32' is used in CMake 3.7.
This upstream commit [1] adds a property `FIND_LIBRARY_USE_LIB32_PATHS`
which is set to TRUE for the Linux platform [2]. This changes the
behavior of `find_library()`. Before the commit `/sysroot/usr/lib` was
found as library path, but now it's `/sysroot/usr/lib32`.

When determining the runtime search path, CMake compares the pathes
found by `find_library()` with a list of implicit runtime pathes. This
list contains `/sysroot/usr/lib` but not `/sysroot/usr/lib32`.

If the library path found by `find_library()` matches a search path
from the list of implicit runtime pathes it is dropped, otherwise it is
added to rpath after removing the `/sysroot` path.

As the implicit runtime search pathes does not contain
`/sysroot/usr/lib32` the rpath is set to `/usr/lib32`.

Note, that this is true not only for bctoolbox but for all CMake
packages!

The behavior of determining the runtime path is controlled by the
property `FIND_LIBRARY_USE_LIB32_PATHS`. As already mentioned, the
value is set to `TRUE` for the Linux platfrom. I tried to overwrite the
property in the toolchain file, without any luck.

Another possibility might be to add `/sysroot/usr/lib32` to the list of
implicit link directories, but using
`CMAKE_C_IMPLICIT_LINK_DIRECTORIES` in the toolchain file did not work
for me.

An approach which worked for me was to remove the `CMAKE_SYSTEM_NAME`
setting from the toolchain file. This way, I was able to set the
`FIND_LIBRARY_USE_LIB32_PATHS` property to `FALSE` and `/usr/lib32` was
not set as rpath anymore.

Samuel, do you have any idea how to set the property
`FIND_LIBRARY_USE_LIB32_PATHS` without removing `CMAKE_SYSTEM_NAME`
from the toolchain file?

Or is there any other solution?

[1] https://gitlab.kitware.com/cmake/cmake/commit/896ad251de49f167f4ce3
cbbcf9a6cce85a16681
[2] https://gitlab.kitware.com/cmake/cmake/blob/896ad251de49f167f4ce3cb
bcf9a6cce85a16681/Modules/Platform/Linux.cmake#L56

Jörg



More information about the buildroot mailing list