colcon / colcon-ros

Extension for colcon to support ROS packages
http://colcon.readthedocs.io
Apache License 2.0
13 stars 26 forks source link

colcon segfault #94

Closed babakc closed 4 years ago

babakc commented 4 years ago

Getting a segfault for a build that works with catkin_make. Not sure where to go from here.

The package is https://github.com/machines-in-motion/mpi_cmake_modules

colcon --log-level 9 build

0.822s] DEBUG:colcon.colcon_core.event_handler.log_command:Invoking command in '/home/ubuntu/environment/simulation_ws/src/build/mpi_cmake_modules': /usr/bin/cmake /home/ubuntu/environment/simulation_ws/src/mpi_cmake_modules -DCATKIN_INSTALL_INTO_PREFIX_ROOT=0 -DCMAKE_INSTALL_PREFIX=/home/ubuntu/environment/simulation_ws/src/install/mpi_cmake_modules [4.481s] INFO:colcon.colcon_core.shell:Creating environment hook '/home/ubuntu/environment/simulation_ws/src/install/mpi_cmake_modules/share/mpi_cmake_modules/hook/ros_package_path.ps1' [4.481s] DEBUG:colcon.colcon_core.event_handler.log_command:Invoked command in '/home/ubuntu/environment/simulation_ws/src/build/mpi_cmake_modules' returned '-11': /usr/bin/cmake /home/ubuntu/environment/simulation_ws/src/mpi_cmake_modules -DCATKIN_INSTALL_INTO_PREFIX_ROOT=0 -DCMAKE_INSTALL_PREFIX=/home/ubuntu/environment/simulation_ws/src/install/mpi_cmake_modules

Trying to run it manually:

$ /usr/bin/cmake /home/ubuntu/environment/simulation_ws/src/mpi_cmake_modules -DCATKIN_INSTALL_INTO_PREFIX_ROOT=0 -DCMAKE_INSTALL_PREFIX=/home/ubuntu/environment/simulation_ws/src/install/mpi_cmake_modules -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Using CATKIN_DEVEL_PREFIX: /home/ubuntu/environment/simulation_ws/src/build/mpi_cmake_modules/devel -- Using CMAKE_PREFIX_PATH: /opt/ros/melodic -- This workspace overlays: /opt/ros/melodic -- Found PythonInterp: /usr/bin/python2 (found suitable version "2.7.15", minimum required is "2") -- Using PYTHON_EXECUTABLE: /usr/bin/python2 -- Using Debian Python package layout -- Using empy: /usr/bin/empy -- Using CATKIN_ENABLE_TESTING: ON -- Call enable_testing() -- Using CATKIN_TEST_RESULTS_DIR: /home/ubuntu/environment/simulation_ws/src/build/mpi_cmake_modules/test_results -- Found gmock sources under '/usr/src/googletest': gmock will be built -- Found PythonInterp: /usr/bin/python2 (found version "2.7.15") -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE
-- Found gtest sources under '/usr/src/googletest': gtests will be built -- Using Python nosetests: /usr/bin/nosetests-2.7 -- catkin 0.7.17 -- BUILD_SHARED_LIBS is on Segmentation fault (core dumped)

dirk-thomas commented 4 years ago

The CMake logic in the referenced package is broken. A macro calls itself recursively without aborting:

https://github.com/machines-in-motion/mpi_cmake_modules/blob/13ab14aefd981de9fb4b6a2171b15dcc19182e41/cmake/dg-dirs.cmake#L31-L50

You can easily check that by adding a message("find: ${CURRENT_DIR}") call to the beginning of the macro.

Please consider ticketing the problem in the repo containing that package.

To the question why does it not happen with catkin_make_isolated: the logic is looking for a devel directory which doesn't exist when using colcon. It should fail the same way when calling catkin_make_isolated --install in a clean workspace.