@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?