0
$\begingroup$

Rosanswers logo

Hi to all,

I would like to generate a ".deb" file to share my ROS code with other. I have heard about Bloom and another ways to generate ".deb" files. However, this is not a good solution for me, I only need a local manner to generate a ".deb" file to obfuscate my source code and thereby, my colleague could install and use it in his computer, without see the source. I only need to share my code with my colleague, no with the ROS community, because it is a very concrete (ad hoc) source code, is not valid for the rest of community.

Is there a "ROS" manner to compile my ROS package in a .deb file?

Edit (by @William):

The first step is correct, it generates a debian folder with rules and another files.

$ cd path/to/your/catkin/package
$ bloom-generate rosdebian --os-name ubuntu --os-version trusty --ros-distro indigo

Then, when i try to use the second command:

$ fakeroot debian/rules binary

I have problems with CMakeList.txt.

-- Found gtest sources under '/usr/src/gtest': gtests will be built
-- catkin 0.5.86
CMake Error at /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:72 (find_package):
  Could not find a configuration file for package roscpp.

  Set roscpp_DIR to the directory containing a CMake configuration file for
  roscpp.  The file will have one of the following names:

    roscppConfig.cmake
    roscpp-config.cmake

Call Stack (most recent call first):
  CMakeLists.txt:7 (find_package)


CMake Error at /opt/ros/groovy/share/catkin/cmake/catkinConfig.cmake:72 (find_package):
  Could not find a configuration file for package message_generation.

  Set message_generation_DIR to the directory containing a CMake
  configuration file for message_generation.  The file will have one of the
  following names:

    message_generationConfig.cmake
    message_generation-config.cmake

Call Stack (most recent call first):
  CMakeLists.txt:7 (find_package)


CMake Error at CMakeLists.txt:26 (add_message_files):
  Unknown CMake command "add_message_files".


-- Configuring incomplete, errors occurred!
dh_auto_configure: cmake .. -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_VERBOSE_MAKEFILE=ON -DCATKIN_BUILD_BINARY_PACKAGE=1 -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr returned exit code 1
make[1]: *** [override_dh_auto_configure] Error 2
make: *** [binary] Error 2

The compiler, among other errors, does not recognize "add_message_files" command. Any idea?

Thank you very much for your help ;)


I am trying with a lot of configurations, but it doesn't work. I am sure that the solution is very simple. I attach my CMakelist.txt and package.xml, order that you may check the files.

CMakelist.txt

cmake_minimum_required(VERSION 2.8.3)
project(br_modbus)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS roscpp message_generation std_msgs genmsg)


## System dependencies are found with CMake's conventions
find_package(Boost REQUIRED COMPONENTS system)


## Uncomment this if the package has a setup.py. This macro ensures
## modules and global scripts declared therein get installed
# catkin_python_setup()

#######################################
## Declare ROS messages and services ##
#######################################

## Generate messages in the 'msg' folder
 add_message_files(
   FILES
   BrInputStatus.msg
 )

## Generate services in the 'srv' folder
 add_service_files(
   FILES
   setOutput.srv
   setOutputEmpty.srv
   setOutputString.srv
   getOutput.srv
 )

## Generate added messages and services with any dependencies listed here
 generate_messages(
   DEPENDENCIES
   std_msgs
 )

###################################
## catkin specific configuration ##
###################################
## The catkin_package macro generates cmake config files for your package
## Declare things to be passed to dependent projects
## INCLUDE_DIRS: uncomment this if you package contains header files
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
#  INCLUDE_DIRS include
#  LIBRARIES br_modbus
  CATKIN_DEPENDS message_runtime
#  DEPENDS system_lib
)

###########
## Build ##
###########

## Specify additional locations of header files
## Your package locations should be listed before other locations
# include_directories(include)
include_directories(include
  ${catkin_INCLUDE_DIRS}
)
#include/${PROJECT_NAME}

## Declare a cpp library
# add_library(br_modbus
#   src/${PROJECT_NAME}/ClassIOModbusDev.cpp
# )

## Declare a cpp executable
add_executable(ClassIOModbusDev src/ClassIOModbusDev.cpp)
## Add cmake target dependencies of the executable/library
## as an example, message headers may need to be generated before nodes
add_dependencies(ClassIOModbusDev /usr/lib/libmodbus.so ${catkin_EXPORTED_TARGETS})
## Specify libraries to link a library or executable target against
target_link_libraries(ClassIOModbusDev /usr/lib/libmodbus.so ${catkin_LIBRARIES})

Package.xml

<?xml version="1.0"?>
<package>
  <name>br_modbus</name>
  <version>0.0.0</version>
  <description>The br_modbus package</description>


  <maintainer email="[email protected]">Jose Luis</maintainer>
  <license>TODO</license>

  <!-- The *_depend tags are used to specify dependencies -->
  <!-- Dependencies can be catkin packages or system dependencies -->

  <!-- Use build_depend for packages you need at compile time: -->
  <build_depend>message_generation</build_depend>
  <build_depend>libmodbus-dev</build_depend>
  <build_depend>genmsg</build_depend>
  <build_depend>roscpp</build_depend>

  <!-- Use run_depend for packages you need at runtime: -->
  <run_depend>message_runtime</run_depend>
  <run_depend>roscpp</run_depend>

  <!-- Use buildtool_depend for build tool packages: -->
  <buildtool_depend>catkin</buildtool_depend>

  <!-- The export tag contains other, unspecified, tags -->
  <export>
    <!-- You can specify that this package is a metapackage here: -->
    <!-- <metapackage/> -->

    <!-- Other tools can request additional information be placed here -->
  </export>
</package>

Originally posted by Jose Luis on ROS Answers with karma: 375 on 2014-06-17

Post score: 12

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You can still use bloom to generate the source deb, from which you can build a binary deb:

$ cd path/to/your/catkin/package
$ bloom-generate rosdebian --os-name ubuntu --os-version trusty --ros-distro indigo

This will create a folder debian with all of the file you need to build a debian. After that you should be able to call something like this:

$ fakeroot debian/rules binary

To build the .deb file (according to this site: https://wiki.debian.org/BuildingAPackage).

Node that by using the bloom-generate rosdebian ... ROS debian generator, this will setup the package to install into /opt/ros/<rosdistro>. If you want it installed into /usr you can just use the normal debian generator, i.e. replace rosdebian with debian.

The other option is to just use checkinstall: https://help.ubuntu.com/community/CheckInstall which I believe can make .deb files out of anything which has an install rule.

Edit:

You will need to install all dependencies and source the appropriate setup file (usually /opt/ros/hydro/setup.bash) before running fakeroot ....

Edit:

You can try to use dpkg-buildpackage instead:

http://manpages.ubuntu.com/manpages/precise/man1/dpkg-buildpackage.1.html

I would just recommend using checkinstall.


Originally posted by William with karma: 17335 on 2014-06-17

This answer was ACCEPTED on the original site

Post score: 11


Original comments

Comment by Jose Luis on 2014-06-20:
As you can see in the CMakelist.txt and package.xml files, I use my own messages and services in my package, this is a trouble for the generation of .deb, as seen in the above mistake:

CMake Error at CMakeLists.txt:26 (add_message_files):
  Unknown CMake command "add_message_files". 

Comment by VictorLamoine on 2018-09-10:
Calling bloom-generate rosdebian is usually enough, distribution and ROS version are guessed automatically.

Is using CPack a bad idea? It allows to generate debian packages easily, what would be the drawbacks?

$\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.