Skip to content
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

[SR-12394] plutil executable is broken on linux #3262

Closed
finagolfin opened this issue Mar 22, 2020 · 3 comments
Closed

[SR-12394] plutil executable is broken on linux #3262

finagolfin opened this issue Mar 22, 2020 · 3 comments

Comments

@finagolfin
Copy link
Contributor

Previous ID SR-12394
Radar rdar://problem/60832864
Original Reporter @buttaface
Type Bug
Status Resolved
Resolution Done
Environment

Arch Linux x86_64, kernel 5.5.4-arch1-1

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: d68017bba292055ec763fd88bfafbf07

Issue Description:

Here are my results from running plutil from a recent official 5.2 snapshot for Ubuntu, which is reproducible with the trunk snapshot too:
> ./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]
> LD_LIBRARY_PATH=./swift-5.2-DEVELOPMENT-SNAPSHOT-2020-03-19-a-ubuntu18.04/usr/lib/swift/linux ./swift-5.2-DEVELOPMENT-SNAPSHOT-2020-03-19-a-ubuntu18.04/usr/bin/plutil -help
plutil: [command_option] [other_options] file...
The file '-' means stdin
Command options are (-lint is the default):
-help show this message and exit
...

I'm fairly certain that this RPATH pull broke it, as that relative RPATH isn't there in plutil anymore. However, I don't know what magic combination of symbols to use to escape the $ sign in $ORIGIN, as it keeps screwing with the RPATH when I tried reverting, as I noted in a comment on that pull.

@beccadax
Copy link
Contributor

@swift-ci create

@finagolfin
Copy link
Contributor Author

An update: this is still broken but not for the same reason. After CMake was updated to 3.19.6 in Swift PR 37517, the right relative RPATH is now added but plutil now fails because it can't find libicudata:
> ./swift-DEVELOPMENT-SNAPSHOT-2021-05-26-a-centos8/usr/bin/plutil -h
./swift-DEVELOPMENT-SNAPSHOT-2021-05-26-a-centos8/usr/bin/plutil: error while loading shared libraries: libicudataswift.so.65: cannot open shared object file: No such file or directory

The relative RPATH is now there so that's not the issue anymore:

> readelf -d ./swift-DEVELOPMENT-SNAPSHOT-2021-05-26-a-centos8/usr/bin/plutil | ag runpath
0x000000000000001d (RUNPATH) Library runpath: [/home/build-user/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:$ORIGIN/../lib/swift/linux]

The issue now is that the libicui18n and libicuuc libraries that ship with Swift on linux don't have $ORIGIN in their RPATH, as adding it to them with patchelf gets plutil working again. This probably doesn't normally hit with Swift executables on Linux because they have the absolute path to these Swift libraries added to their rpath, which is then applied to libicu to find their dependencies too, but plutil can't know the absolute path where it will be installed so it breaks.

$ORIGIN will need to be added to the RPATH of the shipped libicu to finally fix this.

@finagolfin
Copy link
Contributor Author

This was finally fixed by adding `$ORIGIN` to the `RPATH` of the ICU libraries, as part of another pull:

apple/swift#40340

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants