Skip to content

cmake only runs make single-threaded (-j1) #290

@arwedus

Description

@arwedus

Problem:

When I run the cmake pypi package version from catkin,
I get the following warning in the logs:

make: warning: jobserver unavailable: using -j1. Add '+' to parent make rule. which means nothing is built in parallel.

Also, CMake calls make with -j1, and the build is thus single-threaded.

Expected behavior:

cmake runs with job setting from catkin, which would result in a multi-threaded build (-j12).
This is what happens when using a CMake .deb package installation.

Analysis:

This only occurs when CMake is installed via pip. The problem with that is that in this case the entrypoint to CMake (/usr/local/bin/cmake) is a Python file which then subprocess.calls the actual CMake binary. However, since Python 3.2, file descriptors are not forwarded to child processes anymore by default and therefore the real CMake (and therefore also make) cannot access catkin's make jobserver and defaults to -j1. (see: https://docs.python.org/3/library/subprocess.html "Changed in version 3.2: The default for close_fds was changed from False to what is described above.". )

System:

  • Ubuntu 20.04 LTS
  • catkin_tools 0.8.5
  • Python 3.8.10 (default, Jun 22 2022, 20:18:18) [GCC 9.4.0]
  • cmake==3.23.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions