Deno's Build Requirements are 16GiB RAM, but I'm Determined to Build It with 8GiB
Hello, it's me, the incompetent one.
When I tried to tinker with it myself and build it,
error: linking with `cc` failed: exit status: 1
appeared, and the compilation failed.
Normally, this seems to be an error that occurs when the linker is doing something, but I couldn't find anything when I searched for it.
The answer is in syslog
Well, I was building it by connecting via SSH to my home server's Devuan machine, but that didn't work either.
Then, by chance, I had the Devuan machine's screen outputting to a monitor, and for some reason, the error output was... OOM Killer?
$ sudo cat /var/log/syslog | grep "Out of memory"
Oct 13 11:50:16 localhost kernel: [227399.170721] Out of memory: Killed process 8309 (ld) total-vm:2711000kB, anon-rss:2682476kB, file-rss:1608kB, shmem-rss:0kB, UID:1000 pgtables:5352kB oom_score_adj:0
Oct 13 12:38:52 localhost kernel: [230315.610776] Out of memory: Killed process 9472 (ld) total-vm:2883664kB, anon-rss:2872404kB, file-rss:1468kB, shmem-rss:0kB, UID:1000 pgtables:5704kB oom_score_adj:0
Oct 13 16:34:15 localhost kernel: [244437.896036] Out of memory: Killed process 9979 (ld) total-vm:2195452kB, anon-rss:2187944kB, file-rss:1604kB, shmem-rss:0kB, UID:1000 pgtables:4348kB oom_score_adj:0
$ date
October 13, 2024 Sunday 16:48:12 JST
It seems that there isn't enough memory, and the process launched for compilation is being killed, so it's not going through.
I had already opened an issue,
cargo test -vv faild on Arch/Artix Linux #26191
Although it wasn't written in the requirements for building from the official source, the minimum build requirement seems to be 16GiB of RAM...
When I tried building it on my custom-built PC with nearly 40GiB of RAM, it passed...
No Matter What, I Want to Compile Deno in an 8GiB RAM Environment!!
Ultimately, if I just want to get the deno binary to compile, as I was told in the issues,
cargo build -p deno --bin deno
seems to be fine, but even this often doesn't work.
So, I searched for a way to reduce memory usage...
CARGO_BUILD_JOBS=1 cargo build -p deno --bin deno -j 1
It's probably slow, but if you build it normally once, and then run the above command after OOM Killer occurs, it will use the cache to build, so it will finish relatively quickly.
By limiting the build jobs to one and using one CPU thread for compilation, it minimizes the impact on other running processes while compiling. I think this is a pretty good environment variable/option specification, even if it's a bit humble. It's slow, though...
See you again.
Best regards.