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

Revision history [back]

I solved all my issues by using an up to date version of arm-linux-gnueabihf-g++. Thank you @pokitoz for your help.

On the Raspberry, with Raspbian Stretch, this is the compiler which is already installed

# arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516

So I installed it on my laptop https://packages.ubuntu.com/search?keywords=g%2B%2B-6-arm-linux-gnueabihf

$ sudo apt-get install g++-6-arm-linux-gnueabihf

There exists also a more recent version (7.2) but I have not tried if it works.

This is the rpi_toolchainfile.cmake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-6)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++-6)

set(CMAKE_FIND_ROOT_PATH
  ${CMAKE_CURRENT_LIST_DIR}/install
)

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)


# This assumes that pthread will be available on the target system
# (this emulates that the return of the TRY_RUN is a return code "0"
set(THREADS_PTHREAD_ARG "0"
  CACHE STRING "Result from TRY_RUN" FORCE)

This is the running script

colcon \
    build \
    --merge-install \
    --cmake-force-configure \
    --cmake-args \
    -DCMAKE_TOOLCHAIN_FILE=`pwd`/rpi_toolchainfile.cmake \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
    -DTHIRDPARTY=ON \
    -DBUILD_TESTING=0

I solved all my issues by using an up to date version of arm-linux-gnueabihf-g++. Thank you @pokitoz for your help.

On the Raspberry, with Raspbian Stretch, this is the compiler which is already installed

# arm-linux-gnueabihf-g++ --version
arm-linux-gnueabihf-g++ (Raspbian 6.3.0-18+rpi1+deb9u1) 6.3.0 20170516

So I installed it on my laptop https://packages.ubuntu.com/search?keywords=g%2B%2B-6-arm-linux-gnueabihf

$ sudo apt-get install g++-6-arm-linux-gnueabihf

There exists also a more recent version (7.2) but I have not tried if it works.

This is the rpi_toolchainfile.cmake

set(CMAKE_SYSTEM_NAME Linux)
set(CMAKE_SYSTEM_VERSION 1)

# specify the cross compiler
set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-6)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++-6)

set(CMAKE_FIND_ROOT_PATH
  ${CMAKE_CURRENT_LIST_DIR}/install
)

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)


# This assumes that pthread will be available on the target system
# (this emulates that the return of the TRY_RUN is a return code "0"
set(THREADS_PTHREAD_ARG "0"
  CACHE STRING "Result from TRY_RUN" FORCE)

This is the running script

colcon \
    build \
    --merge-install \
    --cmake-force-configure \
    --cmake-args \
    -DCMAKE_TOOLCHAIN_FILE=`pwd`/rpi_toolchainfile.cmake \
    -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
    -DTHIRDPARTY=ON \
    -DBUILD_TESTING=0
-DBUILD_TESTING=0 \ -DCMAKE_BUILD_RPATH="`pwd`/build/poco_vendor/poco_external_project_install/lib/;`pwd`/build/libyaml_vendor/libyaml_install/lib/"