Robotics StackExchange | Archived questions

catkin build can't find catkinconfig.cmake during cross compile to raspberry pi 3

Hi,

I've followed this tutorial to set up a cross compilation chain to a raspberry pi 3B on Ubuntu Mate 16.04. I've got to the step of the first compilation with catkin build.

When I compile from a clean workspace and freshly extended (catkin clean && unset CMAKE_PREFIX_PATH && catkin config --extend $PWD/arm_raspberry/opt/ros/kinetic). This is the error I get :

CMake Error at /home/user/catkin_ws/arduino-robot/CMakeLists.txt:10 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "catkin", but CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set "catkin_DIR" to a directory containing one of the above files.  If "catkin" provides a separate development package or SDK, be sure it has been installed.

And here is the complete log of the build (unrelevant path are deleted as well) :

user@hostname:/home/user/catkin_ws/$ catkin build -j4 --cmake-args -DCMAKE_TOOLCHAIN_FILE=$PWD/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=$PWD/arm_raspberry
python: can't open file '/share/rosjava_build_tools/generate_environment_variables.py': [Errno 2] No such file or directory
python: can't open file '/share/rosjava_build_tools/generate_environment_variables.py': [Errno 2] No such file or directory
python: can't open file '/share/rosjava_build_tools/generate_environment_variables.py': [Errno 2] No such file or directory
-------------------------------------------------------------------------------------------------------------
Profile:                     default
Extending:        [explicit] /home/user/catkin_ws/arm_raspberry/opt/ros/kinetic
Workspace:                   /home/user/catkin_ws
-------------------------------------------------------------------------------------------------------------
Build Space:        [exists] /home/user/catkin_ws/build
Devel Space:        [exists] /home/user/catkin_ws/devel
Install Space:      [unused] /home/user/catkin_ws/install
Log Space:         [missing] /home/user/catkin_ws/logs
Source Space:       [exists] /home/user/catkin_ws/src
DESTDIR:            [unused] None
-------------------------------------------------------------------------------------------------------------
Devel Space Layout:          linked
Install Space Layout:        None
-------------------------------------------------------------------------------------------------------------
Additional CMake Args:       -DCMAKE_TOOLCHAIN_FILE=/home/user/catkin_ws/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=/home/user/catkin_ws/arm_raspberry
Additional Make Args:        -j4
Additional catkin Make Args: None
Internal Make Job Server:    True
Cache Job Environments:      False
-------------------------------------------------------------------------------------------------------------
Whitelisted Packages:        None
Blacklisted Packages:        None
-------------------------------------------------------------------------------------------------------------
Workspace configuration appears valid.

NOTE: Forcing CMake to run for each package.
-------------------------------------------------------------------------------------------------------------
[build] Found '18' packages in 0.0 seconds.                                                                 
[build] Updating package table.                                                                             
Starting  >>> catkin_tools_prebuild                                                                         
Finished  <<< catkin_tools_prebuild                [ 5.0 seconds ]                                          
Starting  >>> arduino-robot                                                                               
Starting  >>> auv-autopilot                                                                                 
Starting  >>> ev-attopilot                                                                                  
Starting  >>> ev-carriage                                                                                   
____________________________________________________________________________________________________________
Errors     << ev-carriage:cmake /home/user/catkin_ws/logs/ev-carriage/build.cmake.000.log
CMake Error at /home/user/catkin_ws/src/EVs/ev-carriage/CMakeLists.txt:15 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.


cd /home/user/catkin_ws/build/ev-carriage; catkin build --get-env ev-carriage | catkin env -si  /usr/bin/cmake /home/user/catkin_ws/src/EVs/ev-carriage --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel/.private/ev-carriage -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -DCMAKE_TOOLCHAIN_FILE=/home/user/catkin_ws/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=/home/user/catkin_ws/arm_raspberry; cd -
............................................................................................................
Failed     << ev-carriage:cmake                    [ Exited with code 1 ]                                   
Failed    <<< ev-carriage                          [ 6.0 seconds ]                                          
Abandoned <<< ev-gps                               [ Unrelated job failed ]                                 
Abandoned <<< ev-info-light                        [ Unrelated job failed ]                                 
Abandoned <<< ev-ms5837                            [ Unrelated job failed ]                                 
Abandoned <<< ev-robot-payload                   [ Unrelated job failed ]                                 
Abandoned <<< ev-waterleakage                      [ Unrelated job failed ]                                 
Abandoned <<< linop-interface                      [ Unrelated job failed ]                                 
Abandoned <<< navigation                           [ Unrelated job failed ]                                 
Abandoned <<< pwmboard_msgs                        [ Unrelated job failed ]                                 
Abandoned <<< sbg_driver                           [ Unrelated job failed ]                                 
Abandoned <<< vehicule-management                  [ Unrelated job failed ]                                 
Abandoned <<< robot                              [ Unrelated job failed ]                                 
Abandoned <<< ev-honeywell-40pc                    [ Unrelated job failed ]                                 
Abandoned <<< ev-pwm-adafruit                      [ Unrelated job failed ]                                 
Abandoned <<< ev-thrusters                         [ Unrelated job failed ]                                 
____________________________________________________________________________________________________________
Errors     << auv-autopilot:cmake /home/user/catkin_ws/logs/auv-autopilot/build.cmake.000.log
CMake Error at /home/user/catkin_ws/src/GNC/auv-autopilot/CMakeLists.txt:10 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.


cd /home/user/catkin_ws/build/auv-autopilot; catkin build --get-env auv-autopilot | catkin env -si  /usr/bin/cmake /home/user/catkin_ws/src/GNC/auv-autopilot --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel/.private/auv-autopilot -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -DCMAKE_TOOLCHAIN_FILE=/home/user/catkin_ws/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=/home/user/catkin_ws/arm_raspberry; cd -
............................................................................................................
Failed     << auv-autopilot:cmake                  [ Exited with code 1 ]                                   
Failed    <<< auv-autopilot                        [ 6.0 seconds ]                                          
____________________________________________________________________________________________________________
Errors     << ev-attopilot:cmake /home/user/catkin_ws/logs/ev-attopilot/build.cmake.000.log
CMAKE_PREFIX_PATH=/home/user/catkin_ws/arm_raspberry/kinetic;/home/user/catkin_ws/arm_raspberry/usr
CMake Error at /home/user/catkin_ws/src/EVs/ev-attopilot/CMakeLists.txt:11 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.


cd /home/user/catkin_ws/build/ev-attopilot; catkin build --get-env ev-attopilot | catkin env -si  /usr/bin/cmake /home/user/catkin_ws/src/EVs/ev-attopilot --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel/.private/ev-attopilot -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -DCMAKE_TOOLCHAIN_FILE=/home/user/catkin_ws/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=/home/user/catkin_ws/arm_raspberry; cd -
............................................................................................................
Failed     << ev-attopilot:cmake                   [ Exited with code 1 ]                                   
Failed    <<< ev-attopilot                         [ 6.1 seconds ]                                          
____________________________________________________________________________________________________________
Errors     << arduino-robot:cmake /home/user/catkin_ws/logs/arduino-robot/build.cmake.000.log
CMake Error at /home/user/catkin_ws/src/EVs/arduino-robot/CMakeLists.txt:10 (find_package):
  By not providing "Findcatkin.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "catkin", but
  CMake did not find one.

  Could not find a package configuration file provided by "catkin" with any
  of the following names:

    catkinConfig.cmake
    catkin-config.cmake

  Add the installation prefix of "catkin" to CMAKE_PREFIX_PATH or set
  "catkin_DIR" to a directory containing one of the above files.  If "catkin"
  provides a separate development package or SDK, be sure it has been
  installed.


cd /home/user/catkin_ws/build/arduino-robot; catkin build --get-env arduino-robot | catkin env -si  /usr/bin/cmake /home/user/catkin_ws/WS_robot/src/EVs/arduino-robot --no-warn-unused-cli -DCATKIN_DEVEL_PREFIX=/home/user/catkin_ws/devel/.private/arduino-robot -DCMAKE_INSTALL_PREFIX=/home/user/catkin_ws/install -DCMAKE_TOOLCHAIN_FILE=/home/user/catkin_ws/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=/home/user/catkin_ws/arm_raspberry; cd -
............................................................................................................
Failed     << arduino-robot:cmake                [ Exited with code 1 ]                                   
Failed    <<< arduino-robot                      [ 6.1 seconds ]                                          
[build] Summary: 1 of 19 packages succeeded.                                                                
[build]   Ignored:   None.                                                                                  
[build]   Warnings:  None.                                                                                  
[build]   Abandoned: 14 packages were abandoned.                                                            
[build]   Failed:    4 packages failed.                                                                     
[build] Runtime: 11.5 seconds total.                                                                        
[build] Note: Workspace packages have changed, please re-source setup files to use them.

For the other things I've tried : - I've tried to investigate CMAKEPREFIXPATH directly inside the CMakelists.txt of packages. I get : CMAKE_PREFIX_PATH=/home/user/catkin_ws/arm_raspberry/kinetic;/home/user/catkin_ws/arm_raspberry/usr which seems to be ok. - The workspace builds well with catkin build without trying to cross-compile. I can revert my workspace to a non cross-compile state with catkin clean && catkin config --no-extend && unset CMAKE_PREFIX_PATH && source /opt/ros/kinetic/setup.sh && catkin build and set it back with catkin clean && catkin config --extend /media/simon/Data/Workspace_ROS/WS_VSMARTH/arm_raspberry/opt/ros/kinetic && catkin build --cmake-args -DCMAKE_TOOLCHAIN_FILE=$PWD/raspberrytoolchain.cmake -DCMAKE_CROSS_COMPILE_PREFIX=$PWD/arm_raspberry

For information : raspberrytoolchain.cmake

#File raspberrytoolchain.cmake for ROS and system packages to cross compile.
SET(CMAKE_SYSTEM_NAME Linux)

SET(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
SET(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)

# Below call is necessary to avoid non-RT problem.
SET(CMAKE_LIBRARY_ARCHITECTURE arm-linux-gnueabihf)

SET(RASPBERRY_ROOT_PATH ${CMAKE_CURRENT_LIST_DIR}/arm_raspberry)
SET(RASPBERRY_KINETIC_PATH ${RASPBERRY_ROOT_PATH}/kinetic)

SET(CMAKE_FIND_ROOT_PATH ${RASPBERRY_ROOT_PATH} ${CATKIN_DEVEL_PREFIX})

#If you have installed cross compiler to somewhere else, please specify that path.
SET(COMPILER_ROOT /usr/arm-linux-gnueabihf)

#Have to set this one to BOTH, to allow CMake to find rospack
#This set of variables controls whether the CMAKE_FIND_ROOT_PATH and CMAKE_SYSROOT are used for find_xxx() operations.
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)

SET(CMAKE_PREFIX_PATH ${RASPBERRY_KINETIC_PATH} ${RASPBERRY_ROOT_PATH}/usr)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
SET(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)
SET(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} --sysroot=${RASPBERRY_ROOT_PATH}" CACHE INTERNAL "" FORCE)

SET(LD_LIBRARY_PATH ${RASPBERRY_KINETIC_PATH}/lib)

Does anyone knows why I could get this behaviour ?

Thanks

Asked by simchanu on 2019-05-27 07:06:54 UTC

Comments

try to create the package with all required dependencies with catkin_create_pkg.

Asked by KrishKannan_007 on 2019-05-29 02:21:23 UTC

Answers