Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

编译lidar2camera\manual_calib报错问题及解决方法 #134

Open
zhjr2019 opened this issue Dec 27, 2023 · 0 comments
Open

编译lidar2camera\manual_calib报错问题及解决方法 #134

zhjr2019 opened this issue Dec 27, 2023 · 0 comments

Comments

@zhjr2019
Copy link

zhjr2019 commented Dec 27, 2023

(1)报错:add_library cannot create imported target "JsonCpp::JsonCpp" because another target with the same name already exists.
解决方法:如果通过sudo apt install libjsoncpp-dev安装的JsonCPP,修改/usr/lib/x86_64-linux-gnu/cmake/jsoncpp/jsoncpp-namespaced-targets.cmake,增加 AND NOT TARGET JsonCpp::JsonCpp
修改后jsoncpp-namespaced-targets.cmake如下

if (TARGET jsoncpp_static AND NOT TARGET JsonCpp::JsonCpp)
    add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
    set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_static")
elseif (TARGET jsoncpp_lib AND NOT TARGET JsonCpp::JsonCpp)
    add_library(JsonCpp::JsonCpp INTERFACE IMPORTED)
    set_target_properties(JsonCpp::JsonCpp PROPERTIES INTERFACE_LINK_LIBRARIES "jsoncpp_lib")
endif ()

(2)报错:cc1plus: error: too many filenames given; type ‘cc1plus --help’ for usage
解决方法:将CMakeLists.txt中的set(CMAKE_CXX_FLAGS "-g3 -o -Wall")修改为set(CMAKE_CXX_FLAGS "-g -O3 -Wall")

修改完后的CMakeLists.txt如下:

cmake_minimum_required(VERSION 2.8.3)
project(lidar2camera)
set(CMAKE_CXX_FLAGS "-g -O3 -Wall")  # set(CMAKE_CXX_FLAGS "-g3 -o -Wall")
set(CMAKE_CXX_STANDARD 17)

find_package(Pangolin REQUIRED)  # 已安装 0.5 版,故注释掉find_package(Pangolin 0.8 REQUIRED)
include_directories(${Pangolin_INCLUDE_DIRS})
link_directories(${Pangolin_LIBRARY_DIRS})

find_package(PCL REQUIRED)  # 已安装 1.13.1 版,故注释掉find_package(PCL 1.9 EXACT REQUIRED)
find_package(Boost REQUIRED system)
find_package(OpenCV REQUIRED)
find_package(jsoncpp REQUIRED)

include_directories(${PCL_INCLUDE_DIRS})
include_directories(${OpenCV_INCLUDE_DIRS})
include_directories(${EIGEN_ROOT})
include_directories(${PROJECT_SOURCE_DIR}/include)
include_directories(${PROJECT_SOURCE_DIR}/src)

link_directories(${OpenCV_LIBRARY_DIRS})

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)

add_executable(run_lidar2camera src/run_lidar2camera.cpp)
target_link_libraries(run_lidar2camera jsoncpp_lib ${PCL_LIBRARIES} ${Pangolin_LIBRARIES} ${OpenCV_LIBS} ${Boost_SYSTEM_LIBRARY})

编译成功:
zhjr@Karon:/mnt/c/Users/zhjr/zhjrProjects/SensorsCalibration/lidar2camera/manual_calib$ cmake -S . -B build
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
Compatibility with CMake < 2.8.12 will be removed from a future version of
CMake.

Update the VERSION argument value or use a ... suffix to tell
CMake that the project does not need compatibility with older versions.

-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) at CMakeLists.txt:10 (find_package):
Ignoring EXACT since no version is requested.
This warning is for project developers. Use -Wno-dev to suppress it.

