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-9347] XCTest and dispatch compiled with wrong linker settings [was: SwiftPM libBlocksRuntime.so.0 missing dependency] #630
Comments
Comment by Ian Partridge (JIRA) @compnerd can you take a look? |
so @kevints and I just had a look at what's going on here. Turns out the build system that builds SwiftPM is very wrong and the build systems that build XCTest & dispatch aren't quite right either (but do better). Let's have a quick looks at why this happens: In total, I can see the following binaries trying to link Group 1, getting it wrong: using the wrong soname (
Running
the The effect of this is that it'll only ever "work" if you have the distribution's Group 2, getting the soname right but the
running {{readelf -d }} on them:
We're missing The effect of this is that it'll work correctly if you do not have the distro's Group 3:
gets both the soname as well as the RUNPATH right:
I say "right", this should definitely not contain the buildnode's paths but it's probably not a disaster. |
@swift-ci create |
@kevints is this a fair summary? You know more than I do about this stuff, so please fill in everything that's missing. |
pinging @aciidb0mb3r and @neonichu as the SwiftPMs from the toolchain won't even run in the situation that's preferable to us which is that there's no |
It sounds like we just need to configure the rpaths? |
@aciidb0mb3r yes, configuring the rpaths and making sure the right soname is picked sounds like it will work. |
Ok, let me build on linux and check what's going on. |
awesome, thanks @aciidb0mb3r |
SwiftPM's rpaths are correct and the stage1 SwiftPM has the correct linkage where as stage2 SwiftPM is linking both for some reason. |
@aciidb0mb3r for the ones needing |
I found the SwiftPM issue. The problem is that SwiftPM passes linker paths using -Xlinker prefix in stage2. This somehow decreases the search path priority and the library from system is picked instead. I need to think about how to fix this. Maybe we should be passing linker flags as-is. |
Talked to @belkadan. He says -Xlinker args are always passed at the end so we end up finding the library in the system instead of at our custom location. We need to drop the -Xlinker prefix for -L flags. |
If |
Fixed SwiftPM here: apple/swift-package-manager#1895 |
Comment by David Jones (JIRA) @aciidb0mb3r This needs to be fixed in the 5.0 branch too: djones6@wolff:~$ swiftenv local 4.2.1
djones6@wolff:~$ swift package --help > /dev/null && echo "OK"
OK
djones6@wolff:~$ swiftenv local DEVELOPMENT-SNAPSHOT-2018-12-07-a
djones6@wolff:~$ swift package --help > /dev/null && echo "OK"
OK
djones6@wolff:~$ swiftenv local 5.0-DEVELOPMENT-SNAPSHOT-2018-12-09-a
djones6@wolff:~$ swift package --help > /dev/null && echo "OK"
/home/djones6/.swiftenv/versions/5.0-DEVELOPMENT-SNAPSHOT-2018-12-09-a/usr/bin/swift-package: error while loading shared libraries: libBlocksRuntime.so.0: cannot open shared object file: No such file or directory |
Comment by David Jones (JIRA) Further to my earlier comment, this is now in |
Environment
Ubuntu 16.04 (docker: ubuntu:16.04)
Additional Detail from JIRA
md5: c366bc20e06db396929e3f33a653ef84
Issue Description:
SwiftPM in swift development snapshots of 2018-07-21-a and later fails on a clean Ubuntu installation with:
/swift-DEVELOPMENT-SNAPSHOT-2018-07-21-a-ubuntu16.04/usr/bin/swift-package: error while loading shared libraries: libBlocksRuntime.so.0: cannot open shared object file: No such file or directory
It seems that installing libblocksruntime-dev resolves this, but this is not a dependency that was required for any previous versions of Swift.
It looks like this additional dependency was introduced in this PR: apple/swift-package-manager#1631
Snapshots around 2018-10-19-a and later do seem to include /usr/lib/swift/linux/libBlocksRuntime.so - possibly as a result of #362 - but there is no libBlocksRuntime.so.0 symlink to this. Creating a symlink from libBlocksRuntime.so -> libBlocksRuntime.so.0 seems to make things work, but I'll freely admit that I don't really know what I'm doing.
The text was updated successfully, but these errors were encountered: