ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Cannot build ROS2 humble (rclcpp) with Android NDK

asked 2022-10-26 11:22:20 -0600

mpc gravatar image

updated 2022-10-27 11:23:33 -0600

I'm trying to build ros2 humble release using the Android NDK compiler (v 25) and am receiving issues in trying to build ament_cmake and rclcpp

After following the instructions here for building on Windows 10 (x86): https://docs.ros.org/en/humble/Instal...

At the "Build ROS2 step" I'm trying to run colcon build and specifying the Android NDK as cmake arguments:

colcon build --cmake-args -DCMAKE_TOOLCHAIN_FILE=D:\Android\Sdk\ndk\25.1.8937393\build\cmake\android.toolchain.cmake -DCMAKE_ANDROID_NDK=D:\Android\Sdk\ndk\25.1.8937393 -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=31 -DCMAKE_ANDROID_API=31 -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_STL=c++_shared -DANDROID_TOOLCHAIN=clang --merge-install --packages-up-to rclcpp

I receive the following error:

Starting >>> ament_package
Starting >>> ament_lint
Starting >>> ament_cppcheck
Starting >>> gtest_vendor
Starting >>> gtest
Starting >>> fastcdr
Starting >>> osrf_testing_tools_cpp
Starting >>> google_benchmark_vendor
Starting >>> iceoryx_hoofs
Starting >>> osrf_pycommon
Starting >>> ament_pycodestyle
Finished <<< gtest_vendor [7.31s]
Starting >>> gmock_vendor
Finished <<< gmock_vendor [3.50s]
--- stderr: ament_package
c:\python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< ament_package [11.1s]
--- stderr: ament_lint
c:\python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< ament_lint [11.2s]
--- stderr: ament_cppcheck
c:\python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< ament_cppcheck [11.3s]
Starting >>> ament_cmake_core
Starting >>> ament_flake8
--- stderr: ament_pycodestyle
c:\python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< ament_pycodestyle [11.3s]
--- stderr: osrf_pycommon
c:\python38\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
---
Finished <<< osrf_pycommon [11.5s]
--- stderr: google_benchmark_vendor
CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/CMakeTestCXXCompiler.cmake:62 (message):
  The C++ compiler

    "D:/Android/Sdk/ndk/25.1.8937393/toolchains/llvm/prebuilt/windows-x86_64/bin/clang++.exe"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: D:/ros2-humble/build/google_benchmark_vendor/CMakeFiles/CMakeTmp

    Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe cmTC_e6ad5.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.

      ANDROID_HOME=
      ANT_HOME=
      JAVA_HOME=
      NDK_ROOT=
      testCXXCompiler.cxx
    TRACKER : error TRK0005: Failed to locate: "clang.exe". The system cannot find the file specified. [D:\ros2-humble\build\google_benchmark_vendor\CMakeFiles\CMakeTmp\cmTC_e6ad5.vcxproj]







  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:2 (project)


---
Failed   <<< google_benchmark_vendor [11.7s, exited with code 1]
Aborted  <<< ament_cmake_core [0.47s]
Aborted  <<< ament_flake8 [0.45s]
Aborted  <<< ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-27 15:16:50 -0600

duck-development gravatar image

Change Dir: D:/ros2-humble/build/google_benchmark_vendor/CMakeFiles/CMakeTmp

Run Build Command(s):C:/Program Files (x86)/Microsoft Visual Studio/2019/Professional/MSBuild/Current/Bin/MSBuild.exe cmTC_e6ad5.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:VisualStudioVersion=16.0 /v:m && Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  ANDROID_HOME=
  ANT_HOME=
  JAVA_HOME=
  NDK_ROOT=
  testCXXCompiler.cxx
TRACKER : error TRK0005: Failed to locate: "clang.exe". The system cannot find the file specified. [D:\ros2-humble\build\google_benchmark_vendor\CMakeFiles\CMakeTmp\cmTC_e6ad5.vcxproj]

This is the issue there it try to use visual studio ms build stuff

edit flag offensive delete link more

Comments

Is it possible to specify a different generator (e.g. Ninja) for a colcon build?

mpc gravatar image mpc  ( 2022-10-27 15:39:18 -0600 )edit

You may start with Android compilation on a Linux or at least wsl installation. Windows is not the best platform for cross compilation.

The ros depended libs have alo to be compiled against the ndk

duck-development gravatar image duck-development  ( 2022-10-27 16:03:51 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2022-10-26 10:06:41 -0600

Seen: 548 times

Last updated: Oct 27 '22