Exactly. The thing is, swift 5.2.1 from the download page works flawlessly whereas your provided deb package doesn't work at all. I'm trying to find out why. The -sdk, -I and -L flags got me one step further, now I am investigating the next error which is:
/usr/bin/ld.gold: error: cannot open Scrt1.o: No such file or directory
An strace of the swiftc from the deb package gives me the following (strace + grep Scrt):
[pid 51503] access("/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/lib/clang/10.0.0/Scrt1.o", F_OK) = -1 ENOENT (No such file or directory)
[pid 51503] access("/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/lib/clang/10.0.0/lib/linux/Scrt1.o", F_OK) = -1 ENOENT (No such file or directory)
[pid 51503] access("/Library/Developer/Toolchains/unknown-Asserts-development.xctoolchain/usr/bin/../Scrt1.o", F_OK) = -1 ENOENT (No such file or directory)
[pid 51503] access("/Library/Developer/Platforms/Linux.platform/Developer/SDKs/Linux.sdk/usr/lib/Scrt1.o", F_OK) = -1 ENOENT (No such file or directory)
[pid 51504] execve("/usr/bin/ld.gold", ["/usr/bin/ld.gold", "--sysroot=/Library/Developer/Pla"..., "-pie", "-z", "relro", "--hash-style=gnu", "--eh-frame-hdr", "-m", "elf_x86_64", "-dynamic-linker", "/lib64/ld-linux-x86-64.so.2", "-o", "bla", "Scrt1.o", "crti.o", "crtbeginS.o", "-L/Library/Developer/Platforms/L"..., "-L/Library/Developer/Platforms/L"..., "-L/Library/Developer/Platforms/L"..., "-L/Library/Developer/Platforms/L"..., "-rpath", "/Library/Developer/Platforms/Lin"..., "-rpath", "/Library/Developer/Platforms/Lin"..., "/Library/Developer/Platforms/Lin"..., "/tmp/bla-fb5b35.o", "-lswiftSwiftOnoneSupport", "-lswiftCore", "-lswiftCore", "-lgcc", "--as-needed", "-lgcc_s", ...], 0x7ffcc77bd070 /* 56 vars */ <unfinished ...>
[pid 51504] openat(AT_FDCWD, "Scrt1.o", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)
[pid 51504] write(2, "cannot open Scrt1.o: No such fil"..., 46 <unfinished ...>
[pid 51499] read(3, "cannot open Scrt1.o: No such fil"..., 1024) = 47
write(2, "/usr/bin/ld.gold: error: cannot "..., 664/usr/bin/ld.gold: error: cannot open Scrt1.o: No such file or directory
Which makes me think swiftc is looking for Scrt1.o in the wrong places and then hands the filename without an absolute path to ld.gold (unlike the working clang does).
Right?