eclipse-cyclonedds / cyclonedds

Eclipse Cyclone DDS project
https://projects.eclipse.org/projects/iot.cyclonedds
Other
844 stars 350 forks source link

Error undefined symbols when building cyclonedds 0.9.x release with ROS2 humble colcon and Android NDK #1466

Open mpconte opened 1 year ago

mpconte commented 1 year ago

When trying to build the cyclonedds package with the following dependencies in the repos:

# First part is generated with
# rosinstall_generator --format repos --upstream-devel --rosdistro humble --deps rclcpp sensor_msgs geometry_msgs --exclude rmw_fastrtps_cpp spdlog_vendor uncrustify_vendor rpyutils rosidl_generator_py fastrtps fastcdr rosidl_typesupport_fastrtps_c rosidl_typesupport_fastrtps_cpp rmw_fastrtps_dynamic_cpp performance_test_fixture iceoryx_binding_c google_benchmark_vendor rmw_connextdds rmw_connextdds_common rti_connext_dds_cmake_module rcl_logging_spdlog launch_testing_ament_cmake launch_testing launch iceoryx_posh ament_cmake_gmock ament_cmake_google_benchmark ament_cmake_gtest ament_cmake_pytest domain_coordinator ament_cmake_cpplint ament_cmake_flake8 ament_cmake_pep257 ament_cmake_uncrustify ament_cmake_xmllint ament_copyright ament_cppcheck ament_cpplint ament_flake8 ament_lint ament_lint_auto ament_lint_cmake ament_lint_common ament_pep257 gmock_vendor gtest_vendor iceoryx_hoofs
repositories:
  ament_cmake:
    type: git
    url: https://github.com/ament/ament_cmake.git
    version: humble
  ament_cmake_ros:
    type: git
    url: https://github.com/ros2/ament_cmake_ros.git
    version: humble
  ament_index:
    type: git
    url: https://github.com/ament/ament_index.git
    version: humble
  ament_lint:
    type: git
    url: https://github.com/ament/ament_lint.git
    version: humble
  ament_package:
    type: git
    url: https://github.com/ament/ament_package.git
    version: humble
  common_interfaces:
    type: git
    url: https://github.com/ros2/common_interfaces.git
    version: humble
  cyclonedds:
    type: git
    url: https://github.com/eclipse-cyclonedds/cyclonedds.git
    version: releases/0.9.x
  libstatistics_collector:
    type: git
    url: https://github.com/ros-tooling/libstatistics_collector.git
    version: humble
  libyaml_vendor:
    type: git
    url: https://github.com/ros2/libyaml_vendor.git
    version: humble
  mimick_vendor:
    type: git
    url: https://github.com/ros2/mimick_vendor.git
    version: humble
  osrf_testing_tools_cpp:
    type: git
    url: https://github.com/osrf/osrf_testing_tools_cpp.git
    version: master
  rcl:
    type: git
    url: https://github.com/ros2/rcl.git
    version: humble
  rcl_interfaces:
    type: git
    url: https://github.com/ros2/rcl_interfaces.git
    version: humble
  rcl_logging:
    type: git
    url: https://github.com/ros2/rcl_logging.git
    version: humble
  rclcpp:
    type: git
    url: https://github.com/ros2/rclcpp.git
    version: humble
  rcpputils:
    type: git
    url: https://github.com/ros2/rcpputils.git
    version: humble
  rcutils:
    type: git
    url: https://github.com/ros2/rcutils.git
    version: humble
  rmw:
    type: git
    url: https://github.com/ros2/rmw.git
    version: humble
  rmw_cyclonedds:
    type: git
    url: https://github.com/ros2/rmw_cyclonedds.git
    version: humble
  rmw_dds_common:
    type: git
    url: https://github.com/ros2/rmw_dds_common.git
    version: humble
  rmw_implementation:
    type: git
    url: https://github.com/ros2/rmw_implementation.git
    version: humble
  ros2_tracing:
    type: git
    url: https://github.com/ros2/ros2_tracing.git
    version: humble
  rosidl:
    type: git
    url: https://github.com/ros2/rosidl.git
    version: humble
  rosidl_defaults:
    type: git
    url: https://github.com/ros2/rosidl_defaults.git
    version: humble
  rosidl_typesupport:
    type: git
    url: https://github.com/ros2/rosidl_typesupport.git
    version: humble
  test_interface_files:
    type: git
    url: https://github.com/ros2/test_interface_files.git
    version: humble
  unique_identifier_msgs:
    type: git
    url: https://github.com/ros2/unique_identifier_msgs.git
    version: humble
