We thought about a performance (RAM) problem, so we ugraded machine, the env var for RAM, disabling parallel compiling, and try lxd without success. (but maybe we did it wrong)
The actual behavior is part of the library gets compiled, then it kind of becomes very slow, then compiler fails. Restarting the process will build a bit more objects of the library then fail again.
Any ideas ? snapcraft --debug did not give any output except "Failed to run ‘cmake --build . – -j2’ : exited with code 2.
Verify that the part is using the correct aprameters and try again
Explanation : Ubuntu by default not having a real root account but a sudo user system, providing an env variable is a bit more tricky, using the -E option will take care of this.
If it works snapcraft should display a message saying that the user changed the amount of RAM allocated to the VM.
WARNING :
Here is a solution and workaround for doing sudo snapcraft, but you should not use snapcraft with sudo in the first place.