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-11142] swift-build (at least) links libFoundation.so wrongly #53538

Closed
weissi opened this issue Jul 16, 2019 · 5 comments
Closed

[SR-11142] swift-build (at least) links libFoundation.so wrongly #53538

weissi opened this issue Jul 16, 2019 · 5 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@weissi
Copy link
Member

weissi commented Jul 16, 2019

Previous ID SR-11142
Radar rdar://problem/53147449
Original Reporter @weissi
Type Bug
Status Closed
Resolution Duplicate
Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: e681828baa39fa456ffe26bf984a0a44

duplicates:

  • SR-11124 SwiftPM related tools failed to launch with error: libFoundation.so: cannot open shared object file: No such file or directory

Issue Description:

Somewhere between the 2019-07-09 and the 2019-07-13 5.1 snapshot builds, swift-build started to link libFoundation wrongly: It links the absolute path /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so which refers to its place on the build server...

The ldd output looks like:

root@5a682198b227:/tmp/qwer# ldd /root/.swift/usr/bin/swift-build
    linux-vdso.so.1 =>  (0x00007ffc16f8b000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f7316380000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f731617d000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f7315f79000)
    libswiftCore.so => /root/.swift/usr/lib/swift/linux/libswiftCore.so (0x00007f7315a37000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f731572e000)
    libswiftGlibc.so => /root/.swift/usr/lib/swift/linux/libswiftGlibc.so (0x00007f7316bc2000)
    /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so => not found
    libswiftDispatch.so => /root/.swift/usr/lib/swift/linux/libswiftDispatch.so (0x00007f7316b8d000)
    libdispatch.so => /root/.swift/usr/lib/swift/linux/libdispatch.so (0x00007f7316b2b000)
    libBlocksRuntime.so => /root/.swift/usr/lib/swift/linux/libBlocksRuntime.so (0x00007f731552b000)
    libllbuildSwift.so => /root/.swift/usr/bin/../lib/swift/pm/llbuild/libllbuildSwift.so (0x00007f7316b0f000)
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f7315256000)
    libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f7315034000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f7314e0b000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f7314a89000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f7314873000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f73144a9000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f73169b5000)
    libatomic.so.1 => /usr/lib/x86_64-linux-gnu/libatomic.so.1 (0x00007f73142a1000)
    libicui18nswift.so.61 => /root/.swift/usr/lib/swift/linux/libicui18nswift.so.61 (0x00007f7313db5000)
    libicuucswift.so.61 => /root/.swift/usr/lib/swift/linux/libicuucswift.so.61 (0x00007f73139df000)
    libicudataswift.so.61 => /root/.swift/usr/lib/swift/linux/libicudataswift.so.61 (0x00007f7311e3a000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f7311c32000)
    /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so => not found
    libllbuild.so => /root/.swift/usr/bin/../lib/swift/pm/llbuild/libllbuild.so (0x00007f73118a8000)

that means SwiftPM doesn't work.

@weissi
Copy link
Member Author

weissi commented Jul 16, 2019

CC @millenomi/@aciidb0mb3r/@kevints/@compnerd who might have an idea what could've gone wrong in s-c-f + SwiftPM + CMake land.

@weissi
Copy link
Member Author

weissi commented Jul 16, 2019

@swift-ci create

@kevints
Copy link
Mannequin

kevints mannequin commented Jul 16, 2019

Looks like the fix is here: apple/swift-corelibs-foundation@e593c02

@weissi
Copy link
Member Author

weissi commented Jul 16, 2019

   root@76971cc9a4ef:/code# for f in /root/.swift/usr/bin/swift-build /root/.swift/usr/lib/swift/linux/libFoundation.so; do echo "readelf -dh $f"; echo; echo ============; readelf -dh "$f"; echo; echo =============; echo "ldd $f"; ldd "$f"; done
readelf -dh /root/.swift/usr/bin/swift-build

============
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x47140
  Start of program headers:          64 (bytes into file)
  Start of section headers:          6553288 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         9
  Size of section headers:           64 (bytes)
  Number of section headers:         46
  Section header string table index: 45

