# TestFoundation test suite failing while building Swift Toolchain

**URL:** <https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279>\
**Category:** Core Libraries\
**Created:** [February 8, 2019, 11:55am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279 "2019-02-08T11:55:05Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [February 8, 2019, 11:55am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/1 "2019-02-08T11:55:05Z")

</div>

Hi,

I have been trying to build Swift 5.0 master on PowerPC(powerpc64le) using the build-toolchain script to run the test suite as well. I had been facing issues with tests in lldb suite([LLDB test failures while building Swift 5.0 toolchain](https://forums.swift.org/t/lldb-test-failures-while-building-swift-5-0-toolchain/18966)). After skipping the failing lldb tests, I am able to complete the libdispatch test suite. However, facing the following issues in TestFoundation test suite:-

```nohighlight
[257/257][100%][91.650s] Running utility command for TestFoundation
--- Running tests for foundation ---
--- test ---
+ /usr/bin/cmake --build /root/swift-source/build/buildbot_linux/foundation-linux-powerpc64le -- -j8 test
[0/1][0%][0.000s] Running tests...
Test project /root/swift-source/build/buildbot_linux/foundation-linux-powerpc64le
    Start 1: TestFoundation
1/1 Test #1: TestFoundation ...................***Failed 0.00 sec
/root/swift-source/build/buildbot_linux/foundation-linux-powerpc64le/TestFoundation/TestFoundation: error while loading shared libraries: libicui18nswift.so.61: cannot open shared object file: No such file or directory

0% tests passed, 1 tests failed out of 1

Total Test time (real) = 0.00 sec

The following tests FAILED:
	  1 - TestFoundation (Failed)
Errors while running CTest
FAILED: CMakeFiles/test.util 
cd /root/swift-source/build/buildbot_linux/foundation-linux-powerpc64le && /usr/bin/ctest --force-new-ctest-process
ninja: build stopped: subcommand failed.
Building the standard library for: swift-stdlib-linux-powerpc64le
Running Swift tests for: check-swift-all-linux-powerpc64le check-swift-all-optimize-linux-powerpc64le
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting
./utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

```

---

<div class="post-metadata">

**Author:** ![John\_McCall](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/john_mccall/32/1351_2.png) [@John\_McCall](https://forums.swift.org/u/John_McCall)\
**Post date:** [February 8, 2019, 7:01pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/2 "2019-02-08T19:01:16Z")

</div>

Moved this to the right category.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [February 8, 2019, 7:08pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/3 "2019-02-08T19:08:33Z")

</div>

The `rpath` probably doesn't include the ICU build and the ICU that you are building against is a local build (probably a `build-script` issue, which I don't really use).

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [February 11, 2019, 9:03am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/4 "2019-02-11T09:03:45Z")

</div>

Hi @compnerd

Are you referring to any specific file which needs to be looked into in order to correct the rpath and include ICU build?

For example making changes in 'CMakeList.txt' file under 'lldb/tools/repl/swift' directory to include correct rpath for powerpc64le helped resolve quite a few lldb suite related test cases.

diff --git a/tools/repl/swift/CMakeLists.txt b/tools/repl/swift/CMakeLists.txt  
index e7733d3..dd419d2 100644  
--- a/tools/repl/swift/CMakeLists.txt  
+++ b/tools/repl/swift/CMakeLists.txt  
@@ -4,8 +4,13 @@ if (LLDB\_BUILD\_FRAMEWORK)  
-Wl,${CMAKE\_BINARY\_DIR}/${LLDB\_FRAMEWORK\_INSTALL\_DIR}/${LLDB\_FRAMEWORK\_RESOURCE\_DIR}/Swift/macosx")  
elseif( CMAKE\_SYSTEM\_NAME MATCHES "Linux" )

# Set the correct rpath to locate libswiftCore

- set(CMAKE\_EXE\_LINKER\_FLAGS "${CMAKE\_EXE\_LINKER\_FLAGS} \
- 

```
 -Wl,-rpath,${CMAKE_BINARY_DIR}/../swift-linux-x86_64/lib${LLVM_LIBDIR_SUFFIX}/swift/linux -Wl,-ldl")

```

- if (CMAKE\_HOST\_SYSTEM\_PROCESSOR MATCHES "ppc64le")
- set(CMAKE\_EXE\_LINKER\_FLAGS "${CMAKE\_EXE\_LINKER\_FLAGS} \
- 

```
   -Wl,-rpath,${CMAKE_BINARY_DIR}/../swift-linux-powerpc64le/lib${LLVM_LIBDIR_SUFFIX}/swift/linux/powerpc64le -Wl,-ldl")

```

- else()
- set(CMAKE\_EXE\_LINKER\_FLAGS "${CMAKE\_EXE\_LINKER\_FLAGS} \
- 

```
   -Wl,-rpath,${CMAKE_BINARY_DIR}/../swift-linux-x86_64/lib${LLVM_LIBDIR_SUFFIX}/swift/linux -Wl,-ldl")

```

- endif()  
set(CMAKE\_INSTALL\_RPATH "$ORIGIN/../lib/swift/linux:${CMAKE\_INSTALL\_RPATH}")  
endif()

Please suggest, your inputs might make all the difference! 🙂

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [February 11, 2019, 4:05pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/5 "2019-02-11T16:05:35Z")

</div>

The `rpath` in this case should be setup properly through CMake. Did you specify `-DICU_ROOT` to the root of the ICU build? Or the appropriate variable set `ICU_{I18N,UC}{,_LIB}` IIRC? Without that, the link will reference the wrong libraries. I would suggest that you take a look at TestFoundation's link information. `llvm-readelf -program-headers` is what you want IIRC.

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [February 13, 2019, 11:35am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/6 "2019-02-13T11:35:18Z")

</div>

@compnerd thanks for your inputs.  
1.) Tried setting ICU\_ROOT & DICU\_ROOT in "swift/utils/build-script-impl". However faced the same errors as before - "error while loading shared libraries: libicui18nswift.so.61: cannot open shared object file: No such file or directory". Correct me if this is not correct approach to set the two variables.  
2.) Used the 'llvm-readelf' utility to find details about the libraries linked with TestFoundation binary:-

```
	sar@e2641fd15168:~$ /home/sar/swift-source/build/buildbot_linux/llvm-linux-powerpc64le/bin/llvm-readelf -dynamic-table /home/sar/swift-source/build/buildbot_linux/foundation-linux-powerpc64le/TestFoundation/TestFoundation
	DynamicSection [ (40 entries)
	  Tag Type Name/Value
	  0x0000000000000003 PLTGOT 0x7d9eb8
	  0x0000000000000002 PLTRELSZ 41448 (bytes)
	  0x0000000000000017 JMPREL 0x86b80
	  0x0000000000000014 PLTREL RELA
	  0x0000000000000007 RELA 0x32118
	  0x0000000000000008 RELASZ 346728 (bytes)
	  0x0000000000000009 RELAENT 24 (bytes)
	  0x000000006ffffff9 RELACOUNT 5957
	  0x0000000000000015 DEBUG 0x0
	  0x0000000070000000 PPC64_GLINK 0x6457d0
	  0x0000000000000006 SYMTAB 0x290
	  0x000000000000000b SYMENT 24 (bytes)
	  0x0000000000000005 STRTAB 0x103b8
	  0x000000000000000a STRSZ 132946 (bytes)
	  0x000000006ffffef5 GNU_HASH 0x30b10
	  0x0000000000000001 NEEDED Shared library: [libswiftCore.so]
	  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: [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: [libXCTest.so]
	  0x0000000000000001 NEEDED Shared library: [libswiftGlibc.so]
	  0x0000000000000001 NEEDED Shared library: [libFoundation.so]
	  0x0000000000000001 NEEDED Shared library: [libstdc++.so.6]
	  0x0000000000000001 NEEDED Shared library: [libgcc_s.so.1]
	  0x0000000000000001 NEEDED Shared library: [libc.so.6]
	  0x000000000000000c INIT 0x90d80
	  0x000000000000000d FINI 0x6472f0
	  0x000000000000001a FINI_ARRAY 0x792220
	  0x000000000000001c FINI_ARRAYSZ 8 (bytes)
	  0x0000000000000019 INIT_ARRAY 0x792228
	  0x000000000000001b INIT_ARRAYSZ 16 (bytes)
	  **0x000000000000001d RUNPATH /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux:/home/sar/swift-source/build/buildbot_linux/libdispatch-linux-powerpc64le/src**
	  0x000000006ffffff0 VERSYM 0x30b48
	  0x000000006ffffffe VERNEED 0x320b8
	  0x000000006fffffff VERNEEDNUM 3
	  0x0000000000000000 NULL 0x0
	]

```

Figured out that the directories mentioned in RUNPATH did not have the required library - libicui18nswift.so.61

```
sar@e2641fd15168:~$ ll /home/sar/swift-source/build/buildbot_linux/swift-linux-powerpc64le/lib/swift/linux
total 16004
drwxr-xr-x 3 sar sar 4096 Feb 13 07:11 ./
drwxr-xr-x 5 sar sar 4096 Feb 13 07:00 ../
-rwxr-xr-x 1 sar sar 8805520 Feb 13 07:11 libswiftCore.so*
-rwxr-xr-x 1 sar sar 84192 Feb 13 07:11 libswiftGlibc.so*
-rw-r--r-- 1 sar sar 4674 Feb 13 06:57 libswiftImageInspectionShared.a
-rw-r--r-- 1 sar sar 1100452 Feb 13 06:57 libswiftReflection.a
-rwxr-xr-x 1 sar sar 688424 Feb 13 06:57 libswiftRemoteMirror.so*
-rwxr-xr-x 1 sar sar 72576 Feb 13 07:11 libswiftRuntimeUnittest.so*
-rwxr-xr-x 1 sar sar 71280 Feb 13 07:11 libswiftSIMDOperators.so*
-rwxr-xr-x 1 sar sar 3534296 Feb 13 07:11 libswiftStdlibCollectionUnittest.so*
-rwxr-xr-x 1 sar sar 237328 Feb 13 07:11 libswiftStdlibUnicodeUnittest.so*
-rwxr-xr-x 1 sar sar 961320 Feb 13 07:11 libswiftStdlibUnittest.so*
-rwxr-xr-x 1 sar sar 529968 Feb 13 07:11 libswiftSwiftOnoneSupport.so*
-rwxr-xr-x 1 sar sar 97056 Feb 13 07:11 libswiftSwiftPrivate.so*
-rwxr-xr-x 1 sar sar 81360 Feb 13 07:11 libswiftSwiftPrivateLibcExtras.so*
-rwxr-xr-x 1 sar sar 82736 Feb 13 07:11 libswiftSwiftPrivateThreadExtras.so*
**drwxr-xr-x 4 sar sar 4096 Feb 13 09:46 powerpc64le/**

```

However, the /home/sar/swift-source/build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/ **powerpc64le** has all the required libraries. I tried setting RUNPATH through various files which referenced RUNPATH, but it did not help much.

Finally I manually copied the libraries in the directory mentioned in the RUNPATH and it worked. The TestFoundation test suite was executed, though it failed for 4 test cases since I was running as a root user. Running as normal non root user worked and all the test cases for TestFoundation passed successfully:-

[256/257][99%][98.957s] Generating TestFoundation.dir/TestFoundation  
[257/257][100%][99.479s] Running utility command for TestFoundation  
--- Running tests for foundation ---  
--- test ---

- /usr/bin/cmake --build /home/sar/swift-source/build/buildbot\_linux/foundation-linux-powerpc64le -- -j7 test  
[0/1][0%][0.000s] Running tests...  
Test project /home/sar/swift-source/build/buildbot\_linux/foundation-linux-powerpc64le  
Start 1: TestFoundation  
1/1 Test #1: TestFoundation ................... Passed 53.48 sec

**100% tests passed, 0 tests failed out of 1**

Total Test time (real) = 53.49 sec  
-- test finished --  
**--- Finished tests for foundation ---**

Question:-  
How do I set the correct RUNPATH for the TestFoundation binary. Any specific file that I need to look at and make changes for this?

---

<div class="post-metadata">

**Author:** ![spevans](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spevans](https://forums.swift.org/u/spevans)\
**Post date:** [February 13, 2019, 12:25pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/7 "2019-02-13T12:25:59Z")

</div>

The `libicu` would actually be loaded by either `libswiftCode.so` or `libFoundation.so`, so you would need to check the `RUNPATH` for those libraries.

I think the `libicu` libraries are being installed in the `powerpc64le` subdirectory which would match the location of the corresponding `x86_64` ones and these are installed by the `build-script-impl` when it builds the ICU libraries. ie on my x86\_64 Ubuntu I have:

```swift
$ find build/buildbot_linux/swift-linux-x86_64/ -name 'libicu*.so'
build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicudataswift.so
build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicui18nswift.so
build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicutestswift.so
build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicuucswift.so
build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/x86_64/libicutuswift.so

```

Could you check they are in that subdirectory?

If they are then we just need to determine why x86\_64 hosts are finding them in the x86\_64 directory not powerpc64le hosts are not finding the corresponding file.

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [February 13, 2019, 1:53pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/8 "2019-02-13T13:53:25Z")

</div>

Following are the ICU libraries built across the swift build directory:-

root@37e196fab451:~/swift-source# find build/buildbot\_linux/ -name 'libicu\*.so'  
build/buildbot\_linux/libicu-linux-powerpc64le/stubdata/libicudataswift.so  
build/buildbot\_linux/libicu-linux-powerpc64le/tools/ctestfw/libicutestswift.so  
build/buildbot\_linux/libicu-linux-powerpc64le/lib/libicuucswift.so  
build/buildbot\_linux/libicu-linux-powerpc64le/lib/libicudataswift.so  
build/buildbot\_linux/libicu-linux-powerpc64le/lib/libicutuswift.so  
build/buildbot\_linux/libicu-linux-powerpc64le/lib/libicui18nswift.so  
build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicuucswift.so  
build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicudataswift.so  
build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicutestswift.so  
build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicutuswift.so  
build/buildbot\_linux/swift-linux-powerpc64le/lib/swift/linux/powerpc64le/libicui18nswift.so

---

<div class="post-metadata">

**Author:** ![spevans](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@spevans](https://forums.swift.org/u/spevans)\
**Post date:** [February 13, 2019, 1:55pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/9 "2019-02-13T13:55:44Z")

</div>

I investigated further and I think the reason it works on x86\_64 Linux and not on powerpc64le is more by luck than design. None of the `RUNPATH`s for `TestFoundation`, `libswiftCore.so` or `libFoundation.so` actually contain the `x86_64` subdirectory:

```swift
$ readelf -aW build/buildbot_linux/foundation-linux-x86_64/TestFoundation/TestFoundation |grep RUNP
 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]

$ readelf -aW build/buildbot_linux/foundation-linux-x86_64/libFoundation.so |grep RUNPA
 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]

$ readelf -aW build/buildbot_linux/swift-linux-x86_64/lib/swift/linux/libswiftCore.so |grep RUNP
 0x000000000000001d (RUNPATH) Library runpath: [$ORIGIN:/usr/lib/swift/linux]

```

But I think the reason it still finds the ICU libraries in the `x86_64` subdirectory is due to a 'Hardware capabilities' check that `ld.so` does when it loads dynamic libraries and looks in an extra set of per cpu-arch defined subdirectories.

An `strace` when running the `TestFoundation` binary shows the extra subdirectories it checks:

```swift
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/tls/haswell/x86_64", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/tls/haswell", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/tls/x86_64", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/tls", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/haswell/x86_64", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/haswell", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64/x86_64", 0x7ffd944e2910) = -1 ENOENT (No such file or directory)
40311 stat("/home/spse/swift-source/build/buildbot_linux/xctest-linux-x86_64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0

```

Note also the `tls` and `haswell` directories.

This feature is designed so that per sub-architecture libraries can be used to use any specific features that the CPU.

So ultimately it means it runs on `x86_64` mostly by accident and `power64le` exposes this problem.

I know that @compnerd was working towards putting all of the shared libraries into a per-CPU directory, so that a swift distribution could be used for cross-compiling and building binaries for different architectures in one go. It may now be worth accelerating that change to solve your issue correctly. It would also affect other architectures as well.

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [March 11, 2019, 10:32am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/10 "2019-03-11T10:32:02Z")

</div>

Faced a similar issue for lldb test suites as well - "[Issues running lldb-Suite test cases while building Apple Swift 5 toolchain on PowerPC64LE - #15 by stamba](https://forums.swift.org/t/issues-running-lldb-suite-test-cases-while-building-apple-swift-5-toolchain-on-powerpc64le/21179/15)"

Used the 'llvm-readelf' utility to find details about the libraries linked with lldb binary and realised that the directories mentioned in RUNPATH might not have the required libraries.

Similar to reasons mentioned in my earlier issue "[TestFoundation test suite failing while building Swift Toolchain - #6 by stamba](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/6)", I manually copied the libraries and it worked. The lldb test suite was executed, though it fails now for only 7 test cases:-  
Failing Tests (7):  
LLDB :: SwiftREPL/ErrorReturn.test  
LLDB :: tools/lldb-mi/symbol/symbol-list-lines.test  
lldb-Suite :: lang/swift/dwarfimporter/C/TestSwiftDWARFImporterC.py  
lldb-Suite :: lang/swift/reference\_storage\_types/TestSwiftReferenceStorageTypes.py  
lldb-Suite :: lang/swift/repl\_in\_c/TestSwiftReplInC.py  
lldb-Suite :: lang/swift/unknown\_self/TestSwiftUnknownSelf.py  
lldb-Suite :: lang/swift/variables/swift/TestSwiftTypes.py

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [March 11, 2019, 10:33am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/11 "2019-03-11T10:33:02Z")

</div>

@spevans @compnerd any comments/inputs on the above?

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [March 11, 2019, 2:02pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/12 "2019-03-11T14:02:48Z")

</div>

Attached to this issue are the details of the final 7 failing lldb tests. - [[SR-9888] TestFoundation test suite failing while building Swift Toolchain · Issue #3541 · apple/swift-corelibs-foundation · GitHub](https://bugs.swift.org/browse/SR-9888)

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [March 11, 2019, 3:03pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/13 "2019-03-11T15:03:34Z")

</div>

IIRC, lldb relies on LD\_LIBRARY\_PATH For the tests so the RPATH isn't as important (though, that is something we aught to fix). It sounds like one of the paths being computed in build-script is incorrect if the libraries are failing to be found.

---

<div class="post-metadata">

**Author:** ![stamba](https://avatars.discourse-cdn.com/v4/letter/s/d26b3c/32.png) [@stamba](https://forums.swift.org/u/stamba)\
**Post date:** [March 12, 2019, 5:24am UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/14 "2019-03-12T05:24:31Z")

</div>

Hi @compnerd, I did try to set the LD\_LIBRARY\_PATH with all the relevant paths containing the libraries, however it did not work out. The manual copying of the libraries was the last resort that needed to be taken.

---

<div class="post-metadata">

**Author:** ![compnerd](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/compnerd/32/2165_2.png) [@compnerd](https://forums.swift.org/u/compnerd)\
**Post date:** [March 12, 2019, 3:44pm UTC](https://forums.swift.org/t/testfoundation-test-suite-failing-while-building-swift-toolchain/20279/15 "2019-03-12T15:44:37Z")

</div>

That really does sound like `LD_LIBRARY_PATH` is not setup properly. Note that setting it is insufficient, and that you need to set the correct variables for that to be threaded to the actual test invocation.
