在linux上安装Opencv时出错

时间:2015-11-30 12:10:36

标签: linux opencv cuda

我正在尝试在linux平台上安装Opencv。基本上,我关注http://sysads.co.uk/2014/05/install-opencv-2-4-9-ubuntu-14-04-13-10/

但每当我尝试构建样本时,我都会收到以下错误 -

compiling contours.c
  /usr/bin/ld: cannot find -lcufft
  /usr/bin/ld: cannot find -lnpps
  /usr/bin/ld: cannot find -lnppi
  /usr/bin/ld: cannot find -lnppc

但是,我在/usr/local/cuda-7.5/中拥有所有这些文件。 我正确安装了CUDA。 lspci -v -s $(lspci | grep VGA | cut -d" " -f 1)

的输出
01:00.0 VGA compatible controller: NVIDIA Corporation GK107GL [Quadro K600] (rev a1) (prog-if 00 [VGA controller])
    Subsystem: Hewlett-Packard Company Device 094b
    Physical Slot: 2
    Flags: bus master, fast devsel, latency 0, IRQ 30
    Memory at ee000000 (32-bit, non-prefetchable) [size=16M]
    Memory at d0000000 (64-bit, prefetchable) [size=256M]
    Memory at e0000000 (64-bit, prefetchable) [size=32M]
    I/O ports at e000 [size=128]
    [virtual] Expansion ROM at ef000000 [disabled] [size=512K]
    Capabilities: <access denied>
    Kernel driver in use: nvidia

请帮忙。

1 个答案:

答案 0 :(得分:2)

我已经通过编辑build_all.sh目录中的/usr/local/share/OpenCV/samples/c来解决了这个问题。 新build_all.sh是:

#!/bin/sh

if [ $# -gt 0 ] ; then
    base=`basename $1 .c`
    echo "compiling $base"
    gcc -ggdb -L /usr/local/cuda-7.5/lib64 `pkg-config opencv --cflags --libs` $base.c -o $base
else
    for i in *.c; do
        echo "compiling $i"
        gcc -ggdb -L /usr/local/cuda-7.5/lib64 `pkg-config --cflags opencv` -o `basename $i .c` $i `pkg-config --libs opencv`;
    done
    for i in *.cpp; do
        echo "compiling $i"
        g++ -ggdb -L /usr/local/cuda-7.5/lib64 `pkg-config --cflags opencv` -o `basename $i .cpp` $i `pkg-config --libs opencv`;
    done
fi