Dynamic section at offset 0x3d6640 contains 42 entries:
  Tag        Type                         Name/Value
 0x0000000000000003 (PLTGOT)             0x3d7fe8
 0x0000000000000002 (PLTRELSZ)           13200 (bytes)
 0x0000000000000017 (JMPREL)             0x41b18
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000007 (RELA)               0xd300
 0x0000000000000008 (RELASZ)             215064 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          6810
 0x0000000000000015 (DEBUG)              0x0
 0x0000000000000006 (SYMTAB)             0x298
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x53f8
 0x000000000000000a (STRSZ)              30488 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0xcb10
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftCore.so]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftGlibc.so]
 0x0000000000000001 (NEEDED)             Shared library: [/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftDispatch.so]
 0x0000000000000001 (NEEDED)             Shared library: [libdispatch.so]
 0x0000000000000001 (NEEDED)             Shared library: [libBlocksRuntime.so]
 0x0000000000000001 (NEEDED)             Shared library: [libllbuildSwift.so]
 0x0000000000000001 (NEEDED)             Shared library: [libsqlite3.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libncurses.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libtinfo.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000c (INIT)               0x44ea8
 0x000000000000000d (FINI)               0x332250
 0x000000000000001a (FINI_ARRAY)         0x3c52c8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000019 (INIT_ARRAY)         0x3c52d0
 0x000000000000001b (INIT_ARRAYSZ)       16 (bytes)
 0x000000000000001d (RUNPATH)            Library runpath: [/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/usr/lib/swift:$ORIGIN:$ORIGIN/../lib/swift/linux:/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/swiftpm-linux-x86_64/.bootstrap/lib/swift/linux:$ORIGIN/../lib/swift/pm/llbuild:/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/llbuild-linux-x86_64/lib]
 0x000000006ffffff0 (VERSYM)             0xcb48
 0x000000006ffffffe (VERNEED)            0xd210
 0x000000006fffffff (VERNEEDNUM)         4
 0x0000000000000000 (NULL)               0x0

=============
ldd /root/.swift/usr/bin/swift-build
    linux-vdso.so.1 =>  (0x00007ffd78d10000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f6559bb3000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f65599b0000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f65597ac000)
    libswiftCore.so => /root/.swift/usr/bin/../lib/swift/linux/libswiftCore.so (0x00007f655926a000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f6558f61000)
    libswiftGlibc.so => /root/.swift/usr/bin/../lib/swift/linux/libswiftGlibc.so (0x00007f655a3f5000)
    /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so => not found
    libswiftDispatch.so => /root/.swift/usr/bin/../lib/swift/linux/libswiftDispatch.so (0x00007f655a3c0000)
    libdispatch.so => /root/.swift/usr/bin/../lib/swift/linux/libdispatch.so (0x00007f655a35e000)
    libBlocksRuntime.so => /root/.swift/usr/bin/../lib/swift/linux/libBlocksRuntime.so (0x00007f6558d5e000)
    libllbuildSwift.so => /root/.swift/usr/bin/../lib/swift/pm/llbuild/libllbuildSwift.so (0x00007f655a342000)
    libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f6558a8a000)
    libncurses.so.5 => /lib/x86_64-linux-gnu/libncurses.so.5 (0x00007f6558868000)
    libtinfo.so.5 => /lib/x86_64-linux-gnu/libtinfo.so.5 (0x00007f655863f000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f65582bd000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f65580a7000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6557cdd000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f655a1e8000)
    libatomic.so.1 => /usr/lib/x86_64-linux-gnu/libatomic.so.1 (0x00007f6557ad5000)
    libicui18nswift.so.61 => /root/.swift/usr/bin/../lib/swift/linux/libicui18nswift.so.61 (0x00007f65575e9000)
    libicuucswift.so.61 => /root/.swift/usr/bin/../lib/swift/linux/libicuucswift.so.61 (0x00007f6557213000)
    libicudataswift.so.61 => /root/.swift/usr/bin/../lib/swift/linux/libicudataswift.so.61 (0x00007f655566e000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f6555466000)
    /home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so => not found
    libllbuild.so => /root/.swift/usr/bin/../lib/swift/pm/llbuild/libllbuild.so (0x00007f65550dc000)
readelf -dh /root/.swift/usr/lib/swift/linux/libFoundation.so

============
ELF Header:
  Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
  Class:                             ELF64
  Data:                              2's complement, little endian
  Version:                           1 (current)
  OS/ABI:                            UNIX - System V
  ABI Version:                       0
  Type:                              DYN (Shared object file)
  Machine:                           Advanced Micro Devices X86-64
  Version:                           0x1
  Entry point address:               0x0
  Start of program headers:          64 (bytes into file)
  Start of section headers:          12485992 (bytes into file)
  Flags:                             0x0
  Size of this header:               64 (bytes)
  Size of program headers:           56 (bytes)
  Number of program headers:         8
  Size of section headers:           64 (bytes)
  Number of section headers:         47
  Section header string table index: 46