# Hand made
  rcl_logging_android:
    type: git
    url: https://github.com/sloretz/rcl_logging_android.git
    version: main

I receive an error when trying to build these packages using the Android NDK as follows:

colcon build --cmake-args -DCMAKE_SYSTEM_NAME=Android -DCMAKE_SYSTEM_VERSION=30 -DCMAKE_ANDROID_NDK=/mnt/d/android-sdk/ndk/25.1.8937393 -DCMAKE_ANDROID_ARCH_ABI=x86_64 -DCMAKE_TOOLCHAIN_FILE=/mnt/d/android-sdk/ndk/25.1.8937393/build/cmake/android.toolchain.cmake -DCMAKE_FIND_ROOT_PATH="/mnt/d/ros2-humble/install/ament_cmake_core/share/ament_cmake_core;/mnt/d/ros2-humble/install/ament_cmake_python/share/ament_cmake_python/cmake;/mnt/d/ros2-humble/install/osrf_testing_tools_cpp/share/osrf_testing_tools_cpp/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_dependencies/share/ament_cmake_export_dependencies/cmake;/mnt/d/ros2-humble/install/ament_cmake_test/share/ament_cmake_test/cmake;/mnt/d/ros2-humble/install/ament_cmake_lint_cmake/share/ament_cmake_lint_cmake/cmake;/mnt/d/ros2-humble/install/ament_cmake_gtest/share/ament_cmake_gtest/cmake;/mnt/d/ros2-humble/install/ament_cmake_copyright/share/ament_cmake_copyright/cmake;/mnt/d/ros2-humble/install/ament_cmake/share/ament_cmake/cmake;/mnt/d/ros2-humble/install/ament_cmake_libraries/share/ament_cmake_libraries/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_definitions/share/ament_cmake_export_definitions/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_include_directories/share/ament_cmake_export_include_directories/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_interfaces/share/ament_cmake_export_interfaces/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_libraries/share/ament_cmake_export_libraries/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_link_flags/share/ament_cmake_export_link_flags/cmake;/mnt/d/ros2-humble/install/ament_cmake_export_targets/share/ament_cmake_export_targets/cmake;/mnt/d/ros2-humble/install/ament_cmake_gen_version_h/share/ament_cmake_gen_version_h/cmake;/mnt/d/ros2-humble/install/ament_cmake_target_dependencies/share/ament_cmake_target_dependencies/cmake;/mnt/d/ros2-humble/install/ament_cmake_include_directories/share/ament_cmake_include_directories/cmake;/mnt/d/ros2-humble/install/ament_cmake_version/share/ament_cmake_version/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_core/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_python/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_test/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_dependencies/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_gtest/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_lint_cmake/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_copyright/cmake;/mnt/d/ros2-humble/install/share/ament_cmake/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_libraries/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_definitions/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_include_directories/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_interfaces/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_libraries/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_link_flags/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_export_targets/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_gen_version_h/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_target_dependencies/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_include_directories/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_version/cmake;/mnt/d/ros2-humble/install/share/ament_lint_auto/cmake;/mnt/d/ros2-humble/install/share/ament_cmake_pytest/cmake" --merge-install --cmake-clean-cache --cmake-clean-first

I receive the following error when building cyclonedds:

