I am trying to use multipass to spawn a build environment, the source code being on the host machine. The idea is that I would mount the source code from the host into the VM and then run the build from inside the VM. (multipass mount src ubuntu:/home/ubuntu/src
).
What I am trying to build is a relatively large c++ project with lots of include files. The build system is CMake + ninja and clang 8.0.
The problem is that the build fails with "file not found" errors for various headers. Each time the "missing" file is different. I say "missing" because the files are all actually there.
This seemed exactly the same as Intermittent, random 'file not found' errors under Windows Subsystem for Linux (WSL), but using the suggested workaround did not help (e.g. I tried setting -j1 in ninja).
Any idea of what could be causing this and if there is a workaround?
My host machine is a macOS Catalina and the multipass VM instance is a Ubuntu 20.10. multipass itself is 1.5.0.
I ended up opening a PR to the multipass team. After some debugging, we uncovered two problems:
maxfiles
limit of 256, which can be hit when compiling large projects.libssh
, which is used by multipass to do the mounts.To workaround this, you need to:
maxfiles
limit in macOS by e.g. following thisosxfuse
in macOS, (2) Enable Remote login in Settings -> Sharing and (3) in the VMmkdir <mount_dir>
sshfs <host_user>@<host_ip>:<host_directory> <mount_dir>