Linker problems when using OpenCV with CUDA 5.5

Hi,

recently I updated from CUDA 5.0 to 5.5. I have a program which uses opencv, but I run into problems when I try to compile my program since I updated CUDA.
I get the following error at the end of the compilation process:
nvlink fatal : Unsupported file type ‘/path/to/opencv/lib/libopencv_calib3d.so’

The first thing I did when I saw the error was compiling and installing the newest version of opencv (2.4.6.1). The compilation of opencv went smoothly, but I still get the same error.

Does anyone know why this error occurs?

I’m using ubuntu 12.04 and gcc 4.6.

I start the compilation with the following command:
nvcc --ptxas-options=-v -arch sm_30 -lineinfo pkg-config --cflags opencv main.cu pkg-config --libs opencv -o a.out

Hi,

I tried CUDA 5.5 and OpenCV 2.4.6.1, no error when compiled example sample below.

$ g++ -I/usr/local/opencv/include -L/usr/local/opencv/lib -L/usr/local/cuda/lib64 short_example.cpp -lopencv_core -lopencv_gpu -lopencv_highgui -lnppc -lnppi

Short example:

#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"

int main (int argc, char* argv[])
{
    try
    {
        cv::Mat src_host = cv::imread("file.png", CV_LOAD_IMAGE_GRAYSCALE);
        cv::gpu::GpuMat dst, src;
        src.upload(src_host);

        cv::gpu::threshold(src, dst, 128.0, 255.0, CV_THRESH_BINARY);

        //cv::Mat result_host = dst;
        cv::Mat result_host;
        dst.download(result_host);
        cv::imshow("Result", result_host);
        cv::waitKey();
    }
    catch(const cv::Exception& ex)
    {
        std::cout << "Error: " << ex.what() << std::endl;
    }
    return 0;
}

Thanks for your reply, ryluo.
I removed the pkg-config parts and now include/link only to the libraries I’m using in my .cu-file and it’s working now. But I still don’t understand why this error occured in the first place. The pkg-config output seems to be ok (the directories are correct) + it’s working with the nvcc of CUDA 5.0.

But it doesn’t matter. I’m just happy that it’s working now. Thanks again.