--- stderr: cyclonedds
make[1]: Warning: File 'CMakeFiles/Makefile2' has modification time 0.077 s in the future
make[1]: warning:  Clock skew detected.  Your build may be incomplete.
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:71:33: warning: implicit declaration of function 'isalnum_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isalnum(int c) { return isalnum_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:72:33: warning: implicit declaration of function 'isalpha_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isalpha(int c) { return isalpha_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:73:33: warning: implicit declaration of function 'isblank_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isblank(int c) { return isblank_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:74:33: warning: implicit declaration of function 'iscntrl_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_iscntrl(int c) { return iscntrl_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:75:33: warning: implicit declaration of function 'isgraph_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isgraph(int c) { return isgraph_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:76:33: warning: implicit declaration of function 'islower_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_islower(int c) { return islower_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:77:33: warning: implicit declaration of function 'isprint_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isprint(int c) { return isprint_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:78:33: warning: implicit declaration of function 'ispunct_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_ispunct(int c) { return ispunct_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:79:33: warning: implicit declaration of function 'isspace_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isspace(int c) { return isspace_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:80:33: warning: implicit declaration of function 'isupper_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_isupper(int c) { return isupper_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:81:33: warning: implicit declaration of function 'toupper_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_toupper(int c) { return toupper_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:82:33: warning: implicit declaration of function 'tolower_l' is invalid in C99 [-Wimplicit-function-declaration]
int idl_tolower(int c) { return tolower_l(c, posix_locale()); }
                                ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:105:10: warning: implicit declaration of function 'strcasecmp_l' is invalid in C99 [-Wimplicit-function-declaration]
  return strcasecmp_l(s1, s2, posix_locale());
         ^
/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:116:10: warning: implicit declaration of function 'strncasecmp_l' is invalid in C99 [-Wimplicit-function-declaration]
  return strncasecmp_l(s1, s2, n, posix_locale());
         ^
14 warnings generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:247:62: warning: implicit conversion changes signedness: 'uint32_t' (aka 'unsigned int') to 'socklen_t' (aka 'int') [-Wsign-conversion]
        AF_INET, &((struct sockaddr_in *)sa)->sin_addr, buf, (uint32_t)size);
                                                             ^~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:259:65: warning: implicit conversion changes signedness: 'uint32_t' (aka 'unsigned int') to 'socklen_t' (aka 'int') [-Wsign-conversion]
        AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr, buf, (uint32_t)size);
                                                                ^~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:393:59: warning: implicit conversion changes signedness: 'socklen_t' (aka 'int') to 'size_t' (aka 'unsigned int') [-Wsign-conversion]
          memcpy(&hent->addrs[addrno], res->ai_addr, res->ai_addrlen);
          ~~~~~~                                     ~~~~~^~~~~~~~~~
3 warnings generated.
ld: error: undefined symbol: newlocale
>>> referenced by string.c:458 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:458)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isalnum)
>>> referenced by string.c:458 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:458)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isalpha)
>>> referenced by string.c:458 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:458)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isblank)
>>> referenced 15 more times

ld: error: undefined symbol: isalnum_l
>>> referenced by string.c:71 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:71)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isalnum)

ld: error: undefined symbol: isalpha_l
>>> referenced by string.c:72 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:72)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isalpha)

ld: error: undefined symbol: isblank_l
>>> referenced by string.c:73 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:73)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isblank)

ld: error: undefined symbol: iscntrl_l
>>> referenced by string.c:74 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:74)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_iscntrl)

ld: error: undefined symbol: isgraph_l
>>> referenced by string.c:75 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:75)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isgraph)

ld: error: undefined symbol: islower_l
>>> referenced by string.c:76 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:76)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_islower)

ld: error: undefined symbol: isprint_l
>>> referenced by string.c:77 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:77)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isprint)

ld: error: undefined symbol: ispunct_l
>>> referenced by string.c:78 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:78)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_ispunct)

