ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

Build native ROS nodes using the Android NDK Errors

asked 2015-11-21 07:21:20 -0600

xy1zzz gravatar image

updated 2015-11-25 18:57:30 -0600

hi,I'm trying to build native ROS nodes using the Android NDK by this tutorial[]. I use Ubuntu 64bit 14.04LTS as the host on the VM. I installed docker by step 1 and step 2 successfully and run ./ cmd,then something goes wrong with this:

[ 84%] Building CXX object modules/ts/CMakeFiles/opencv_ts.dir/src/ts.cpp.o
Linking CXX static library ../../lib/libopencv_ts.a
[ 84%] Built target opencv_ts
[ 84%] Generating OpenCV Android library project. SDK target: lib_target_sdk_target-NOTFOUND
make[2]: *** [build.xml] Error 1
make[1]: *** [modules/java/CMakeFiles/opencv_java.dir/all] Error 2
make: *** [all] Error 2
Cross-compiling ROS.
Running catkin_make.
Base path: /opt/roscpp_output/catkin_ws
Source space: /opt/roscpp_output/catkin_ws/src
Build space: /opt/roscpp_output/catkin_ws/build
Devel space: /opt/roscpp_output/catkin_ws/devel
Install space: /opt/roscpp_output/target

Then the cmake comeout some errors :

CMake Error at catkin/cmake/catkin_workspace.cmake:95 (message):
  This workspace contains non-catkin packages in it, and catkin cannot build
  a non-homogeneous workspace without isolation.  Try the
  'catkin_make_isolated' command instead.
Call Stack (most recent call first):
  CMakeLists.txt:63 (catkin_workspace)

-- Configuring incomplete, errors occurred!
See also "/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed


make: *** No rule to make target `install'.  Stop. /opt/roscpp_output died with error code 2

Creating output/roscpp_android_ndk.tar.gz.

tar: roscpp_android_ndk: Cannot stat: No such file or directory
tar: Exiting with failure status due to previous errors

the CMakeError.log shows like :

CheckIncludeFile.c:1:22: fatal error: execinfo.h: No such file or directory
compilation terminated.
make[1]: Leaving directory `/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec2484976465.dir/CheckIncludeFile.c.o] Error 1
make: *** [cmTryCompileExec2484976465/fast] Error 2


/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeTmp/src.cxx:2:8: error: expected constructor, destructor, or type conversion before '(' token
make[1]: Leaving directory `/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec640946834.dir/src.cxx.o] Error 1
make: *** [cmTryCompileExec640946834/fast] Error 2

main:CheckFunctionExists.c(.text.main+0x14): error: undefined reference to 'backtrace'
collect2: ld returned 1 exit status
make[1]: Leaving directory `/opt/roscpp_output/catkin_ws/build/CMakeFiles/CMakeTmp'
make[1]: *** [cmTryCompileExec4272716319] Error 1
make: *** [cmTryCompileExec4272716319/fast] Error 2

I don't know if the cmake errors come from the opencv errors. Any one Know something about this problem?Thanks a lot!

edit retag flag offensive close merge delete


It seems like opencv is failing to build, I just cleaned my workspace and started a new do_docker from scratch to see if I can reproduce this issue. I'll let you know.

Gary Servin gravatar image Gary Servin  ( 2015-11-25 19:01:59 -0600 )edit

Thanks a lot !

xy1zzz gravatar image xy1zzz  ( 2015-11-25 20:24:31 -0600 )edit

It seems it failed to install correctly the Android SDK inside the container, thus the "SDK target: lib_target_sdk_target-NOTFOUND".

Can you manually install the SDK again inside the container? Here are the instructions:

Gary Servin gravatar image Gary Servin  ( 2015-11-26 09:01:02 -0600 )edit

THANKS,I'm trying

xy1zzz gravatar image xy1zzz  ( 2015-11-26 22:56:45 -0600 )edit

I have delete all docker images,and reinstall again,and the problem shows again:"SDK target: lib_target_sdk_target-NOTFOUND"

I have checked the docker images by your advice in ”“,and rosndk and android sdk is ok.

xy1zzz gravatar image xy1zzz  ( 2015-11-27 20:21:54 -0600 )edit

then I echo $PATH shows:/usr/lib/ccache:/opt/android-sdk-linux/tools:/opt/android-sdk-linux/platform-tools:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

echo $ANDROID_HOME shows:/opt/android-sdk-linux

seems ok?

xy1zzz gravatar image xy1zzz  ( 2015-11-27 20:24:24 -0600 )edit

maybe the step 27 have something wrong,I'm trying

xy1zzz gravatar image xy1zzz  ( 2015-11-27 20:27:25 -0600 )edit

I found some in opencv build: -- Android: -- Android ABI: armeabi-v7a -- STL type: gnustl_static -- Native API level: android-14 -- SDK target: android_sdk_target_status-NOTFOUND

do I need install android API 14?

xy1zzz gravatar image xy1zzz  ( 2015-11-27 21:46:31 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2015-11-30 21:23:03 -0600

xy1zzz gravatar image

updated 2015-11-30 21:30:17 -0600

Thanks to Gary Servin I have build successfully by the following steps:

1.# Check if you have the rosndk image on the list.

u64@u64-VirtualBox:~$ docker images
REPOSITORY          TAG                 IMAGE ID            CREATED             VIRTUAL SIZE
rosndk              latest              6c374bc001d0        12 hours ago        3.678 GB

2.# This will create a container based on the image

u64@u64-VirtualBox:~$ docker run -it rosndk bash

3.# run ls -l,you should have -rw-r--r-- 1 root root 140827643 Jul 2 2014 android-sdk_r23.0.2-linux.tgz

root@58dfb6a0a9f4:/# ls -l
total 593516
-rw-r--r--   1 root root 466853553 Mar 21  2013 android-ndk-r8e-linux-x86_64.tar.bz2
-rw-r--r--   1 root root 140827643 Jul  2  2014 android-sdk_r23.0.2-linux.tgz

#if not
#and run :tar -xvf android-sdk_r23.0.2-linux.tgz -C /opt

4.#run android list and if the android target have been update successfully it should be like this:

root@58dfb6a0a9f4:/# android list
Available Android targets:
id: 1 or "android-20"
     Name: Android 4.4W.2

#if wrong, there are not any targets list,maybe the same question,then goto step 5.

5.#check if you can update android sdk successfully
(Thanks to the GREETWALL I cannot visit google without VPN).

root@58dfb6a0a9f4:/# android update sdk -u -t 2,3,7,8,9,11,13,16,56,57

6.#when update successfully,run exit.


7.# Commit the latest container to rosndk

u64@u64-VirtualBox:~$docker commit $(docker ps -aq | head -n 1) rosndk

8.#delete the wrong build package #mine is:/home/u64/ros-android-ndk/roscpp_android/output/catkin_ws/src/vision_opencvzs

9.just run ./ again

u64@u64-VirtualBox:~/ros-android-ndk/roscpp_android$ ./

#when you are success,it shows:

summary of what just happened:
  target/      was used to build static libraries for ros software
    include/   contains headers
    lib/       contains static libraries
  roscpp_android_ndk/     is a NDK sub-project that can be imported into an NDK app
  sample_app/  is an example of such an app, a native activity
  sample_app/bin/sample_app-debug.apk  is the built apk, it implements a subscriber and a publisher
  move_base_sample_app/  is an example app that implements the move_base node
  move_base_app/bin/move_base_app-debug.apk  is the built apk for the move_base example


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2015-11-21 07:21:20 -0600

Seen: 1,577 times

Last updated: Nov 30 '15