moveit / moveit2_tutorials

A sphinx-based centralized documentation repo for MoveIt 2
https://moveit.picknik.ai
BSD 3-Clause "New" or "Revised" License
146 stars 190 forks source link

High RAM usage during colcon build #899

Closed matteogrechi closed 2 weeks ago

matteogrechi commented 3 months ago

Description

I'm working in WSL with 3.74GiB of RAM and 1GiB of swap (Neither I cannot add more RAM to the machine nor increase the swap partition). Whenever I try to compile the source the compiler gets killed, e.g.:

c++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
gmake[2]: *** [src/CMakeFiles/moveit_task_constructor_core.dir/build.make:174: src/CMakeFiles/moveit_task_constructor_core.dir/storage.cpp.o] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:256: src/CMakeFiles/moveit_task_constructor_core.dir/all] Error 2

I checked and both the RAM and the swap gets fully saturated. My questions are:

  1. Is there a way to tell the compiler to launch less threads (--parallel-workers 1 it's not enough)?
  2. Is it possible to provide a version working with pre-build binaries?

Environment

Steps to reproduce

Run colcon build --mixin release --parallel-workers 1

Thank you very much!

matteogrechi commented 3 months ago

Possible solution to question number 1:

Before running colcon build, set the MAKEFLAGS environment variable to j1:

export MAKEFLAGS=-j1
colcon build --mixin release --parallel-workers 1

Sources: