I got a virtual server with Ubuntu 18.04 and followed the installation instruction on the Download page. Swift REPL works fine, I can also compile Swift code with swiftc main.swift, for example. But when I run swift build in a package folder (or anywhere else):
$ swift build
error: toolchain is invalid: could not find the `swiftc` at expected path /home/pbouda/swift/usr/bin/swiftc
The swiftc command is definitely in this location and I can use it to compile single files. I tried Swift 5.1 and 5.1.1. What could go wrong here? Can I debug this further somehow?
Which kernel version are you using (uname -a) as statx should be supported on Ubuntu18.04. I did a quick strace of a package build on Ubuntu18.04 and see statx working:
Linux domain.example.com 4.15.0 #1 SMP Thu Jun 27 15:10:55 MSK 2019 x86_64 x86_64 x86_64 GNU/Linux
Might it be related to the virtualization? I found that seccomp might be a problem with containers that run code that calls statx, statx was added at some point:
Maybe an outdated seccomp on the system that runs my virtual server?
That could be the issue. The kernel version looks fine since statx was added in 4.11. I don't know about libseccomp, Im running under VMware Fusion but don't normally have any restrictions like that.
What VM are you running Linux under? As you say it might just be a case of updating to the latest version, possibly an apt-get update , apt-get upgrade could fix it?
Yeah. That's it. I believe your hoster modified kernel and removed statx function. The fix for this will probably be to patch Foundation framework by excluding statx and restoring old stat call. Of course, we can notify our providers but I don't think they will change something.
There was already a mechanism to fallback to lstat() if statx() returned EPERM, I have done a PR to update it to include ENOSYS. This was originally added due to libseccomp so maybe the return errno for blocked system calls was changed from EPERM to ENOSYS.
Nice, hope that it will be merged soon! I tried to contact my hoster, but they did not really understand the problem, and there is no simple way to have a communication with them. I don’t think they will update anything.