Dynamic section at offset 0x859228 contains 42 entries:
  Tag        Type                         Name/Value
 0x0000000000000003 (PLTGOT)             0x85cfe8
 0x0000000000000002 (PLTRELSZ)           45792 (bytes)
 0x0000000000000017 (JMPREL)             0x27ad38
 0x0000000000000014 (PLTREL)             RELA
 0x0000000000000007 (RELA)               0x1e8c80
 0x0000000000000008 (RELASZ)             598200 (bytes)
 0x0000000000000009 (RELAENT)            24 (bytes)
 0x000000006ffffff9 (RELACOUNT)          18647
 0x0000000000000006 (SYMTAB)             0x228
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000005 (STRTAB)             0x86f88
 0x000000000000000a (STRSZ)              1236239 (bytes)
 0x000000006ffffef5 (GNU_HASH)           0x1b4c98
 0x0000000000000001 (NEEDED)             Shared library: [libicuucswift.so.61]
 0x0000000000000001 (NEEDED)             Shared library: [libicui18nswift.so.61]
 0x0000000000000001 (NEEDED)             Shared library: [libxml2.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [libutil.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftCore.so]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libdispatch.so]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftDispatch.so]
 0x0000000000000001 (NEEDED)             Shared library: [libBlocksRuntime.so]
 0x0000000000000001 (NEEDED)             Shared library: [libswiftGlibc.so]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libgcc_s.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/foundation-linux-x86_64/Foundation.dir/libFoundation.so]
 0x000000000000000c (INIT)               0x286018
 0x000000000000000d (FINI)               0x721230
 0x000000000000001a (FINI_ARRAY)         0x8402b8
 0x000000000000001c (FINI_ARRAYSZ)       8 (bytes)
 0x0000000000000019 (INIT_ARRAY)         0x8402c0
 0x000000000000001b (INIT_ARRAYSZ)       24 (bytes)
 0x000000000000001d (RUNPATH)            Library runpath: [/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/swift-linux-x86_64/lib/swift/linux:/home/buildnode/jenkins/workspace/oss-swift-5.1-package-linux-ubuntu-16_04/build/buildbot_linux/libdispatch-linux-x86_64/src:$ORIGIN]
 0x000000006ffffff0 (VERSYM)             0x1dd66c
 0x000000006ffffffc (VERDEF)             0x1e8a34
 0x000000006ffffffd (VERDEFNUM)          1
 0x000000006ffffffe (VERNEED)            0x1e8a50
 0x000000006fffffff (VERNEEDNUM)         6
 0x0000000000000000 (NULL)               0x0

=============
ldd /root/.swift/usr/lib/swift/linux/libFoundation.so
    linux-vdso.so.1 =>  (0x00007ffdbcdd3000)
    libicuucswift.so.61 => /root/.swift/usr/lib/swift/linux/libicuucswift.so.61 (0x00007fc2e0bf0000)
    libicui18nswift.so.61 => /root/.swift/usr/lib/swift/linux/libicui18nswift.so.61 (0x00007fc2e0704000)
    libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007fc2e0349000)
    libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fc2e012c000)
    libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007fc2dff29000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fc2dfd25000)
    libswiftCore.so => /root/.swift/usr/lib/swift/linux/libswiftCore.so (0x00007fc2df7e3000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc2df4da000)
    libdispatch.so => /root/.swift/usr/lib/swift/linux/libdispatch.so (0x00007fc2e1a44000)
    libswiftDispatch.so => /root/.swift/usr/lib/swift/linux/libswiftDispatch.so (0x00007fc2e1a10000)
    libBlocksRuntime.so => /root/.swift/usr/lib/swift/linux/libBlocksRuntime.so (0x00007fc2df2d7000)
    libswiftGlibc.so => /root/.swift/usr/lib/swift/linux/libswiftGlibc.so (0x00007fc2e19ff000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc2def55000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc2ded3f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc2de975000)
    libicudataswift.so.61 => not found
    libicudataswift.so.61 => not found
    libicuuc.so.55 => /usr/lib/x86_64-linux-gnu/libicuuc.so.55 (0x00007fc2de5e1000)
    libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007fc2de3c7000)
    liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007fc2de1a5000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fc2e188a000)
    libatomic.so.1 => /usr/lib/x86_64-linux-gnu/libatomic.so.1 (0x00007fc2ddf9d000)
    libicudataswift.so.61 => /root/.swift/usr/lib/swift/linux/libicudataswift.so.61 (0x00007fc2dc3f8000)
    librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fc2dc1f0000)
    libicudata.so.55 => /usr/lib/x86_64-linux-gnu/libicudata.so.55 (0x00007fc2da739000)

@weissi
Copy link
Member Author

weissi commented Jul 16, 2019

oh thanks @kevints for finding the fix and @compnerd for fixing that. I guess tomorrow's snapshot should work better.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

1 participant