Skip to content

fix: set parallelism buildopts

Letting parallelism go it's way in a docker container might break the compiling process if the host has a large number of cores. The kernel will kill the compiling because it starts to eat away all the memory. For example:

+ cd _build/cmake
+ type cmake3
+ CMAKE=cmake
+ getconf _NPROCESSORS_ONLN
+ CORES=36
+ [ x36 = x ]
+ PAR=-- -j 36
+ cmake --build . -- -j 36

Seen https://circleci.com/gh/omisego/elixir-omg/5811 The documentation points to ERLANG_ROCKSDB_BUILDOPTS variable, by passing -j or -j N. That caused:

+ cd _build/cmake
+ type cmake3
+ CMAKE=cmake
+ getconf _NPROCESSORS_ONLN
+ CORES=36
+ [ x36 = x ]
+ PAR=-- -j 36
+ cmake --build . -j 2 -- -j 36
Unknown argument -j
Unknown argument 2

So the fix in this PR is basically just checking if the -j argument is present and takes precedence over checking the number of cores and deriving parallelism from it.

Merge request reports