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

Undefined reference to boost when do 'catkin_make'

asked 2020-08-21 08:41:59 -0600

jenanaputra gravatar image

updated 2022-01-22 16:16:17 -0600

Evgeny gravatar image

I'am working on melodic and trying to add Gemini SDK to ROS in my ubuntu 18.04. When I was do catkin_make in command line, I got an error be like :

'/home/jenana/catkin_ws/src/Sonar/libs/GeminiComms/x86_64-linux-gnu/x64/Release/libGeminiComms.so: undefined reference to boost::re_detail_106501::cpp_regex_traits_implementation<wchar_t>::transform_primary(wchar_t const*, wchar_t const*) const' /home/jenana/catkin_ws/src/Sonar/libs/GeminiComms/x86_64-linux-gnu/x64/Release/libGeminiComms.so: undefined reference toboost::re_detail_106501::cpp_regex_traits_implementation<char>::transform(char const, char const) const' /home/jenana/catkin_ws/src/Sonar/libs/GeminiComms/x86_64-linux-gnu/x64/Release/libGeminiComms.so: undefined reference to boost::re_detail_106501::cpp_regex_traits_implementation<wchar_t>::transform(wchar_t const*, wchar_t const*) const' /home/jenana/catkin_ws/src/Sonar/libs/GeminiComms/x86_64-linux-gnu/x64/Release/libGeminiComms.so: undefined reference toboost::re_detail_106501::cpp_regex_traits_implementation<char>::transform_primary(char const, char const) const' collect2: error: ld returned 1 exit status Sonar/src/geminisdkconsoleapp/CMakeFiles/geminisdkconsoleapp1.dir/build.make:116: recipe for target '/home/jenana/catkin_ws/devel/lib/geminisdk/geminisdkconsoleapp1' failed make[2]: [/home/jenana/catkin_ws/devel/lib/geminisdk/geminisdkconsoleapp1] Error 1 CMakeFiles/Makefile2:1037: recipe for target 'Sonar/src/geminisdkconsoleapp/CMakeFiles/geminisdkconsoleapp1.dir/all' failed make[1]: [Sonar/src/geminisdkconsoleapp/CMakeFiles/geminisdkconsoleapp1.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: * [all] Error 2'.

Does anyone know how to solve it ? I've already written boost in TARGET_LINK_LIBRARIES, but I got still an error.

I also attached my package Cmakelist file, package.xml, and my sub package Cmakelist file below:

My package Cmakelist file :

cmake_minimum_required(VERSION 3.5.1)
PROJECT(geminisdk)

if (POLICY CMP0071)
    cmake_policy(SET CMP0071 OLD)
endif()

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set (ARCH ARCH64)
message ( "Arch : ${ARCH}" )
set(SDK_PLATFORM_NAME x32)

find_package(catkin REQUIRED COMPONENTS roscpp rospy std_msgs genmsg message_generation)
find_package(Boost  REQUIRED COMPONENTS system thread filesystem)

catkin_package(
      CATKIN_DEPENDS  roscpp std_msgs message_runtime
      DEPENDS Boost
)

INCLUDE_DIRECTORIES(
     include
     ${Boost_INCLUDE_DIRS}
     ${catkin_INCLUDE_DIRS}
)

if("${ARCH}" STREQUAL "ARCH32")
     set(SDK_PLATFORM_NAME x32)
elseif("${ARCH}" STREQUAL "AARCH64")
#arm arch64
    set(SDK_PLATFORM_NAME aarch64)
else()
    set(SDK_PLATFORM_NAME x64)
endif()

if( "${CMAKE_BUILD_TYPE}" STREQUAL "" )
     set(CMAKE_BUILD_TYPE Release)
endif()

if( "${_LOW_PERFORMANCE_CPU_}" STREQUAL "1" )
     add_definitions(-D_LOW_PERFORMANCE_CPU_)
endif()

if( "${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" )
    set(STATIC_LIB_PREFIX "")
    set(DYNAMIC_LIB_SUFFIX lib)

    if( ${CMAKE_CXX_COMPILER_ID} STREQUAL MSVC )
        add_definitions(-D_WIN32_WINNT=0x0601 -D_SCL_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_WARNINGS)
    endif()

    Set( LIB_ARCHITECTURE ${CMAKE_SYSTEM_NAME})
else()
    set(STATIC_LIB_PREFIX lib)
    set(DYNAMIC_LIB_SUFFIX so)

    if( "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "armv7at2hf-neon-angstrom" )
    Set (CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} )
    endif()

    if( "${CMAKE_CXX_LIBRARY_ARCHITECTURE}" STREQUAL "" )
    set(CMAKE_CXX_LIBRARY_ARCHITECTURE ${CMAKE_SYSTEM_NAME})
    endif()

    Set( LIB_ARCHITECTURE ${CMAKE_CXX_LIBRARY_ARCHITECTURE})

    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
    #set( SYSTEM_LIBRARIES  "-lrt -lpthread")

    # Enable static linking for gcc and stdc++
    set(CMAKE_SHARED_LINKER_FLAGS "-static-libstdc++ -static-libgcc ${CMAKE_SHARED_LINKER_FLAGS}")

    set( zLIBWARPPER_LIB    ${CMAKE_CURRENT_SOURCE_DIR}/libs/zLibWrapper/${LIB_ARCHITECTURE}/${SDK_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${STATIC_LIB_PREFIX}zLibWrapper.${DYNAMIC_LIB_SUFFIX} )

endif()

set( GEMINI_COMMS_LIB   ${CMAKE_CURRENT_SOURCE_DIR}/libs/GeminiComms/${LIB_ARCHITECTURE}/${SDK_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${STATIC_LIB_PREFIX}GeminiComms.${DYNAMIC_LIB_SUFFIX} )
set( SVS5_LIB           ${CMAKE_CURRENT_SOURCE_DIR}/libs/Svs5SeqLib/${LIB_ARCHITECTURE}/${SDK_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${STATIC_LIB_PREFIX}Svs5SeqLib.${DYNAMIC_LIB_SUFFIX} )
set( GNS_SERIALIZER_LIB ${CMAKE_CURRENT_SOURCE_DIR}/libs/GenesisSerializer/${LIB_ARCHITECTURE}/${SDK_PLATFORM_NAME}/${CMAKE_BUILD_TYPE}/${STATIC_LIB_PREFIX}GenesisSerializer.${DYNAMIC_LIB_SUFFIX} )

add_subdirectory (src/geminisdkconsoleapp)

Set( EXPORT_EXE_FILES
${CMAKE_CURRENT_BINARY_DIR}/src/geminisdkconsoleapp/geminisdkconsoleapp1
)

This is my package.xml file:

<?xml version="1.0"?>
<package format="2">
<name>geminisdk</name>
<version>0.0.0</version>
<description>The geminisdk package</description>

<maintainer email="jungde@todo.todo">jungde</maintainer>

<license>TODO</license>

<buildtool_depend>catkin</buildtool_depend>
<build_depend>roscpp</build_depend>
<build_depend>rospy</build_depend>
<build_depend>std_msgs</build_depend>
<build_depend>Boost</build_depend>
<build_depend>message_generation< ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-08-22 09:56:35 -0600

fergs gravatar image

In your target_link_libraries, it should be ${Boost_LIBRARIES} not ${Boost_LIBRARY}.

edit flag offensive delete link more

Comments

I tried to do like you said, but I still got the same error when that was linking.

jenanaputra gravatar image jenanaputra  ( 2020-08-23 03:17:46 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2020-08-21 08:41:59 -0600

Seen: 733 times

Last updated: Aug 22 '20