-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[build][android] set INSTALL_RPATH properly for shared libraries #30235
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
Conversation
endif() | ||
set_target_properties("${target}" | ||
PROPERTIES | ||
INSTALL_RPATH "$ORIGIN") |
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.
No checks needed now that this is only set for host libraries on Android.
Ping, this is a small pull that would help get rid of unnecessary rpaths in Swift binaries and shared libraries on ELF platforms. |
I don't know about the logic of the changes (if they are right or not), but it doesn't break the Android builds for me, so I hope it doesn't break them in CI. But this changes the Linux builds slightly, in a way similar to what the @swift-ci please test |
Build failed |
All this pull does is allow those on ELF platforms, ie linux, Android, BSD, and so on, to disable the host toolchain rpath from being automatically added to Swift shared libraries by manually adding the Since this merely enables an optional flag that is already defined for macOS on ELF platforms too, it should have no effect on the pre-existing tests, builds, and so on. It merely gives those who know what they're doing a flag they can use to disable that toolchain rpath from being added to Swift ELF shared libraries, just like on macOS. |
Oh, the macOS CI failure seems spurious. |
Host libraries will likely all need ORIGIN set, whereas only set it for target libraries that will be packaged with a native toolchain on Android.
Saleem just merged #30430 which adds I haven't added the native sysroot location, ie something like |
@swift-ci please test and merge |
Hmm, it didn't go through, but that's probably for the best, as I think I'll have to change this pull a bit. Hold off on merging for now, I'll update this pull in a day or two. |
I don't think I'll add anything else after all, please go ahead and merge. |
@swift-ci smoke test |
Linux failure is spurious. |
@swift-ci smoke test linux |
Ready to go? This only affects Android, so very safe to merge. |
This finally allows removing the toolchain/SDK rpaths that are currently automatically added when compiling Swift shared libraries and executables on non-Darwin platforms. Also,Similar flag added in #30430 instead. Remove unnecessary checks for Android's INSTALL_RPATH, now that the CMake setup has been refactored to separate host and target library configuration.I've backported this swiftc flag to the Swift 5.1.4 package script for Android and then use it to avoid adding the toolchain rpath for Foundation and other Swift shared libraries in the toolchain.That would be useful for the official releases for linux too, here's what the 5.1.4 release and the latest 5.2 snapshot show:@brentdax, you modified some of this rpath config last year, let me know what you think.@drodriguez, let me know about the Android part.@tachoknight, this should be useful for all Swift packagers.