I am unable to build Swift 4.2 on either Ubuntu 16.04 or 18.04. I keep on getting clang linker error:
On 18.04:
clang --version
clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
FAILED: bin/clang-6.0
....
clang: error: unable to execute command: Killed
clang: error: linker command failed due to signal (use -v to see invocation)
On 16.04:
clang --version
clang version 3.8.0-2ubuntu4 (tags/RELEASE_380/final)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
...
clang: error: unable to execute command: Killed
clang: error: linker command failed due to signal (use -v to see invocation)
I did git checkout swift-4.2-branch to obtain 4.2
Let me know if this is a known issue and if there are workarounds to address it.
so (especially if this is in Docker) it might be the OOM (out of memory) Killer killing your process. Linking can be quite memory intensive and Docker containers often have no swap so it the linking consumes more memory than available, you'd get something like that.
You could check dmesg | grep -i 'killed process' or similar to see if there's any signs of the OOM killer doing its job.
The linker is using too much memory. Killing Chrome and all other memory hungry applications and running the build script with "-j 1" works for me with 8GB of RAM. You can just continue building after that error, then kill the build after clang has been linked, and continue with "-j 4" or "-j 8" (or just without it like before).