0

During using cc linker and cargo, I am repeatedly running into:

  = note: collect2: fatal error: ld terminated with signal 9 [Killed]
          compilation terminated.

My VM has 4 gb of ram allocated to it, 14 gb free space, and set vm.overcommit_memory = 2 (0 was tried originally), yet this error persists. This is during the installation of the Solana SDK, the component that is failing in cargo due to cc linker is only 212K large. Why is this getting killed?

kmdreko
  • 42,554
  • 6
  • 57
  • 106
Random
  • 13
  • 3

2 Answers2

2

Be sure to make use of the --jobs parameter in cargo build and cargo test. Even high-spec machines can run out of memory while compiling parts of the Solana codebase, so restricting the number of jobs can help keep the memory usage from going over the machine's limit.

To start, you should try:

cargo build --jobs 1

If that still fails, then you'll a machine with more memory.

Jon C
  • 7,019
  • 10
  • 17
0

Make sure you can run

cargo new app
cd app
cargo build

If this is failing as a baseline, I would suggest removing the VM and trying to run from WSL

azuldev
  • 570
  • 6
  • 10