-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
[vcpkg] Fixup rpath after building dynamic libraries on linux #23035
Conversation
We are still discussing about rpath in #19127. |
@JackBoosY six months without replies is not really a discussion... Maybe this implementation will reignite it. |
Fine, I canceled all tests. |
Why? It may still break CI. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This comment was marked as resolved.
This comment was marked as resolved.
Yeah, that was resolved. |
The team discussed this PR and the general approach to improve our Linux dynamic experience:
|
There are prebuilt binaries for many architectures: https://github.com/NixOS/patchelf/releases/tag/0.14.5, but should we consider Windows->Linux cross compilation scenario? I have no idea whether it's possible to build patchelf for Windows. Anyway, it may be done in later PR.
The comment you linked describes the way to automatically pass
This is what I was thinking about, too. So the whole set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)
set(VCPKG_POST_BUILD_FIXUP_RPATH ON) Same for BSD and other platforms that use elf format.
Also, is there any conclusion on what to do with tools (#17607)? This is something I didn't think of very well in my initial implementation. Having multiple combinations of tools paths increases complexity of this PR. Main issue is debug variant of tools. |
If a port is adding rpaths like described:
this needs to be patch out any way. Ports are not allow to set rpaths, only the toolchain is.
this needs to be fixed. The toolchain file should define all flags and pass them on to the build. |
@Neumann-A you are right, it's better to build with correct rpath than to fix afterwards. This would require writing a post-build check in |
Also, without resolving #17607 it will be hard to set correct rpath for tools at build time. |
that will be only |
Why? What's the difference between this and setting rpath to |
It doesn't require looking into the parent if there is a |
I'm already calculating relative path to |
With the current ad-hoc layout, debug tools also need help to find data files. For Linux, it would be much easier if debug variants were installed into an entirely separate prefix. |
|
Tagged |
For cross-compiling you can always use a static host triplet. Cross-compiling to mingw triplets works very well this way. RPATH must not contain absolute paths. It breaks relocatability of cached artifacts. |
Got it. Thx for suggestion. : ) |
triplets/x64-linux.cmake
Outdated
@@ -4,3 +4,4 @@ set(VCPKG_LIBRARY_LINKAGE static) | |||
|
|||
set(VCPKG_CMAKE_SYSTEM_NAME Linux) | |||
|
|||
set(VCPKG_FIXUP_ELF_RPATH ON) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Osyotr I think we're ready to merge this PR if this change is reverted.
We can always make this on-by-default and enable it in static triplet in a future change if we wanted to.
073d8ad
to
f07e8b1
Compare
So currently the only thing preventing us from converting x64-linux-dynamic to an official triplet is our budget? |
Yes |
Great powerful PR, thx @Osyotr |
I am using an |
This is required to make packages built with (currently nonexisting)
x64-linux-dynamic
triplet relocatable.After building a package, we patch binaries so that they have correct rpath values, relative to
lib/
(ordebug/lib/
).Partially addresses my comment #19940 (comment).