VINS-Fisheye icon indicating copy to clipboard operation
VINS-Fisheye copied to clipboard

run ros node error:OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda or 3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp, line 97 terminate called after throwing an instance of 'cv::Exception'

Open DandyLorenz opened this issue 2 years ago • 7 comments

@xuhao1 Hello, thank you for your contribution。I running ros node will prompt the following error, making it impossible to continue working,node is :roslaunch vins fisheye_split.launch config_file:=my_ws/src/VINS-Fusion-Fisheye/config/fisheye_ptgrey_n3/fisheye_cuda.yaml. this is main error tips:

[ INFO] [1645089433.405895309]: reading paramerter of camera /ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/../config/fisheye_ptgrey_n3/up.yaml
[ INFO] [1645089433.406075121]: Use as fisheye /ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/../config/fisheye_ptgrey_n3/up.yaml
[ INFO] [1645089433.411483310]: Build for camera 0
[ INFO] [1645089433.411535184]: Center FOV: 2.181662_center
[ INFO] [1645089433.411569013]: Side image height: 312

**OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp, line 97
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp:97: error: (-216) The library is compiled without CUDA support in function throw_no_cuda**

Complete error prompt, I will supplement the conversation.

Of course, here is my installation process:

1.In the ROS environment where I have installed and successfully run vins fusion,Prove that my ROS environment is normal,this is my config:

System:Ubuntu 18.04
ROS: Melodic
Computer type and graphics card: notebook and Nvidia M950

2.I first install nvidia driver and support cuda,this is my step: I install nvidia driver version 470.94, and install CUDA Version 10.0,it work will

3.About opencv and cuda: build and install opencv,I download opencv version 3.4.1 build and install, this is my conmmand to build opencv with cuda : opencv with cuda Depend on libSGM,first build and install it:

 git clone https://github.com/fixstars/libSGM.git
 cd libSGM
 git submodule update --init  # It is needed if ENABLE_TESTS option is set to ON
 mkdir build
 cd build
 cmake ../  # Several options available
 make

there have some error about: FutureTrack. solved by recompiling libsgm with opencv 3.4, build-opencv-wrapper and build-shared-library options in the cmake file. By default does options are not enabled. vi /ros/libSGM/CMakeLists.txt #set enabled this: option(LIBSGM_SHARED ON) option(BUILD_OPENCV_WRAPPER ON) rebuild libSGM. if you build and install libsgm ok,then build openvb,this is my config:

cmake \
	-D CMAKE_BUILD_TYPE=RELEASE \
	-D CMAKE_INSTALL_PREFIX=/usr/local \
        -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.4.1/modules \
	-D CUDA_CUDA_LIBRARY=/usr/local/cuda/lib64/stubs/libcuda.so \
	-D CUDA_ARCH_BIN=7.5 \
	-D CUDA_ARCH_PTX="" \
	-D WITH_CUDA=ON \
	-D WITH_TBB=ON \
	-D BUILD_NEW_PYTHON_SUPPORT=ON \
	-D WITH_V4L=ON \
	-D INSTALL_C_EXAMPLES=ON \
	-D INSTALL_PYTHON_EXAMPLES=ON \
	-D BUILD_EXAMPLES=ON \
	-D WITH_QT=ON \
	-D WITH_OPENGL=ON \
	-D ENABLE_FAST_MATH=1 \
	-D CUDA_FAST_MATH=1 \
	-D WITH_CUBLAS=1 \
	-D WITH_NVCUVID=ON \
	-D BUILD_opencv_cudacodec=OFF ..

It build error and tips: recipe for target 'bin/example_gpu_driver_api_multi' faile I took the following methods to solve and compile successfully: New code: if(HAVE_CUDA AND NOT ANDROID) ocv_target_link_libraries(${tgt} ${CUDA_CUDA_LIBRARY}) endif() vi ../samples/gpu/CMakeLists.txt

 foreach(sample_filename ${all_samples}) 
   ocv_define_sample(tgt ${sample_filename} gpu) 
   ocv_target_link_libraries(${tgt} ${OPENCV_LINKER_LIBS} ${OPENCV_CUDA_SAMPLES_REQUIRED_DEPS}) 
  if(HAVE_CUDA AND NOT ANDROID)
    ocv_target_link_libraries(${tgt} ${CUDA_CUDA_LIBRARY})
  endif() 
   if(HAVE_opencv_xfeatures2d) 
     ocv_target_link_libraries(${tgt} opencv_xfeatures2d) 
   endif()

and then:

sudo make 
sudo make install
Configuration oepncv environment:
sudo vi /etc/ld. so. conf.d/opencv. conf
#Add at the end of the open file:
/usr/local/lib
#Execute the command to make the above changes effective:
sudo ldconfig
#Configure Bash
sudo vi /etc/bash. bashrc
#Add at the end of the open file:
PKG_ CONFIG_ PATH=$PKG_ CONFIG_ PATH:/usr/local/lib/pkgconfig
export PKG_ CONFIG_ PATH
#Save and update to make the configuration effective:
source /etc/bash. bashrc
vi ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export PATH=$PATH:/usr/local/cuda-10.0/bin
export CUDA_HOME=$CUDA_HOME:/usr/local/cuda-10.0

View version: PKG config -- modversion opencv #3.4.1 To verify the correct installation of CUDA, I execute the following command: cd /usr/local/cuda/samples/1_ Utilities/deviceQuery sudo make If the compilation is successful, you will be prompted with finished building CUDA samples cd bin/x86_ 64/linux/release ./deviceQuery Result = pass successful

4.Build Vins-Fisheye create ros workspace and init,then download and catmke Vins-Fisheye when I run catkin_make Vins-Fisheye to build it ,the implementation reaches 96% of the progress, an error is reported: vins_estimator/src/rosNodeFisheye.cpp:5:10: fatal error: backward.hpp: No such file or directory. this is my resolvent: download backward.hpp from:https://github.com/gaowenliang/code_utils/tree/master/include/code_utils cp backward.hpp /ros/vins_fisheye/src/VINS-Fisheye/camera_models/src/code_utils/ and rebuild Vins-Fisheye success with command :catkin_make, in the end warn me:/usr/bin/ld: warning: libopencv_core.so.3.2, needed by /opt/ros/melodic/lib/libcv_bridge.so, may conflict with libopencv_core.so.3.4 I don't know if this hint is one of the reasons that affect my results

then I run ros node by Author's tips, run fisheye_split.launch And where I can find this fisheye_split.launch file.? Use fisheye_node.launch instead. roslaunch vins fisheye_node.launch config_file:=/ros/vins_fisheye/src/VINS-Fisheye/config/fisheye_ptgrey_n3/fisheye_cuda.yaml Then running result fails, and the error prompt, such as the title and the previous prompt.

**OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp, line 97
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp:97: error: (-216) The library is compiled without CUDA support in function throw_no_cuda**

I hope to get help or inspiration from readers. Thank you very much!!!

DandyLorenz avatar Feb 26 '22 02:02 DandyLorenz

I add the complete error reporting prompt: when I running roslaunch vins fisheye_node.launch config_file:=/ros/vins_fisheye/src/VINS-Fisheye/config/fisheye_ptgrey_n3/fisheye_cuda.yaml

IMU_TOPIC: /dji_sdk_1/dji_sdk/imu
result path /home/xuhao/output/vio.csv
[ WARN] [1645089433.321826896]:  fix extrinsic param 
camera number 2
[ INFO] [1645089433.405648841]: Unsynchronized sensors, online estimate time offset, initial td: 0.014686
[ INFO] [1645089433.405687027]: ROW: 200 COL: 600 
 exitrinsic cam 0
   0.999702  -0.0243341 -0.00216917
   0.024313    0.999662 -0.00924233
 0.00239334  0.00918683    0.999955
 0.0242713 0.00461467  0.0898351
 exitrinsic cam 1
   0.999857    0.013222    0.010505
  0.0131731   -0.999902   0.0047134
  0.0105663 -0.00457434   -0.999934
 0.0217687 0.00214859 -0.0248288
set g    0    0 9.85
[ INFO] [1645089433.405895309]: reading paramerter of camera /ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/../config/fisheye_ptgrey_n3/up.yaml
[ INFO] [1645089433.406075121]: Use as fisheye /ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/../config/fisheye_ptgrey_n3/up.yaml
[ INFO] [1645089433.411483310]: Build for camera 0
[ INFO] [1645089433.411535184]: Center FOV: 2.181662_center
[ INFO] [1645089433.411569013]: Side image height: 312
OpenCV Error: No CUDA support (The library is compiled without CUDA support) in throw_no_cuda, file /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp, line 97
terminate called after throwing an instance of 'cv::Exception'
  what():  /build/opencv-L2vuMj/opencv-3.2.0+dfsg/modules/core/include/opencv2/core/private.cuda.hpp:97: error: (-216) The library is compiled without CUDA support in function throw_no_cuda

Stack trace (most recent call last):
#16   Object "", at 0xffffffffffffffff, in 
#15   Object "/ros/vins_fisheye/devel/lib/vins/vins_node", at 0x56464d095059, in _start
#14   Source "../csu/libc-start.c", line 310, in __libc_start_main [0x7fb1f348bbf6]
#13 | Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/rosNodeFisheye.cpp", line 30, in VinsNodeFisheye
    | >  30:     VinsNodeFisheye fisheye(n);
    |    31: 
    |    32:     ros::MultiThreadedSpinner spinner(3);
      Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/rosNodeFisheye.cpp", line 18, in main [0x56464d09423c]
         15:     public:
         16:         VinsNodeFisheye(ros::NodeHandle & nh)
         17:         {
      >  18:             Init(nh);
         19:         }
         20: };
#12   Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/fisheyeNode.cpp", line 507, in Init [0x7fb1f6d9cfb4]
        504:     std::cout << "config file is " << config_file << '\n';
        505:     readParameters(config_file);
        506: 
      > 507:     estimator.setParameter();
        508: 
        509:     ROS_INFO("Will %d GPU", USE_GPU);
        510:     if (ENABLE_DEPTH) {
#11   Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/estimator/estimator.cpp", line 60, in setParameter [0x7fb1f6b11bce]
         57:     g = G;
         58:     cout << "set g " << g.transpose() << endl;
         59:     
      >  60:     featureTracker->readIntrinsicParameter(CAM_NAMES);
         61: 
         62:     processThread   = std::thread(&Estimator::processMeasurements, this);
         63:     if (FISHEYE && ENABLE_DEPTH) {
#10   Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/estimator/../featureTracker/feature_tracker_fisheye.hpp", line 337, in readIntrinsicParameter [0x7fb1f6b44e1b]
        334:         m_camera.push_back(camera);
        335: 
        336:         ROS_INFO("Use as fisheye %s", calib_file[i].c_str());
      > 337:         FisheyeUndist un(calib_file[i].c_str(), i, FISHEYE_FOV, true, WIDTH);
        338:         fisheys_undists.push_back(un);
        339: 
        340:     }
#9  | Source "/ros/vins_fisheye/src/VINS-Fisheye/vins_estimator/src/featureTracker/fisheye_undist.hpp", line 62, in GpuMat
    |    60:                 cv::Mat maps[2];
    |    61:                 cv::split(mat.first, maps);
    | >  62:                 undistMapsGPUX.push_back(cv::cuda::GpuMat(maps[0]));
    |    63:                 undistMapsGPUY.push_back(cv::cuda::GpuMat(maps[1]));
    |    64:             }
      Source "/usr/local/include/opencv2/core/cuda.inl.hpp", line 112, in FisheyeUndist [0x7fb1f6db762c]
        109: GpuMat::GpuMat(InputArray arr, Allocator* allocator_) :
        110:     flags(0), rows(0), cols(0), step(0), data(0), refcount(0), datastart(0), dataend(0), allocator(allocator_)
        111: {
      > 112:     upload(arr);
        113: }
        114: 
        115: inline
#8    Object "/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0", at 0x7fb1f62c7898, in cv::cuda::GpuMat::upload(cv::_InputArray const&)
#7    Object "/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0", at 0x7fb1f64019be, in cv::error(int, cv::String const&, char const*, char const*, int)
#6    Object "/usr/lib/x86_64-linux-gnu/libopencv_core.so.3.2.0", at 0x7fb1f64018a1, in cv::error(cv::Exception const&)
#5    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25", at 0x7fb1f3ea3d53, in __cxa_throw
#4    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25", at 0x7fb1f3ea3b20, in std::terminate()
#3    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25", at 0x7fb1f3ea3ae5, in 
#2    Object "/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.25", at 0x7fb1f3e9d956, in 
#1    Source "/build/glibc-S9d2JN/glibc-2.27/stdlib/abort.c", line 79, in abort [0x7fb1f34aa920]
#0    Source "../sysdeps/unix/sysv/linux/raise.c", line 51, in raise [0x7fb1f34a8fb7]
Aborted (Signal sent by tkill() 3837 0)
[vins_estimator-1] process has died [pid 3837, exit code -6, cmd /ros/vins_fisheye/devel/lib/vins/vins_node __name:=vins_estimator __log:=/root/.ros/log/f7247446-8fce-11ec-8094-e4029b238d40/vins_estimator-1.log].
log file: /root/.ros/log/f7247446-8fce-11ec-8094-e4029b238d40/vins_estimator-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done```

DandyLorenz avatar Feb 26 '22 03:02 DandyLorenz

Please try the latest version in master branch

xuhao1 avatar Mar 17 '22 10:03 xuhao1

Please try the latest version in master branch

yes,i sure use last version by command: git clone https://github.com/xuhao1/VINS-Fisheye.git .so ,Is there any solution,smile

DandyLorenz avatar Mar 21 '22 02:03 DandyLorenz

@DandyLorenz This is actually a hardware driver problem, you may try CPU version instead or fix your hardware. I will publish a docker for this program later, which may also help.

xuhao1 avatar Mar 25 '22 14:03 xuhao1

Ok,thanks, I will continue to pay attention and praise~

DandyLorenz avatar Mar 26 '22 13:03 DandyLorenz

@DandyLorenz Hi, i have the same problem. Have you fixed it? Thank you very much!

zhangyangcc avatar Dec 08 '22 07:12 zhangyangcc

@DandyLorenz Hi, i have the same problem. Have you fixed it? Thank you very much!

Hi, for me, this error occurs because the package "cv_bridge" doesn't call the "opencv with cuda support". I refer to method3 in this and modify the "CvbridgeConfig.cmake". It works!

zhangyangcc avatar Dec 08 '22 13:12 zhangyangcc