2

I have a project, which consists of C++ code and uses CMake as build system and above that uses the Catkin tool catkin_make to build the project. The thing is, it does or does not build depending on weather I use the build option -j as in catkin_make -j4. (working only for -j1) I googled/stackoverflowed already, but could not find out the meaning of this option.

I believe that -j is often also used in other C++/CMake projects not using Catkin, so maybe someone can give me an expaination.

Thanks!

avermaet
  • 1,543
  • 12
  • 33
  • 1
    `-j4` will consume more memory compared to `-j1`. Are you running out of memory with `-j4`? – ks1322 Sep 20 '19 at 10:51
  • Ok, great! I don't think it's catkin dependent anyway. Just wanted to state that as additional info. Thanks also for the gihub link. And no I don't think it is a memory issue. I got `Failed to build target 'all'` and `make -j2 -l2 failed`. Pretty cryptic because the makefiles get generated by catkin/CMake automatically. – avermaet Sep 20 '19 at 10:55
  • 1
    CMake-generated makefiles support `VERBOSE=1` for debugging, so try that in addition to `-j4`. – MSalters Sep 20 '19 at 11:36
  • @MSalters: Thanks! That was great advice. Enabled me to fix it. – avermaet Sep 20 '19 at 15:12

1 Answers1

4

At their github repository they say that the -j parameter is passed directly to the make command.

The -j (--jobs) and -l (--load-average) arguments for make are also extracted and passed to make directly

So -jN indicates the number of jobs run in parallel.

Carlos
  • 331
  • 6
  • 14