foonathan/memory

Help cross compiling for ros2_java/Android

mclayton7 opened this issue · 2 comments

I'm looking into updating the https://github.com/ros2-java/ros2_java project to work with ROS2 Galactic, and the Android build is failing because it's trying to cross compile foonathan_memory and running the ARM64 cross compiled binary on x64. I've also read about using qemu as an emulator in these scenarios (#60)

I'm new to the ROS2 and ament ecosystem, so forgive me if this is a dumb question, but is there a way to pass arguments to ament such that qemu would get passed to the foonathan cmake scripts?

PR for Galactic

ros2-java/ros2_java#187

Build Log

Cloning into 'foo_mem-ext'...
HEAD is now at c619113 Whitespace clean up (#70)
Submodule 'cmake/comp' (https://github.com/foonathan/compatibility.git) registered for path 'cmake/comp'
Cloning into '/home/runner/work/ros2_java/ros2_java/ros2_java_ws/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext/cmake/comp'...
/bin/sh: 1: ../tool/nodesize_dbg: Exec format error
make[5]: *** [src/CMakeFiles/foonathan_memory.dir/build.make:74: src/container_node_sizes_impl.hpp] Error 2
make[4]: *** [CMakeFiles/Makefile2:115: src/CMakeFiles/foonathan_memory.dir/all] Error 2
make[3]: *** [Makefile:136: all] Error 2
make[2]: *** [CMakeFiles/foo_mem-ext.dir/build.make:86: foo_mem-ext-prefix/src/foo_mem-ext-stamp/foo_mem-ext-build] Error 2
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/foo_mem-ext.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
---
Failed   <<< foonathan_memory_vendor [11.2s, exited with code 2]
Aborted  <<< rosidl_typesupport_interface [5.45s]

Summary: 47 packages finished [38.5s]
  1 package failed: foonathan_memory_vendor
  1 package aborted: rosidl_typesupport_interface
  36 packages had stderr output: ament_cmake ament_cmake_copyright ament_cmake_core ament_cmake_cppcheck ament_cmake_cpplint ament_cmake_export_definitions ament_cmake_export_dependencies ament_cmake_export_include_directories ament_cmake_export_interfaces ament_cmake_export_libraries ament_cmake_export_link_flags ament_cmake_export_targets ament_cmake_flake8 ament_cmake_gmock ament_cmake_gtest ament_cmake_include_directories ament_cmake_libraries ament_cmake_lint_cmake ament_cmake_pep257 ament_cmake_pytest ament_cmake_python ament_cmake_ros ament_cmake_target_dependencies ament_cmake_test ament_cmake_uncrustify ament_cmake_version ament_cmake_xmllint ament_lint_auto ament_lint_common fastcdr foonathan_memory_vendor gmock_vendor gtest gtest_vendor rosidl_typesupport_interface uncrustify_vendor
  51 packages not processed
Error: Process completed with exit code 2.

@mclayton7 You almost answered the question yourself. You've taken a look at #60. The important bit is that you should set CMAKE_CROSSCOMPILING_EMULATOR on your cmake toolchain file

This worked, thank-you @MiguelCompany!