0
$\begingroup$

Rosanswers logo

I have a workaround as below but installing a pkg with a package manager (e.g. apt) is supposed to be avoided by design of catkin (and many other packages packaged on ros.org) IMO, so I want to know a perm fix.

Issue

On a ROS melodic Docker image I just pulled, catkin build and catkin_make fails.

$ docker pull ros:melodic-ros-core
melodic-ros-core: Pulling from library/ros
Digest: sha256:9b03709d6c54ab97d50a1b99d3d00878071189aa2e7bf7faf3daac1c055bedc3
Status: Image is up to date for ros:melodic-ros-core
docker.io/library/ros:melodic-ros-core

$ DIR=/cws && mkdir -p $DIR/src && cd $DIR
$ apt update && apt install -y git python-catkin-tools
$ cd $DIR/src && git clone https://github.com/ros/std_msgs && cd $DIR
$ catkin init && catkin config --install
$ catkin build

:

Errors     << catkin_tools_prebuild:cmake /cws/logs/catkin_tools_prebuild/build.cmake.000.log                                                                                                                                                
CMake Error at /cws/build/catkin_tools_prebuild/CMakeLists.txt:2 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at /cws/build/catkin_tools_prebuild/CMakeLists.txt:2 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.

catkin_make

root@05c38516bda3:/cws# rm -fr build/ devel/ logs/ 
root@05c38516bda3:/cws# catkin_make
Base path: /cws
Source space: /cws/src
Build space: /cws/build
Devel space: /cws/devel
Install space: /cws/install
Creating symlink "/cws/src/CMakeLists.txt" pointing to "/opt/ros/melodic/share/catkin/cmake/toplevel.cmake"
####
#### Running command: "cmake /cws/src -DCATKIN_DEVEL_PREFIX=/cws/devel -DCMAKE_INSTALL_PREFIX=/cws/install -G Unix Makefiles" in "/cws/build"
####
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:6 (project):
  No CMAKE_C_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CC" or the CMake cache entry CMAKE_C_COMPILER to the full path to
  the compiler, or to the compiler name if it is in the PATH.


CMake Error at CMakeLists.txt:6 (project):
  No CMAKE_CXX_COMPILER could be found.

  Tell CMake where to find the compiler by setting either the environment
  variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
  to the compiler, or to the compiler name if it is in the PATH.


-- Configuring incomplete, errors occurred!
See also "/cws/build/CMakeFiles/CMakeOutput.log".
See also "/cws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed

Workaround worked

Same as https://answers.ros.org/question/294883/catkin_make-error-melodic/, installing build-essential apt pkg seems to bypass this.

Env

# apt-cache policy ros-melodic-catkin
ros-melodic-catkin:
  Installed: 0.7.29-1bionic.20201014.191449
  Candidate: 0.7.29-1bionic.20201014.191449
  Version table:
 *** 0.7.29-1bionic.20201014.191449 500
        500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

# apt-cache policy python-catkin-tools
python-catkin-tools:
  Installed: 0.6.1-1
  Candidate: 0.6.1-1
  Version table:
 *** 0.6.1-1 500
        500 http://packages.ros.org/ros/ubuntu bionic/main amd64 Packages
        100 /var/lib/dpkg/status

Originally posted by 130s on ROS Answers with karma: 10937 on 2021-08-19

Post score: 0


Original comments

Comment by gvdhoorn on 2021-08-20:\

but installing a pkg with a package manager (e.g. apt) is supposed to be avoided by design of catkin

What do you mean exactly be this?

Comment by 130s on 2021-08-20:
Answering to your question a bit differently though, what I wanted was to know if there's a way to avoid running apt to fill the requirement for Catkin. Then with your answer, and with the Melodic install wiki http://wiki.ros.org/melodic/Installation/Source, I realized build-essential is not even in Catkin's dependency tree. Problem solved.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

For some time now, the "base" ROS Docker images have not shipped with any build-related packages.

This is on purpose, as it significantly reduces the size of the images, and those build dependencies are not used when you "just want to run ROS".

I'll try to find the announcement and link it here, but I thought I'd first post the answer.


Edit: from Announcement: trimmed ROS/Gazebo docker images released:

  • The ros-core images do not include the ROS bootstrapping / building tools anymore (removal of rosdep , rosinstall , colcon packages for ROS 2) these packages will now be part of the generic base image, aka ros:<ROS_DISTRO> or ros:<ROS_DISTRO>-ros-base
  • this means that images based on ros:<ROS_DISTRO>-ros-core images do not have compilers installed by default anymore. If you use those in CI you’ll need to make sure to install the building tools you need or use the ros-base (aka default) image. You can see the diff on the ros_core images here
  • the osrf/ros2:devel image including all the building and testing tools for ROS 2 can/should be used as a base for ROS 2 CI
  • there is currently no ROS 1 equivalent to the osrf/ros2:devel image. But we're happy to explore how to make this available if there is interest

You seem to use the ros:<ROS_DISTRO>-ros-core image, which is why CMake can't find the compiler.

Note btw:

catkin fails with "No CMAKE_CXX_COMPILER could be found."

CMake fails. Not Catkin.


Originally posted by gvdhoorn with karma: 86574 on 2021-08-20

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.