undefined reference to cv::cuda::dft

asked 2019-07-27 16:00:38 -0600

stiv-yakovenko gravatar image

I've build opencv with CUDA support on my CentOS linux with NVIDIA with CUDA support:

image description

compilation completes successfully and then I do this to install it in the system:

sudo make install (which also succeeds)

Now I try to build simple test application:

#include <opencv2/opencv.hpp>
#include<opencv2/core.hpp>
#include<opencv2/core/utility.hpp>
#include<opencv2/highgui.hpp>
#include<opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/cuda.hpp>
#include <opencv2/cudaarithm.hpp> 
using namespace cv; 
Mat gpuFft(Mat&img){
    Mat r;
    cuda::GpuMat imageG, imgFFTG;
    imageG.upload(img);
    cuda::dft(imageG, imgFFTG, imageG.size());
    imgFFTG.download(r);
    return r; 
}

This is cmake config:

cmake_minimum_required(VERSION 3.1)
get_filename_component(ProjectId ${CMAKE_CURRENT_LIST_DIR} NAME)
string(REPLACE " " "_" ProjectId ${ProjectId})
project(${ProjectId} LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package( OpenCV COMPONENTS core imgproc highgui flann REQUIRED )
set(CMAKE_INCLUDE_CURRENT_DIR ON)
FILE(GLOB sources *.cpp)
add_executable(${PROJECT_NAME} ${sources})
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})

Cmake finishes sucessfully:

-- Configuring done
-- Generating done
-- Build files have been written to: /home/stiv/fft_test/build

And make fails here:

/usr/bin/c++    -rdynamic CMakeFiles/fft_test.dir/fft_test.cpp.o  -o fft_test  -L/usr/local/cuda/lib64 -Wl,-rpath,/usr/local/cuda/lib64:/usr/local/lib64 /usr/local/lib64/libopencv_highgui.so.3.4.1 /usr/local/lib64/libopencv_flann.so.3.4.1 /usr/local/lib64/libopencv_videoio.so.3.4.1 /usr/local/lib64/libopencv_imgcodecs.so.3.4.1 /usr/local/lib64/libopencv_imgproc.so.3.4.1 /usr/local/lib64/libopencv_core.so.3.4.1 /usr/local/lib64/libopencv_cudev.so.3.4.1
CMakeFiles/fft_test.dir/fft_test.cpp.o: In function `gpuFft(cv::Mat&)':
fft_test.cpp:(.text+0x1c1): undefined reference to `cv::cuda::dft(cv::_InputArray const&, cv::_OutputArray const&, cv::Size_<int>, int, cv::cuda::Stream&)'
collect2: error: ld returned 1 exit status

Why is this? How can I fix it?

edit retag flag offensive close merge delete