ld: error: undefined symbol: isspace_l
>>> referenced by string.c:79 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:79)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isspace)

ld: error: undefined symbol: isupper_l
>>> referenced by string.c:80 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:80)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_isupper)

ld: error: undefined symbol: toupper_l
>>> referenced by string.c:81 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:81)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_toupper)

ld: error: undefined symbol: tolower_l
>>> referenced by string.c:82 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:82)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_tolower)

ld: error: undefined symbol: strcasecmp_l
>>> referenced by string.c:105 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:105)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_strcasecmp)

ld: error: undefined symbol: strncasecmp_l
>>> referenced by string.c:116 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:116)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_strncasecmp)

ld: error: undefined symbol: uselocale
>>> referenced by string.c:186 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:186)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_vsnprintf)
>>> referenced by string.c:188 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:188)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_vsnprintf)
>>> referenced by string.c:319 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:319)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_vfprintf)
>>> referenced 1 more times

ld: error: undefined symbol: strtoull_l
>>> referenced by string.c:278 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:278)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_strtoull)

ld: error: undefined symbol: strtold_l
>>> referenced by string.c:292 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:292)
>>>               CMakeFiles/idl.dir/src/string.c.o:(idl_strtold)

ld: error: undefined symbol: freelocale
>>> referenced by string.c:441 (/mnt/d/ros2-humble/src/cyclonedds/src/idl/src/string.c:441)
>>>               CMakeFiles/idl.dir/src/string.c.o:(.text.free_locale+0x0)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/idl/CMakeFiles/idl.dir/build.make:362: lib/libcycloneddsidl.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:473: src/idl/CMakeFiles/idl.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
/mnt/d/ros2-humble/src/cyclonedds/src/core/ddsi/src/ddsi_udp.c:599:50: warning: operand of ? changes signedness: 'const uint32_t' (aka 'const unsigned int') to 'int' [-Wsign-conversion]
    ipv6mreq.ipv6mr_interface = interf ? interf->if_index : 0;
                              ~          ~~~~~~~~^~~~~~~~
1 warning generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:141:8: warning: implicit conversion changes signedness: 'socklen_t' (aka 'int') to 'size_t' (aka 'unsigned int') [-Wsign-conversion]
  sz = ddsrt_sockaddr_get_size(sys_ifa->ifa_addr);
     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:192:7: warning: implicit declaration of function 'getifaddrs' is invalid in C99 [-Wimplicit-function-declaration]
  if (getifaddrs(&sys_ifa_root) == -1) {
      ^
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:234:5: warning: implicit declaration of function 'freeifaddrs' is invalid in C99 [-Wimplicit-function-declaration]
    freeifaddrs(sys_ifa_root);
    ^
3 warnings generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/filesystem/posix/filesystem.c:72:31: warning: implicit conversion loses integer precision: 'unsigned int' to 'ddsrt_mode_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        buf->stat_mode = _buf.st_mode;
                       ~ ~~~~~^~~~~~~
1 warning generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/threads/posix/threads.c:302:19: warning: implicit declaration of function 'pthread_attr_setinheritsched' is invalid in C99 [-Wimplicit-function-declaration]
    if ((result = pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED)) != 0)
                  ^
1 warning generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:247:62: warning: implicit conversion changes signedness: 'uint32_t' (aka 'unsigned int') to 'socklen_t' (aka 'int') [-Wsign-conversion]
        AF_INET, &((struct sockaddr_in *)sa)->sin_addr, buf, (uint32_t)size);
                                                             ^~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:259:65: warning: implicit conversion changes signedness: 'uint32_t' (aka 'unsigned int') to 'socklen_t' (aka 'int') [-Wsign-conversion]
        AF_INET6, &((struct sockaddr_in6 *)sa)->sin6_addr, buf, (uint32_t)size);
                                                                ^~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/sockets.c:393:59: warning: implicit conversion changes signedness: 'socklen_t' (aka 'int') to 'size_t' (aka 'unsigned int') [-Wsign-conversion]
          memcpy(&hent->addrs[addrno], res->ai_addr, res->ai_addrlen);
          ~~~~~~                                     ~~~~~^~~~~~~~~~
