make fails on AWS Lightsail

Trying to install on Ubuntu 18.04, got the following error:

2302 verbose stack Error: mediasoup@3.2.5 postinstall: `make -C worker`
2302 verbose stack Exit status 2
2302 verbose stack     at EventEmitter.<anonymous> (/root/.nvm/versions/node/v8.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
2302 verbose stack     at emitTwo (events.js:126:13)
2302 verbose stack     at EventEmitter.emit (events.js:214:7)
2302 verbose stack     at ChildProcess.<anonymous> (/root/.nvm/versions/node/v8.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
2302 verbose stack     at emitTwo (events.js:126:13)
2302 verbose stack     at ChildProcess.emit (events.js:214:7)
2302 verbose stack     at maybeClose (internal/child_process.js:915:16)
2302 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
2303 verbose pkgid mediasoup@3.2.5
2304 verbose cwd /var/conference/server
2305 verbose Linux 4.15.0-1045-aws
2306 verbose argv "/root/.nvm/versions/node/v8.16.1/bin/node" "/root/.nvm/versions/node/v8.16.1/bin/npm" "install" "mediasoup@3" "--save"
2307 verbose node v8.16.1
2308 verbose npm  v6.4.1
2309 error code ELIFECYCLE
2310 error errno 2
2311 error mediasoup@3.2.5 postinstall: `make -C worker`
2311 error Exit status 2
2312 error Failed at the mediasoup@3.2.5 postinstall script.
2312 error This is probably not a problem with npm. There is likely additional logging output above.
2313 verbose exit [ 2, true ]

No idea with those logs. Enter the mediasoup/worker folder and run make and let’s see.

...
CXX(target) /var/conference/server/node_modules/mediasoup/worker/out/Release/obj.target/mediasoup-worker/src/RTC/Router.o
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-7/README.Bugs> for instructions.
mediasoup-worker.target.mk:223: recipe for target '/var/conference/server/node_modules/mediasoup/worker/out/Release/obj.target/mediasoup-worker/src/RTC/Router.o' failed
make[1]: *** [/var/conference/server/node_modules/mediasoup/worker/out/Release/obj.target/mediasoup-worker/src/RTC/Router.o] Error 4
make[1]: Leaving directory '/var/conference/server/node_modules/mediasoup/worker/out'
Makefile:22: recipe for target 'default' failed
make: *** [default] Error 2

Honestly no idea. Ensure you are using all installation requirements:

BTW it seems to be related to lack of RAM or SWAP memory:

https://stackoverflow.com/questions/30887143/make-j-8-g-internal-compiler-error-killed-program-cc1plus, but that’s just a fast search in Google I’ve done right now.

Yeah makes sense, it has just 512 MB of RAM :frowning_face:

Opps…

The free plan of AWS Lightsail has only 512 MB of RAM which is very low.
I could get around the issue using this trick:

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
sudo mkswap /swapfile
sudo swapon /swapfile

After compiling, you may wish to

sudo swapoff /swapfile
sudo rm /swapfile
1 Like