eProsima / foonathan_memory_vendor

foonathan/memory vendor package for Fast DDS. Looking for commercial support? Contact info@eprosima.com
Apache License 2.0
24 stars 46 forks source link

foonathan_memory_vendor cannot generate container_node_sizes_impl.hpp when cross-compiling for armhf #15

Closed MartinCornelis2 closed 4 years ago

MartinCornelis2 commented 5 years ago

When I try to cross-compile the latest version of ROS2 for armhf I get the following error for foonathan_memory_vendor:

--- stderr: foonathan_memory_vendor
Cloning into 'foo_mem-ext'...
Already on 'master'
Submodule 'cmake/comp' (https://github.com/foonathan/compatibility.git) registered for path 'cmake/comp'
Cloning into '/ros2_ws/build/foonathan_memory_vendor/foo_mem-ext-prefix/src/foo_mem-ext/cmake/comp'...
CMake Warning at src/CMakeLists.txt:86 (message):
  cannot generate container_node_sizes_impl.hpp, node size information will
  be unavailable
---

Which in turn makes the FastRTPS install fail


--- stderr: fastrtps
In file included from /ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.h:32,
                 from /ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:22:
/ros2_ws/install/include/foonathan_memory/foonathan/memory/container.hpp:376:31: error: expected template-name before ‘<’ token
         : shared_ptr_node_size<T, std_allocator<T, RawAllocator, Mutex>>
                               ^
/ros2_ws/install/include/foonathan_memory/foonathan/memory/container.hpp:376:31: error: expected ‘{’ before ‘<’ token
/ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:53:46: error: ‘set_node_size’ is not a member of ‘memory’
 constexpr size_t changes_node_size = memory::set_node_size<std::pair<size_t, SequenceNumber_t>>::value;
                                              ^~~~~~~~~~~~~
/ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:53:46: note: suggested alternative: ‘bad_node_size’
 constexpr size_t changes_node_size = memory::set_node_size<std::pair<size_t, SequenceNumber_t>>::value;
                                              ^~~~~~~~~~~~~
                                              bad_node_size
/ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:53:94: error: expected primary-expression before ‘>’ token
 constexpr size_t changes_node_size = memory::set_node_size<std::pair<size_t, SequenceNumber_t>>::value;
                                                                                              ^~
/ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:53:98: error: ‘::value’ has not been declared
 constexpr size_t changes_node_size = memory::set_node_size<std::pair<size_t, SequenceNumber_t>>::value;
                                                                                                  ^~~~~
make[2]: *** [src/cpp/CMakeFiles/fastrtps.dir/build.make:388: src/cpp/CMakeFiles/fastrtps.dir/rtps/reader/WriterProxy.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:987: src/cpp/CMakeFiles/fastrtps.dir/all] Error 2
make: *** [Makefile:163: all] Error 2
---
Failed   <<< fastrtps   [ Exited with code 2 ]

CMake toolchain:

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_PROCESSOR arm)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")

set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

set(PYTHON_SOABI cpython-37m-arm-linux-gnueabihf)

set(THREADS_PTHREAD_ARG "0" CACHE STRING "Result from TRY_RUN" FORCE)

Can you have a look at this? If you need more information from my side please let me know.

wtsnyder commented 4 years ago

I dug into this a bit and was able to get my crosscompile builds for aarch64 and armhf working. The error you point out above:

In file included from /ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.h:32, from /ros2_ws/src/eProsima/Fast-RTPS/src/cpp/rtps/reader/WriterProxy.cpp:22: /ros2_ws/install/include/foonathan_memory/foonathan/memory/container.hpp:376:31: error: expected template-name before ‘<’ token : shared_ptr_node_size<T, std_allocator<T, RawAllocator, Mutex>>

is a problem with foonathan/memory when the FOONATHAN_MEMORY_BUILD_TOOLS is disabled. Unfortunately, fixing this does not allow FastRTPS to build because it utilizes some of the foonathan/memory features disabled when crosscompiling.

I have added a fix to the foonathan/memory cmake here https://github.com/foonathan/memory/pull/60 to allow all of the foonathan/memory features to work when crosscompiling.

vincent-hui commented 4 years ago

Was this issue fixed? Should I clone the master brench of foonathan_memory_vendor for cross-compiling foonathan_memory?

MiguelCompany commented 4 years ago

It has been reported here and here that cross-compiling is now working.

Closing this

jayhou commented 4 years ago

I'm cross-compiling ros2 too, the warning message for me is actually a qemu crash problem. "CMake Warning at src/CMakeLists.txt:86 (message): cannot generate container_node_sizes_impl.hpp, node size information will be unavailable"

qemu crash log: qemu: uncaught target signal 11 (Segmentation fault) - core dumped Segmentation fault (core dumped)