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-9251] Cannot run code that imports Foundation on Linux with latest toolchain: error while loading shared libraries: libicuucswift.so.61: cannot open shared object file: No such file or directory #3591
Comments
It may possibly be a $ readelf -aW ~/swift-DEVELOPMENT-SNAPSHOT-2018-11-13-a-ubuntu18.04/usr/lib/swift/linux/libswiftCore.so |grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN:/usr/lib/swift/linux]
$ readelf -aW ~/swift-DEVELOPMENT-SNAPSHOT-2018-11-13-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so |grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/libdispatch-linux-x86_64/src] However the previous snapshot had: readelf -aW ~/swift-DEVELOPMENT-SNAPSHOT-2018-11-01-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so |grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN] Note the the build system for Foundation also got moved from python/ninja to CMake between these two snapshots and the old $ grep -r ORIGIN build.py
build.py: foundation.LDFLAGS += '-ldispatch -lswiftDispatch -L'+Configuration.current.variables["LIBDISPATCH_BUILD_DIR"]+'/src -rpath \$$ORIGIN ' So it may be a case of adding a Note that when not including Foundation it works correctly: $ cat t.swift
print("hi")
$ ~/swift-DEVELOPMENT-SNAPSHOT-2018-11-13-a-ubuntu18.04/usr/bin/swiftc t.swift && ./t
hi I will see if I can modify the CMake configuration for Foundation and see if that make a difference |
$ readelf -aW ~/swift-install/usr/lib/swift/linux/libFoundation.so |grep RUNPATH
0x000000000000001d (RUNPATH) Library runpath: [/home/spse/swift-source/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/home/spse/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src:$ORIGIN]
$ cat ~/src/hello.swift
import Foundation
print("Hello")
$ ~/swift-install/usr/bin/swiftc ~/src/hello.swift && ./hello
Hello |
2nd fix for extra copy of `libFoundation.so` |
This has been fixed in $ cat hello.swift
import Foundation
print("Hello")
ubuntu1804:~ $ ~/swift-DEVELOPMENT-SNAPSHOT-2018-11-25-a-ubuntu18.04/usr/bin/swiftc hello.swift && ./hello
Hello
ubuntu1804:~ spse$ ldd hello|grep icu
libicuucswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-25-a-ubuntu18.04/usr/lib/swift/linux/libicuucswift.so.61 (0x00007f669afda000)
libicui18nswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-25-a-ubuntu18.04/usr/lib/swift/linux/libicui18nswift.so.61 (0x00007f669aae4000)
libicudataswift.so.61 => /home/spse/swift-DEVELOPMENT-SNAPSHOT-2018-11-25-a-ubuntu18.04/usr/lib/swift/linux/libicudataswift.so.61 (0x00007f669876f000)
libicuuc.so.60 => /usr/lib/x86_64-linux-gnu/libicuuc.so.60 (0x00007f6696785000)
libicudata.so.60 => /usr/lib/x86_64-linux-gnu/libicudata.so.60 (0x00007f6692c5a000) |
Verified with the Nov 25 toolchain. Thanks1 |
This issue happens again with $ docker run -it norionomura/swift:20191106a
root@54d16b7b3d58:/# echo 'import Foundation;print("hello")'|swiftc - -o main && ./main
./main: error while loading shared libraries: libicuucswift.so.61: cannot open shared object file: No such file or directory
root@54d16b7b3d58:/# ldd -v ./main|grep libicu
libicuucswift.so.61 => not found
libicui18nswift.so.61 => not found
libicui18nswift.so.61 => /usr/lib/swift/linux/libicui18nswift.so.61 (0x00007fb10c953000)
libicuucswift.so.61 => /usr/lib/swift/linux/libicuucswift.so.61 (0x00007fb10c57d000)
libicudataswift.so.61 => /usr/lib/swift/linux/libicudataswift.so.61 (0x00007fb10a9d8000)
/usr/lib/swift/linux/libicui18nswift.so.61:
/usr/lib/swift/linux/libicuucswift.so.61: |
Looks like $ chrpath -l ~/swift-DEVELOPMENT-SNAPSHOT-2019-11-06-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so
/home/spse/swift-DEVELOPMENT-SNAPSHOT-2019-11-06-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so: RUNPATH=/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/libdispatch-linux-x86_64
to:
$ chrpath -l ~/swift-DEVELOPMENT-SNAPSHOT-2019-09-30-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so
/home/spse/swift-DEVELOPMENT-SNAPSHOT-2019-09-30-a-ubuntu18.04/usr/lib/swift/linux/libFoundation.so: RUNPATH=/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/libdispatch-linux-x86_64:/home/buildnode/jenkins/workspace/oss-swift-package-linux-ubuntu-18_04/build/buildbot_linux/libdispatch-linux-x86_64/src:$ORIGIN Probabaly a result of @compnerd's changes in #2524 migrating to CMake 3.15.1 The integration tests probably didnt catch this due to the buildpath still being in the |
confirmed that this issue has been resolved on |
Environment
Ubuntu 18.04
swift-DEVELOPMENT-SNAPSHOT-2018-11-13-a-ubuntu18.04
Additional Detail from JIRA
md5: 72bacd2e697a1f289333e4bb3034a3e4
Issue Description:
A Swift binary built with the latest toolchain (swift-DEVELOPMENT-SNAPSHOT-2018-11-13-a-ubuntu18.04) will not load if Foundation has been imported:
It works if I add
/usr/lib/swift/linux
to/LD_LIBRARY_PATH
.The text was updated successfully, but these errors were encountered: