Field-Robotics-Lab / nps_uw_multibeam_sonar

Multibeam sonar plugin with NVIDIA Cuda library
Apache License 2.0
35 stars 20 forks source link

nvcc fatal : Unknown option '-fPIC' #47

Closed 1ADZX closed 1 year ago

1ADZX commented 1 year ago

When I compile nps_uw_multibeam_sonar, I get the following errors: [ 91%] Building CXX object nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ros_plugin.dir/src/MaterialSwitcher.cc.o [ 91%] Building CUDA object nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/src/sonar_calculation_cuda.cu.o nvcc warning : incompatible redefinition for option 'std', the last value of this option was used nvcc fatal : Unknown option '-fPIC' nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/build.make:86: recipe for target 'nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/src/sonar_calculation_cuda.cu.o' failed make[2]: [nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/src/sonar_calculation_cuda.cu.o] Error 1 CMakeFiles/Makefile2:14091: recipe for target 'nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/all' failed make[1]: [nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ray_ros_plugin.dir/all] Error 2 make[1]: 正在等待未完成的任务.... [ 91%] Building CXX object nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ros_plugin.dir/src/SelectionBuffer.cc.o [ 91%] Building CXX object nps_uw_multibeam_sonar/CMakeFiles/nps_multibeam_sonar_ros_plugin.dir/src/SelectionRenderListener.cc.o [ 92%] Linking CUDA device code CMakeFiles/nps_multibeam_sonar_ros_plugin.dir/cmake_device_link.o [ 92%] Linking CXX shared library /home/dzx2/projects/catkin_ws/devel/lib/libnps_multibeam_sonar_ros_plugin.so [ 92%] Built target nps_multibeam_sonar_ros_plugin Makefile:140: recipe for target 'all' failed make: [all] Error 2 Invoking "make -j2" failed 终端进程“/bin/bash '-c', 'catkin_make --directory /home/dzx2/projects/catkin_ws -DCMAKE_BUILD_TYPE=RelWithDebInfo -j2 -DCMAKE_BUILD_TYPE=Debug' My computer environment is ubuntu18.04, Gazebo version is version 9.0.0, and my graphics card is RTX3080, and the corresponding CUDA version is 11.6. My CMakeLists content has been modified accordingly, as follows set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -arch=sm_60 -shared -Xcompiler -fPIC") Other content in CMakeLists.txt has not changed, but the above content is still reported, what is the situation? How to solve it? thank you very much

1ADZX commented 1 year ago

This problem needs to update my own CMake version, I am using CMake 3.18