-- Checking for module 'eigen3'
-- Found eigen3, version 3.4.0
-- Found Eigen: /usr/include/eigen3 (Required is at least version "3.1")
-- Eigen found (include: /usr/include/eigen3, version: 3.4.0)
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.65.0") found components: system filesystem date_time iostreams serialization
-- Checking for module 'flann'
-- Found flann, version 1.9.1
-- Found FLANN: /usr/lib/x86_64-linux-gnu/libflann_cpp.so
-- FLANN found (include: /usr/include, lib: /usr/lib/x86_64-linux-gnu/libflann_cpp.so)
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Found GLEW: /usr/lib/x86_64-linux-gnu/libGLEW.so
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so found components: OpenGL GLX
-- Found MPI_C: /usr/lib/x86_64-linux-gnu/libmpi.so (found version "3.1")
-- Found MPI: TRUE (found version "3.1") found components: C
-- Found JsonCpp: /usr/lib/x86_64-linux-gnu/libjsoncpp.so (found suitable version "1.9.5", minimum required is "0.7.0")
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11")
-- Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version "1.6.37")
-- Found Eigen3: /usr/include/eigen3 (found version "3.4.0")
-- Found X11: /usr/include
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found EXPAT: /usr/lib/x86_64-linux-gnu/libexpat.so (found version "2.4.7")
-- Found double-conversion: /usr/lib/x86_64-linux-gnu/libdouble-conversion.so
-- Found LZ4: /usr/lib/x86_64-linux-gnu/liblz4.so (found version "1.9.3")
-- Found LZMA: /usr/lib/x86_64-linux-gnu/liblzma.so (found version "5.2.5")
-- Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (found version "80")
-- Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version "4.3.0")
-- Found Freetype: /usr/lib/x86_64-linux-gnu/libfreetype.so (found version "2.11.1")
-- Found utf8cpp: /usr/include/utf8cpp
-- Checking for module 'libusb-1.0'
-- Found libusb-1.0, version 1.0.25
-- Found libusb: /usr/lib/x86_64-linux-gnu/libusb-1.0.so
-- Found OpenNI: /usr/lib/libOpenNI.so;libusb::libusb (found version "1.5.4.0")
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- Found OpenNI2: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb (found version "2.2.0.33")
-- OpenNI2 found (version: 2.2.0.33, include: /mnt/c/Program Files/PCL 1.13.1/3rdParty/OpenNI2/Include, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
** WARNING ** io features related to pcap will be disabled
-- Eigen found (include: /usr/include/eigen3, version: 3.4.0)
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- OpenNI2 found (version: 2.2.0.33, include: /mnt/c/Program Files/PCL 1.13.1/3rdParty/OpenNI2/Include, lib: /usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb)
-- Found Qhull version 8.0.2
-- OpenNI found (version: 1.5.4.0, include: /usr/include/ni, lib: /usr/lib/libOpenNI.so;libusb::libusb)
-- looking for PCL_COMMON
-- Found PCL_COMMON: /usr/lib/x86_64-linux-gnu/libpcl_common.so
-- looking for PCL_KDTREE
-- Found PCL_KDTREE: /usr/lib/x86_64-linux-gnu/libpcl_kdtree.so
-- looking for PCL_OCTREE
-- Found PCL_OCTREE: /usr/lib/x86_64-linux-gnu/libpcl_octree.so
-- looking for PCL_SEARCH
-- Found PCL_SEARCH: /usr/lib/x86_64-linux-gnu/libpcl_search.so
-- looking for PCL_SAMPLE_CONSENSUS
-- Found PCL_SAMPLE_CONSENSUS: /usr/lib/x86_64-linux-gnu/libpcl_sample_consensus.so
-- looking for PCL_FILTERS
-- Found PCL_FILTERS: /usr/lib/x86_64-linux-gnu/libpcl_filters.so
-- looking for PCL_2D
-- Found PCL_2D: /usr/include/pcl-1.12
-- looking for PCL_GEOMETRY
-- Found PCL_GEOMETRY: /usr/include/pcl-1.12
-- looking for PCL_IO
-- Found PCL_IO: /usr/lib/x86_64-linux-gnu/libpcl_io.so
-- looking for PCL_FEATURES
-- Found PCL_FEATURES: /usr/lib/x86_64-linux-gnu/libpcl_features.so
-- looking for PCL_ML
-- Found PCL_ML: /usr/lib/x86_64-linux-gnu/libpcl_ml.so
-- looking for PCL_SEGMENTATION
-- Found PCL_SEGMENTATION: /usr/lib/x86_64-linux-gnu/libpcl_segmentation.so
-- looking for PCL_VISUALIZATION
-- Found PCL_VISUALIZATION: /usr/lib/x86_64-linux-gnu/libpcl_visualization.so
-- looking for PCL_SURFACE
-- Found PCL_SURFACE: /usr/lib/x86_64-linux-gnu/libpcl_surface.so
-- looking for PCL_REGISTRATION
-- Found PCL_REGISTRATION: /usr/lib/x86_64-linux-gnu/libpcl_registration.so
-- looking for PCL_KEYPOINTS
-- Found PCL_KEYPOINTS: /usr/lib/x86_64-linux-gnu/libpcl_keypoints.so
-- looking for PCL_TRACKING
-- Found PCL_TRACKING: /usr/lib/x86_64-linux-gnu/libpcl_tracking.so
-- looking for PCL_RECOGNITION
-- Found PCL_RECOGNITION: /usr/lib/x86_64-linux-gnu/libpcl_recognition.so
-- looking for PCL_STEREO
-- Found PCL_STEREO: /usr/lib/x86_64-linux-gnu/libpcl_stereo.so
-- looking for PCL_APPS
-- Found PCL_APPS: /usr/lib/x86_64-linux-gnu/libpcl_apps.so
-- looking for PCL_IN_HAND_SCANNER
-- Found PCL_IN_HAND_SCANNER: /usr/include/pcl-1.12
-- looking for PCL_MODELER
-- Found PCL_MODELER: /usr/include/pcl-1.12
-- looking for PCL_POINT_CLOUD_EDITOR
-- Found PCL_POINT_CLOUD_EDITOR: /usr/include/pcl-1.12
-- looking for PCL_OUTOFCORE
-- Found PCL_OUTOFCORE: /usr/lib/x86_64-linux-gnu/libpcl_outofcore.so
-- looking for PCL_PEOPLE
-- Found PCL_PEOPLE: /usr/lib/x86_64-linux-gnu/libpcl_people.so
-- Found PCL: pcl_common;pcl_kdtree;pcl_octree;pcl_search;pcl_sample_consensus;pcl_filters;pcl_io;pcl_features;pcl_ml;pcl_segmentation;pcl_visualization;pcl_surface;pcl_registration;pcl_keypoints;pcl_tracking;pcl_recognition;pcl_stereo;pcl_apps;pcl_outofcore;pcl_people;Boost::system;Boost::filesystem;Boost::date_time;Boost::iostreams;Boost::serialization;/usr/lib/libOpenNI.so;libusb::libusb;/usr/lib/x86_64-linux-gnu/libOpenNI2.so;libusb::libusb;VTK::ChartsCore;VTK::CommonColor;VTK::CommonComputationalGeometry;VTK::CommonCore;VTK::CommonDataModel;VTK::CommonExecutionModel;VTK::CommonMath;VTK::CommonMisc;VTK::CommonTransforms;VTK::FiltersCore;VTK::FiltersExtraction;VTK::FiltersGeneral;VTK::FiltersGeometry;VTK::FiltersModeling;VTK::FiltersSources;VTK::ImagingCore;VTK::ImagingSources;VTK::InteractionImage;VTK::InteractionStyle;VTK::InteractionWidgets;VTK::IOCore;VTK::IOGeometry;VTK::IOImage;VTK::IOLegacy;VTK::IOPLY;VTK::RenderingAnnotation;VTK::RenderingCore;VTK::RenderingContext2D;VTK::RenderingLOD;VTK::RenderingFreeType;VTK::ViewsCore;VTK::ViewsContext2D;VTK::RenderingOpenGL2;VTK::GUISupportQt;FLANN::FLANN;QHULL::QHULL
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: system
-- Found OpenCV: /usr/local/opencv480 (found version "4.8.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/c/Users/zhjr/zhjrProjects/SensorsCalibration/lidar2camera/manual_calib/build
zhjr@Karon:/mnt/c/Users/zhjr/zhjrProjects/SensorsCalibration/lidar2camera/manual_calib$ cmake --build build
[ 50%] Building CXX object CMakeFiles/run_lidar2camera.dir/src/run_lidar2camera.cpp.o
[100%] Linking CXX executable ../bin/run_lidar2camera
[100%] Built target run_lidar2camera

运行:./bin/run_lidar2camera data/0.png data/0.pcd data/center_camera-intrinsic.json data/top_center_lidar-to-center_camera-extrinsic.json
显示:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant