I prepared a minimal example:
build-wrapper.zip (645.2 KB)
In order to trigger the issue install a Ubuntu (e.g. 20.10) inside a VirtualBox VM (leaving options at default, I only increased RAM to 8GB and number of processors to 4)
Then extract build-wrapper.zip in /tmp/sonarqube and run:
$> ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sq ./ld-linux-x86-64.so.2 ./col
ERROR: ld.so: object '/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
./col: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
I hope the missing shared objects from the tool-chain (“error while loading shared libraries: libc.so.6”) are not a problem. If you need the whole tool-chain (which is ~1GB) please let me know.
Running with strace produces:
$> strace -f -E LD_DEBUG=all ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sq ./ld-linux-x86-64.so.2 ./col 2>&1 | grep -e "openat(" -e LD_PRELOAD
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "sq", O_RDONLY) = 3
openat(AT_FDCWD, "sq", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/tmp/build-wrapper-socket.AwE0PB", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
openat(AT_FDCWD, "sq/build-wrapper.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-i686.so", O_RDONLY) = 4
openat(AT_FDCWD, "/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-x86_64.so", O_RDONLY) = 4
openat(AT_FDCWD, "/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-haswell.so", O_RDONLY) = 4
[pid 2767] openat(AT_FDCWD, "/tmp/build-wrapper-socket.AwE0PB", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 2767] openat(AT_FDCWD, "sq/build-wrapper-dump.json", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
[pid 2769] openat(AT_FDCWD, "/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-x86_64.so", O_RDONLY|O_CLOEXEC) = 4
[pid 2769] openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
[pid 2769] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 4
[pid 2769] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 4
[pid 2769] write(4, "LD_PRELOAD=", 11 <unfinished ...>
[pid 2767] <... read resumed> "LD_PRELOAD=", 11) = 11
[pid 2770] openat(AT_FDCWD, "./col", O_RDONLY|O_CLOEXEC) = 4
[pid 2770] openat(AT_FDCWD, "", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 2770] writev(2, [{iov_base="ERROR: ld.so: object '", iov_len=22}, {iov_base="/tmp/sonarqube/build-wrapper-lin"..., iov_len=68}, {iov_base="' from ", iov_len=7}, {iov_base="LD_PRELOAD", iov_len=10}, {iov_base=" cannot be preloaded (", iov_len=22}, {iov_base="cannot open shared object file", iov_len=30}, {iov_base="): ignored.\n", iov_len=12}], 7ERROR: ld.so: object '/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-${PLATFORM}.so' from LD_PRELOAD cannot be preloaded (cannot open shared object file): ignored.
[pid 2770] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 2770] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 2770] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 2770] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 2770] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
When not running inside the VM (but also on a Ubuntu 20.10 system) libinterceptor-haswell.so gets loaded and there is no LD_PRELOAD error:
$> strace -f -E LD_DEBUG=all ./build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sq ./ld-linux-x86-64.so.2 ./col 2>&1 | grep -e "openat(" -e LD_PRELOAD
openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
openat(AT_FDCWD, "sq", O_RDONLY) = 3
openat(AT_FDCWD, "sq", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 3
openat(AT_FDCWD, "/tmp/build-wrapper-socket.KBmHYg", O_RDWR|O_CREAT|O_EXCL, 0600) = 3
openat(AT_FDCWD, "sq/build-wrapper.log", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 3
openat(AT_FDCWD, "/etc/localtime", O_RDONLY|O_CLOEXEC) = 4
openat(AT_FDCWD, "/home/vogtlaender/dev/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-i686.so", O_RDONLY) = 4
openat(AT_FDCWD, "/home/vogtlaender/dev/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-x86_64.so", O_RDONLY) = 4
openat(AT_FDCWD, "/home/vogtlaender/dev/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-haswell.so", O_RDONLY) = 4
[pid 1949249] openat(AT_FDCWD, "/tmp/build-wrapper-socket.KBmHYg", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 1949249] openat(AT_FDCWD, "sq/build-wrapper-dump.json", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 4
[pid 1949250] openat(AT_FDCWD, "/home/vogtlaender/dev/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-haswell.so", O_RDONLY|O_CLOEXEC) = 4
[pid 1949250] openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 4
[pid 1949250] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 4
[pid 1949250] openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libdl.so.2", O_RDONLY|O_CLOEXEC) = 4
[pid 1949250] write(4, "LD_PRELOAD=", 11 <unfinished ...>
[pid 1949249] <... read resumed>"LD_PRELOAD=", 11) = 11
[pid 1949251] openat(AT_FDCWD, "./col", O_RDONLY|O_CLOEXEC) = 4
[pid 1949251] openat(AT_FDCWD, "/home/vogtlaender/dev/tmp/sonarqube/build-wrapper-linux-x86/libinterceptor-haswell.so", O_RDONLY|O_CLOEXEC) = 4
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/tls/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/tls/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/haswell/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/usr/lib/libc.so.6", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 1949251] openat(AT_FDCWD, "/opt/angstrom/2017.01/sysroots/x86_64-slvsdk-linux/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)