vapor/vapor

Trying to build on Ubuntu 20 with swift run and getting Building for debugging... error: emit-module command failed due to signal 9

bhartsb opened this issue · 2 comments

Describe the bug

Trying to build on Ubuntu 20 (1GB RAM) with swift run and getting Building for debugging... error: emit-module command failed due to signal 9

To Reproduce

create a project.
swift run

Expected behavior

I expect to see the Hello world app.

Environment

  • Vapor Framework version: 4.92.0
  • Vapor Toolbox version: main (d0714fd)
  • OS version: Ubuntu 20

Additional context

Add any other context about the problem here.

You're running out of memory during the build. Make sure you're using Swift 5.9.2, as some of the fixes for that problem aren't in previous versions, and if that doesn't help, increase your RAM to at least 2GB. If you can't, there are some additional workarounds, but 1GB is not really enough for doing builds. (For actually running your app, much less memory is usually needed - it's only the build that requires so much.)

1GB seems to not be enough memory to build. Not sure why it is defaulting to "Building for debugging...". Probably that is increasing the memory requirements.

To build the swap (thanks ChatGPT4):
sudo fallocate -l 4G /swapfile

Pasted Graphic

Then:
sudo swapon --show