ros2_android_examples
ros2_android_examples copied to clipboard
gnustl_shared is no longer supported | CMAKE_MAKE_PROGRAM is not set
Background: I have successfully created an Android app. using rosJava that controls (publishes and subscribes) to a robot with ROS1 Kinetic (Ubuntu 16.04). I have now migrated the robot from ROS1 to ROS2 Dashing (Ubuntu 18.04) successfully. Now I want to migrate my rosJava Android app. to rclJava to control the ROS2 robot. I have written the ROS1 Android app. in Koltin (although Java is OK) using Android Studio on a Windows 10 PC.
Process: I have amended my development environment to run Android Studio on Ubuntu 18.04 (Java).
Issue: I followed the tutorial at https://github.com/esteve/ros2_java:
-
[OK] Download Android SDK
-
[OK] Download Android NDK (added ANDROID_NDK environment variable - not explained)
-
[OK] set ANDROID_HOME
-
[ERR] (untitled)
- [OK] Define Paths I had to modify as follows:
export ROOT_DIR=${HOME}
export AMENT_WORKSPACE=${ROOT_DIR}/ament_ws
export ROS2_ANDROID_WORKSPACE=${ROOT_DIR}/ros2_android_ws
- [OK] # pull and build ament
- [OK] # android build configuration
- [ERR] # pull and build ros2 for android
At the
ament build --isolated --skip-packages…
command I get the following errors (edited for errors only, no duplicates):
# Topological order
…
# Skipping: test_msgs
…
+++ Building 'poco_vendor'
…
-- Setting build type to 'Release' as none was specified.
…
CMake Error at /home/dash/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake:249 (message):
gnustl_shared is no longer supported. Please switch to either c++_shared
or c++_static. See
https://developer.android.com/ndk/guides/cpp-support.html for more
information.
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:3 (project)
…
CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
…
/usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:84 (project)
…
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
…
/usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:17 (project)
…
DCMAKE_INSTALL_PREFIX=/home/dash/ros2_android_ws/install_isolated/libyaml_vendor /home/dash/ros2_android_ws/src/ros2/libyaml_vendor' failed in '/home/dash/ros2_android_ws/build_isolated/libyaml_vendor' with exit code '1'
Traceback (most recent call last):
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 253, in run_command
subprocess.check_call(cmd, shell=True, cwd=cwd, env=build_action.env)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
…
Traceback (most recent call last):
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build/cli.py", line 384, in process_in_parallel
result = done_future.result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 425, in result
return self.__get_result()
File "/usr/lib/python3.6/concurrent/futures/_base.py", line 384, in __get_result
raise self._exception
File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 280, in main
return run(opts, context)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 331, in run
handle_build_action(on_build_ret, context)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 270, in handle_build_action
run_command(build_action, context)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build_pkg/cli.py", line 262, in run_command
sys.exit(msg)
DCMAKE_INSTALL_PREFIX=/home/dash/ros2_android_ws/install_isolated/ament_cmake_ros /home/dash/ros2_android_ws/src/ros2/ament_cmake_ros/ament_cmake_ros' failed in '/home/dash/ros2_android_ws/build_isolated/ament_cmake_ros' with exit code '1'
CMake Error at /home/dash/Android/Sdk/ndk-bundle/build/cmake/android.toolchain.cmake:249 (message):
gnustl_shared is no longer supported. Please switch to either c++_shared
or c++_static. See
https://developer.android.com/ndk/guides/cpp-support.html for more
information.
Call Stack (most recent call first):
/usr/share/cmake-3.10/Modules/CMakeDetermineSystem.cmake:94 (include)
CMakeLists.txt:2 (project)
…
DCMAKE_INSTALL_PREFIX=/home/dash/ros2_android_ws/install_isolated/poco_vendor /home/dash/ros2_android_ws/src/ros2/poco_vendor' failed in '/home/dash/ros2_android_ws/build_isolated/poco_vendor' with exit code '1'
Failed packages: ament_cmake_ros
Traceback (most recent call last):
File "/home/dash/ament_ws/install_isolated/ament_tools/bin/ament", line 11, in <module>
load_entry_point('ament-tools', 'console_scripts', 'ament')()
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/commands/ament.py", line 88, in main
rc = args.main(args)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build/cli.py", line 172, in main
return iterate_packages(opts, packages, per_package_main)
File "/home/dash/ament_ws/build_isolated/ament_tools/ament_tools/verbs/build/cli.py", line 329, in iterate_packages
shutil.copy(template_path, dst)
File "/usr/lib/python3.6/shutil.py", line 245, in copy
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/usr/lib/python3.6/shutil.py", line 121, in copyfile
with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: '/home/dash/ros2_android_ws/install_isolated/local_setup.bash'
I can post the entire output if so desired.
Thank you in advance for any help provided, much appreciated.
Update:
Attempt 2: I tried the instructions again this time with downgraded versions of components:
Android NDK version 20r to version 16b Android SDK version 21 Gradle version 5.4.1 to version 3.3 Gradle Plugin version 2.3.3
However, I got the same error as before. :-(
Attempt 3: I am able to compile ros2_talker_android in Android Studio, but when I run the module I get an Missing Ament Gradle property: ament.build_space
error as explained in [https://github.com/esteve/ros2_android_examples/issues/2]. At the end of this closed issue you explained that there could be conflict with installed ROS distros/packages, but this is not the case for me as running sudo apt remove ros-ardent-*
returned couldn't find any package...
Anyway in this same issue you said,
Once you have built the entire workspace with ament, you can open the ros2_talker_android project in Android Studio just as usual.
So I went back through my script and I realised I had missed an error in the ament build, and I think this is causing the problem. The error occurs at...
src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated
The error:
Traceback (most recent call last):
File "src/ament/ament_tools/scripts/ament.py", line 139, in <module>
from ament_tools.package_types.ament import entry_point_data as ament_entry_point_data # noqa
File "/home/scout/ament_ws/src/ament/ament_tools/ament_tools/package_types/ament.py", line 15, in <module>
from catkin_pkg.package import package_exists_at
ImportError: No module named 'catkin_pkg'
This is where I noticed in another issue [https://github.com/esteve/ament_java/issues/6] the same error. So I ran sudo apt-get install python-catkin-pkg-modules
as suggested. I then re-ran src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated
, but it still failed with the same error as above. :-(
Any ideas would be most appreciated.
Quick Update:
In trying to resolve the catkin_pkg error at src/ament/ament_tools/scripts/ament.py build --symlink-install --isolated
...
I tried:
sudo apt install --reinstall python-catkin-pkg-modules
but no good. :-(
I solved the above error with sudo apt install python3-catkin-pkg
Hello, I have been facing the same issue with gnustl_shared
.
System Config:
- Ubuntu 20
- ROS2 Foxy
- Android Target API 30
- Android NDK 21r
- Android Studio 4.1.3
I have solved the ament build issue by removing the -DANDROID_STL=gnustl_shared
line from the build script. Looking at NDK_PATH/build/cmake/android.toolchain.cmake
this will default the build process to c++_static
.
Now I am building the workspace fine, however, I am having issues with the action_msgs package, which fails.