3 warnings generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:141:8: warning: implicit conversion changes signedness: 'socklen_t' (aka 'int') to 'size_t' (aka 'unsigned int') [-Wsign-conversion]
  sz = ddsrt_sockaddr_get_size(sys_ifa->ifa_addr);
     ~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:192:7: warning: implicit declaration of function 'getifaddrs' is invalid in C99 [-Wimplicit-function-declaration]
  if (getifaddrs(&sys_ifa_root) == -1) {
      ^
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:234:5: warning: implicit declaration of function 'freeifaddrs' is invalid in C99 [-Wimplicit-function-declaration]
    freeifaddrs(sys_ifa_root);
    ^
3 warnings generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/filesystem/posix/filesystem.c:72:31: warning: implicit conversion loses integer precision: 'unsigned int' to 'ddsrt_mode_t' (aka 'unsigned short') [-Wimplicit-int-conversion]
        buf->stat_mode = _buf.st_mode;
                       ~ ~~~~~^~~~~~~
1 warning generated.
/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/threads/posix/threads.c:302:19: warning: implicit declaration of function 'pthread_attr_setinheritsched' is invalid in C99 [-Wimplicit-function-declaration]
    if ((result = pthread_attr_setinheritsched (&attr, PTHREAD_EXPLICIT_SCHED)) != 0)
                  ^
1 warning generated.
ld: error: undefined symbol: getifaddrs
>>> referenced by ifaddrs.c:192 (/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:192)
>>>               CMakeFiles/ddsc.dir/__/ddsrt/src/ifaddrs/posix/ifaddrs.c.o:(ddsrt_getifaddrs)

ld: error: undefined symbol: freeifaddrs
>>> referenced by ifaddrs.c:234 (/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:234)
>>>               CMakeFiles/ddsc.dir/__/ddsrt/src/ifaddrs/posix/ifaddrs.c.o:(ddsrt_getifaddrs)
>>> referenced by ifaddrs.c:234 (/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:234)
>>>               CMakeFiles/ddsc.dir/__/ddsrt/src/ifaddrs/posix/ifaddrs.c.o:(ddsrt_getifaddrs)
>>> referenced by ifaddrs.c:234 (/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/ifaddrs/posix/ifaddrs.c:234)
>>>               CMakeFiles/ddsc.dir/__/ddsrt/src/ifaddrs/posix/ifaddrs.c.o:(ddsrt_getifaddrs)

ld: error: undefined symbol: pthread_attr_setinheritsched
>>> referenced by threads.c:302 (/mnt/d/ros2-humble/src/cyclonedds/src/ddsrt/src/threads/posix/threads.c:302)
>>>               CMakeFiles/ddsc.dir/__/ddsrt/src/threads/posix/threads.c.o:(ddsrt_thread_create)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/core/CMakeFiles/ddsc.dir/build.make:2353: lib/libddsc.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:499: src/core/CMakeFiles/ddsc.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
---
Failed   <<< cyclonedds [9min 55s, exited with code 2]
eboasson commented 1 year ago

The issues with getifaddrs and pthreads are somewhat strange: I would not expect problems there. Unfortunately, I don't have any experience using the Android NDK. Possibly building via colcon doesn't allow you to control the build settings, like https://github.com/eclipse-cyclonedds/cyclonedds/tree/master/ports/android suggests?

The issues in the IDL compiler, I would "solve" by not building it: it is not needed at run-time anyway.

At ROSCon there was a presentation about using ROS on Android (https://roscon.ros.org/2022/ "Building ROS 2 enabled Android apps with C++"). I suspect you have more chance of finding useful info here then I can provide you with ...