From b45c681b82f9fdfd0317ee1e5ebe202ad4c99bb0 Mon Sep 17 00:00:00 2001 From: madratman Date: Mon, 13 Apr 2020 09:34:21 -0700 Subject: [PATCH] [ros] fix build - add libc++ with gcc in ros/cmakelists, move clang only flags in if-else clause in commonsetup.cmake --- cmake/cmake-modules/CommonSetup.cmake | 5 +++-- docs/airsim_ros_pkgs.md | 4 ++++ ros/src/airsim_ros_pkgs/CMakeLists.txt | 7 ++++++- ros/src/airsim_tutorial_pkgs/CMakeLists.txt | 1 - 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/cmake/cmake-modules/CommonSetup.cmake b/cmake/cmake-modules/CommonSetup.cmake index a40d7276fd..bae440fb44 100644 --- a/cmake/cmake-modules/CommonSetup.cmake +++ b/cmake/cmake-modules/CommonSetup.cmake @@ -53,14 +53,15 @@ macro(CommonSetup) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wstrict-aliasing -D__CLANG__") else () set(CMAKE_CXX_FLAGS "\ - -std=c++17 -stdlib=libc++ -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \ + -std=c++17 -ggdb -Wall -Wextra -Wstrict-aliasing -Wunreachable-code -Wcast-qual -Wctor-dtor-privacy \ -Wdisabled-optimization -Wformat=2 -Winit-self -Wmissing-include-dirs -Wswitch-default \ -Wold-style-cast -Woverloaded-virtual -Wredundant-decls -Wshadow -Wstrict-overflow=5 -Wswitch-default -Wundef \ - -Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -Wno-documentation -fdiagnostics-show-option \ + -Wno-variadic-macros -Wno-parentheses -Wno-unused-function -Wno-unused -fdiagnostics-show-option \ -pthread \ ${RPC_LIB_DEFINES} ${CMAKE_CXX_FLAGS}") if (${CMAKE_CXX_COMPILER_ID} MATCHES "Clang") + set(CMAKE_CXX_FLAGS "-stdlib=libc++ -Wno-documentation ${CMAKE_CXX_FLAGS}") set(CXX_EXP_LIB "-lc++fs -ferror-limit=10") else() set(CXX_EXP_LIB "-lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel") diff --git a/docs/airsim_ros_pkgs.md b/docs/airsim_ros_pkgs.md index 56ef7767cc..07b1d4af24 100644 --- a/docs/airsim_ros_pkgs.md +++ b/docs/airsim_ros_pkgs.md @@ -3,6 +3,10 @@ A ROS wrapper over the AirSim C++ client library. ## Setup +- Install gcc >= 8.0.0 +`sudo apt-get install gcc-8 g++-8` +Verify version by `gcc --version` + - Ubuntu 16.04 * Install [ROS kinetic](https://wiki.ros.org/kinetic/Installation/Ubuntu) diff --git a/ros/src/airsim_ros_pkgs/CMakeLists.txt b/ros/src/airsim_ros_pkgs/CMakeLists.txt index 65ab3dff9b..a508575d17 100644 --- a/ros/src/airsim_ros_pkgs/CMakeLists.txt +++ b/ros/src/airsim_ros_pkgs/CMakeLists.txt @@ -8,7 +8,12 @@ add_subdirectory("${AIRSIM_ROOT}/cmake/rpclib_wrapper" rpclib_wrapper) add_subdirectory("${AIRSIM_ROOT}/cmake/AirLib" AirLib) add_subdirectory("${AIRSIM_ROOT}/cmake/MavLinkCom" MavLinkCom) -set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD 11) +set(CXX_EXP_LIB "-nostdinc++ -I/usr/include/c++/8 -I/usr/include/x86_64-linux-gnu/c++/8 -nodefaultlibs +-l/usr/lib/x86_64-linux-gnu/libc++.so -l/usr/lib/x86_64-linux-gnu/libc++abi.so +-lm -lc -lgcc_s -lgcc +-lstdc++fs -fmax-errors=10 -Wnoexcept -Wstrict-null-sentinel") + set(RPC_LIB_INCLUDES " ${AIRSIM_ROOT}/external/rpclib/rpclib-2.2.1/include") set(RPC_LIB rpc) # name of .a file with lib prefix message(STATUS "found RPC_LIB_INCLUDES=${RPC_LIB_INCLUDES}") diff --git a/ros/src/airsim_tutorial_pkgs/CMakeLists.txt b/ros/src/airsim_tutorial_pkgs/CMakeLists.txt index 1ded5756c7..db27f90aa6 100644 --- a/ros/src/airsim_tutorial_pkgs/CMakeLists.txt +++ b/ros/src/airsim_tutorial_pkgs/CMakeLists.txt @@ -18,7 +18,6 @@ find_package(catkin REQUIRED COMPONENTS tf2_ros ) - catkin_package( INCLUDE_DIRS CATKIN_DEPENDS message_runtime roscpp std_msgs airsim_ros_pkgs