Skip to content

build: honour and use RPATHs #2559

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

Merged
merged 1 commit into from
Nov 12, 2019
Merged

build: honour and use RPATHs #2559

merged 1 commit into from
Nov 12, 2019

Conversation

compnerd
Copy link
Member

RPATH handling in CMake 3.15 was unsupported on Swift targets. Adjust
the configuration to support it on CMake <3.16 and use that to set the
install RPATH to $ORIGIN rather than the workaround for the build RPATH.

@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

RPATH handling in CMake 3.15 was unsupported on Swift targets.  Adjust
the configuration to support it on CMake <3.16 and use that to set the
install RPATH to $ORIGIN rather than the workaround for the build RPATH.
@compnerd
Copy link
Member Author

@swift-ci please test Linux platform

@compnerd compnerd merged commit 817bb47 into swiftlang:master Nov 12, 2019
@compnerd compnerd deleted the rpath branch November 12, 2019 02:38
"SHELL:-Xlinker -rpath -Xlinker $$$$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>:$<TARGET_FILE_DIR:Foundation>")
endif()
set_target_properties(plutil PROPERTIES
INSTALL_RPATH "$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @compnerd, I just noticed that this broke the plutil command on linux, because it's not adding this relative rpath for 5.2 or master. I tried various ways to fix it, such as reverting back to

target_link_options(plutil PRIVATE "SHELL:-Xlinker -rpath -Xlinker \\\$\$ORIGIN/../lib/swift/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>")

but nothing worked for me, maybe you know how to fix this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@CodaFi, I don't know how close you guys are to shipping the 5.2 release, but I get the following when running plutil from the latest official 5.2 snapshot build on linux, because of this missing rpath:

> ./swift-5.2-DEVELOPMENT-SNAPSHOT-2020-03-19-a-ubuntu18.04/usr/bin/plutil -help
./swift-5.2-DEVELOPMENT-SNAPSHOT-2020-03-19-a-ubuntu18.04/usr/bin/plutil: error while loading shared libraries: libicuucswift.so.65: cannot open shared object file: No such file or directory
> readelf -d swift-5.2-DEVELOPMENT-SNAPSHOT-2020-03-19-a-ubuntu18.04/usr/bin/plutil  | ag runpath
 0x000000000000001d (RUNPATH)            Library runpath: [/home/buildnode/jenkins/workspace/oss-swift-5.2-package-linux-ubuntu-18_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux] 

Prefixing with LD_LIBRARY_PATH gets it working again, so it's clearly the rpath issue. I don't know how much this executable matters, but it's broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants