New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpath doesn't work correctly with relative CMAKE_INSTALL_LIBDIR #437
Comments
Hmm, so, just so I understand: on some platforms, the above check fails and then we The part I don't understand is: why does that check fail? Surely on OpenSUSE Just so we know, the snippet you highlighted came from the Kitware (the makers of CMake) wiki: Given it is also used in other places: I'm slightly inclined that there's a bit more going on here than just "OpenSUSE uses |
Right.
Mostly, the path is /usr/lib64. And according to the script, the rpath setting happens always. It's just that it should be set to /usr/lib64. Not sure what's the reason behind that...
No, it's all absolute:
I noticed only now, because openSUSE started complaining about buggy rpaths in libs only recently. As I wrote:
|
Just so you know: your issue here is totally legitimate; I'm just trying to understand it so we know how to fix it correctly.
Okay, but as you wrote above:
So why does the check fail here? Surely |
But
And With this if (USE_GID)
include(GNUInstallDirs)
endif()
message("CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES=${CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES}")
message("CMAKE_INSTALL_LIBDIR=${CMAKE_INSTALL_LIBDIR}")
message("CMAKE_INSTALL_FULL_LIBDIR=${CMAKE_INSTALL_FULL_LIBDIR}") $ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 . |& grep CMAKE
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES=/lib;/lib32;/lib64;/usr/lib;/usr/lib32;/usr/lib64
CMAKE_INSTALL_LIBDIR=lib64
CMAKE_INSTALL_FULL_LIBDIR=
$ cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib64 -DUSE_GID=1 . |& grep CMAKE
CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES=/lib;/lib32;/lib64;/usr/lib;/usr/lib32;/usr/lib64
CMAKE_INSTALL_LIBDIR=lib64
CMAKE_INSTALL_FULL_LIBDIR=/usr/lib64 |
You seem to be hesitant for STP to adopt |
Another question: could we just "emulate" |
I use it for all my projects. But they are all linux. I don't know how it behaves on win for example. For example here: That works for mingw too: |
|
Would you be happy to make a PR that uses |
Heh: Line 49 in e8d153f
So it should be matter of correct use of |
Just noticed that these two links behave differently than stp+minisat. They have What I don't understand is this (from the either) link: set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
...
list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir)
if("${isSystemDir}" STREQUAL "-1")
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
endif("${isSystemDir}" STREQUAL "-1") What's the purpose of the whole |
Commit a26083b (Fixing libdirs for CMakeLists) switched from "${CMAKE_INSTALL_PREFIX}/lib" to "${CMAKE_INSTALL_LIBDIR}". It fixed the issue with lib vs lib64. But while the former is absolute, the latter needs not. That causes troubles as rpath can be set to simething like "lib64" only. That is bogus So fix this by using absolute ${CMAKE_INSTALL_FULL_LIBDIR}" from GNUInstallDirs which is already included and handles the paths correctly. Fixes stp#437.
Yes, that works for me. Let's do a PR.
This, I still have no clue -- reported: |
Commit a26083b (Fixing libdirs for CMakeLists) switched from "${CMAKE_INSTALL_PREFIX}/lib" to "${CMAKE_INSTALL_LIBDIR}". It fixed the issue with lib vs lib64. But while the former is absolute, the latter needs not. That causes troubles as rpath can be set to something like "lib64" only. That is bogus. So fix this by using absolute "${CMAKE_INSTALL_FULL_LIBDIR}" from GNUInstallDirs which is already included and handles the paths correctly. Fixes stp#437.
openSUSE build system defines:
where:
I.e.
CMAKE_INSTALL_LIBDIR
is relative. Which is perfectly fine -- in fact https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html says:So this test doesn't work properly:
stp/CMakeLists.txt
Lines 191 to 194 in e8d153f
and rpath is set to "lib64". If you used
GNUInstallDirs
, you could useCMAKE_INSTALL_FULL_LIBDIR
in the test above. I don't know how to solve it withoutGNUInstallDirs
.BTW. minisat has exactly the same problem:
https://github.com/stp/minisat/blob/37158a35c62d448b3feccfa83006266e12e5acb7/CMakeLists.txt#L86
The text was updated successfully, but these errors were encountered: