pythonwindowscmakeros

ROS1 catkin_make failed: catkin_install_python() called without required DESTINATION argument


I tried to add python scripts to my packages reference this two tutorials.

Handling of setup.py

Installing Python scripts and modules

So I added setup.py in root test\src\test_pkg, changed CMakeLists.txt in path test\src. (My package root path is test\, and my package path is test\src\test_pkg, my python scripts path is test\src\test_pkg\scripts)

This is setup.py.

#!/usr/bin/env python
# -*- coding: utf-8 -*-


from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup


setup_args = generate_distutils_setup(
    packages=['test_pkg'],
    scripts=['/scripts'],
    package_dir={'': 'src'}
)

setup(**setup_args)

This is CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(test_pkg)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  std_msgs
  sensor_msgs
  message_generation
)

catkin_python_setup()

catkin_install_python(PROGRAMS scripts/talker
                      DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION})

add_message_files(
  FILES
  Num.msg
)

add_service_files(
  FILES
  AddTwoInts.srv
)

generate_messages(
  DEPENDENCIES
  std_msgs
  sensor_msgs
)

catkin_package(
  CATKIN_DEPENDS roscpp rospy std_msgs message_runtime sensor_msgs

include_directories(
# include
  ${catkin_INCLUDE_DIRS}
)

install(PROGRAMS 
  DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

Then I run catkin_make in path test.(I have run test\devel\setup.bat) And got this CMake error:

Base path: E:\workspace\ros\test
Source space: E:\workspace\ros\test\src
Build space: E:\workspace\ros\test\build
Devel space: E:\workspace\ros\test\devel
Install space: E:\workspace\ros\test\install
####
#### Running command: "nmake cmake_check_build_system" in "E:\workspace\ros\test\build"
####

Microsoft (R) ?????????ù??? 14.20.27508.1 ??
??????? (C) Microsoft Corporation??  ?????????????

-- Using CATKIN_DEVEL_PREFIX: E:/workspace/ros/test/devel
-- Using CMAKE_PREFIX_PATH: E:/workspace/ros/test/devel;C:/opt/ros/melodic/x64;C:/opt/rosdeps/x64
-- This workspace overlays: E:/workspace/ros/test/devel;C:/opt/ros/melodic/x64
-- Using PYTHON_EXECUTABLE: C:/opt/python27amd64/python.exe
-- Using default Python package layout
-- Using empy: C:/opt/python27amd64/lib/site-packages/em.pyc
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: E:/workspace/ros/test/build/test_results
-- Found gtest: gtests will be built
-- Using Python nosetests: C:/opt/python27amd64/Scripts/nosetests-2.7.exe
-- catkin 0.7.14
-- BUILD_SHARED_LIBS is on
-- BUILD_SHARED_LIBS is on
-- Using CATKIN_WHITELIST_PACKAGES: test_pkg
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- ~~  traversing 1 packages in topological order:
-- ~~  - test_pkg
-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- +++ processing catkin package: 'test_pkg'
-- ==> add_subdirectory(test_pkg)
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:20 (message):
  catkin_install_python() called without required DESTINATION argument.
Call Stack (most recent call first):
  test_pkg/CMakeLists.txt:27 (catkin_install_python)


-- Configuring incomplete, errors occurred!
See also "E:/workspace/ros/test/build/CMakeFiles/CMakeOutput.log".
See also "E:/workspace/ros/test/build/CMakeFiles/CMakeError.log".
NMAKE : fatal error U1077: ??C:\opt\rosdeps\x64\bin\cmake.exe??: ???????0x1??
Stop.
Invoking "nmake cmake_check_build_system" failed

How to fix this error? Thanks for any reply.

System: Windows10

ROS: ROS1


Solution

  • First, while catkin is a generic enough tool, it's typically used for the robotics framework ROS. So by asking on ROS' question community answers.ros.org you might get more response.

    CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/catkin_install_python.cmake:20 (message):
      catkin_install_python() called without required DESTINATION argument.
    

    I think you referred to the right online resources. I've also looked at them and none of them clarified this, but catkin_package() needs to be called prior to catkin_install_python.