swiftlang / swift-package-manager

The Package Manager for the Swift Programming Language
Apache License 2.0
9.76k stars 1.35k forks source link

[SR-9182] Not detecting libraries deployed with binary, $ escaped in runpath #4885

Open swift-ci opened 6 years ago

swift-ci commented 6 years ago
Previous ID SR-9182
Radar None
Original Reporter trametheka (JIRA User)
Type Bug
Additional Detail from JIRA | | | |------------------|-----------------| |Votes | 0 | |Component/s | Compiler, Package Manager | |Labels | Bug, Screened | |Assignee | None | |Priority | Medium | md5: 1685ab99f5197a7100a6205822ad3e93

Issue Description:

I'm not sure if something has changed in the package manager or compiler or something else sorry, so I'll tag both.

In previous version of Swift, I've been able to deploy libraries beside the compiled binary (on Ubuntu in this case).

As of 4.2.1, libraries are not detected beside the binary. It looks like that rpath is being escaped and breaking this.

4.1.2 binary:

readelf -d test
<snip>
0x000000000000001d (RUNPATH)            Library runpath: [/home/eric/.swiftenv/versions/4.1.2/usr/lib/swift/linux:$ORIGIN]

4.2.1 binary:

readelf -d test
<snip>
0x000000000000001d (RUNPATH)            Library runpath: [/home/eric/.swiftenv/versions/4.2.1/usr/lib/swift/linux:\$ORIGIN]

Building with -Xlinker -rpath=$ORIGIN is also escaped to \$ORIGIN.

belkadan commented 6 years ago

@compnerd, @aciidb0mb3r, someone just fixed this on master, didn't they? I didn't realize it had escaped to the 4.2 branch. :-(

aciidgh commented 5 years ago

I haven't been able to reproduce this

swift-ci commented 5 years ago

Comment by Eric Thorpe (JIRA)

Sorry @aciidb0mb3r, been away from swift for a while. I can no longer reproduce this either. I have two VMs Ubuntu 16.04, one desktop, one server, both exhibiting this behaviour on build. I've run up some new 16.04 installs using the same swift download and having no problems now. I guess I'll write it off to something in those VMs, archive them and move on. Thanks for taking a look.

swift-ci commented 5 years ago

Comment by Eric Thorpe (JIRA)

This issue has resurfaced and I'm at a loss to understand what's going on. I have it with some projects, but not others. One way I've been able to consistently replicate it:

Ubuntu 16.04.5 Desktop clean and up to date

sudo apt install clang libicu-dev libpython2.7 libssl-dev git curl

Install Swift, swiftenv, following Swift.org instructions or via Vapors deb repo seems to make no difference, 4.2+

git clone https://github.com/vapor/auth-template.git

cd auth-template && swift build