# building roscpp

All I need is roscpp libs for Android. I'm hoping there's a way I can build just these by themselves. So without knowing much about cmake, I did ...

$git clone https://github.com/ros/ros_comm$ cd ros_comm/ros_comm
$mkdir build && cd build$ cmake ..


And ended up with the following ...

\$ cmake ..
-- The C compiler identification is GNU 5.4.0
-- The CXX compiler identification is GNU 5.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
CMake Error at CMakeLists.txt:3 (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.

-- Configuring incomplete, errors occurred!


Is there a way to build just roscpp? The reason I'm doing this is that I'd eventually like to get to a point where I can modify things to start cross compiling using aarch64 tools, even if that means I have to do the port to an arm-v8a arch. The docker image for Android doesn't support the toolchains I need.

edit retag close merge delete

1

Maybe have a look at http://wiki.ros.org/android_ndk instead?

( 2017-06-15 22:32:35 -0600 )edit

Sort by » oldest newest most voted

roscpp has a lot of necessary dependencies so I don't think you would be able to build "just" roscpp.

Per Dirk's comment below, you can build by just running CMake, but you need to have your environment set up correctly. You do not need a workspace, but you do need to have ROS activated in your shell (e.g. source /opt/ros/kinetic/setup.bash). You also need to have all the necessary dependencies available. For roscpp, that means that you will need everything listed in the package.xml file. To be honest, I think the easiest way to make them available would be to just install ROS. (You wouldn't need the full ROS desktop option; the minimal install is probably enough).

If you want to cross-compile, you should start by looking here:

http://wiki.ros.org/ROS/CrossCompiling

You should be able to compile roscpp and its dependencies using Catkin and the cross-compilation facilities. You would then find the libraries you want in the build directory of your workspace, or under the directory in which you ran CMake.

more

You can build every ROS package which uses catkin with a plain invocation of cmake without a problem. You need to have the right enironment though as well as all dependencies.

( 2017-06-15 22:45:16 -0600 )edit

I did not know that. Just goes to show, helping others is a great way to learn! I'll update my answer.

( 2017-06-16 00:22:35 -0600 )edit

@SRD as @ahendrix points out in the comments, try starting here: http://wiki.ros.org/android_ndk .

Some packages have already been cross compiled for Android use, perhaps you will find what you need there. Or if you don't, you can try to add the package you want to the list.

more