我在使用opencv4tegra编译标准opencv示例时遇到了相当大的困难 - 按照nvidia wiki的指示安装了Jetson TK1。
出于沮丧,我从2.4.10.1源代码构建了opencv,并将其直接安装到/ usr / local ...并且它工作得很好!在我卸载之后,我遇到了与他们相同的问题,所以显然我正在做的事情。有趣的是,我可以对他们的opencv4tegra lib运行已编译的示例应用程序就好......但是我无法针对他们的lib进行编译。
测试环境:
我没有从opencv的2.4.10.1版本更改示例文件 - 它是相同的stereo_match.cpp文件。我只是想编译它。
这些函数在gpu.hpp文件中 - 我已经查过了。我也跑了:
nm /usr/lib/libopencv_gpu.so | grep StereoBM_GPU | c++filt
...只是为了确保符号在库中。
发生什么事了?所以,它显然没有链接 - 但我无法弄清楚g ++想要什么...
$:〜/ opencv / samples / gpu $
g++ -I/usr/include -L/usr/local/cuda/lib `pkg-config opencv --libs` stereo_match.cpp -o stereo_m
/tmp/ccvj1IgD.o:在函数
App::App(Params const&)': stereo_match.cpp:(.text+0x8b0): undefined reference to
cv :: gpu :: StereoBM_GPU :: StereoBM_GPU()' stereo_match.cpp :(。text + 0x8c6):未定义的引用cv::gpu::StereoBeliefPropagation::StereoBeliefPropagation(int, int, int, int)' stereo_match.cpp:(.text+0x8e0): undefined reference to
cv :: gpu :: StereoConstantSpaceBP :: StereoConstantSpaceBP(int,int,int, int,int)' stereo_match.cpp :(。text + 0x8e4):未定义的引用cv::gpu::getDevice()' stereo_match.cpp:(.text+0x8ec): undefined reference to
CV :: GPU :: printShortCudaDeviceInfo(INT)' /tmp/ccvj1IgD.o: 在函数App::run()': stereo_match.cpp:(.text+0xa42): undefined reference to
cv :: imread(std :: string const&,int)' stereo_match.cpp :(。text + 0xa70):未定义的引用cv::imread(std::string const&, int)' stereo_match.cpp:(.text+0xb90): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xba0):未定义的引用cv::_OutputArray::_OutputArray(cv::Mat&)' stereo_match.cpp:(.text+0xbb4): undefined reference to
cv :: cvtColor(cv :: _ InputArray const&,cv :: _ OutputArray const&,int, INT)' stereo_match.cpp :(。text + 0xbc4):未定义的引用cv::_InputArray::_InputArray(cv::Mat const&)' stereo_match.cpp:(.text+0xbd4): undefined reference to
CV :: _ OutputArray :: _ OutputArray(CV ::垫&安培;)' stereo_match.cpp :(。text + 0xbe8):未定义的引用cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' stereo_match.cpp:(.text+0xbfa): undefined reference to
cv :: gpu :: GpuMat :: upload(cv :: Mat const&)' stereo_match.cpp :(。text + 0xc0c):未定义的引用cv::gpu::GpuMat::upload(cv::Mat const&)' stereo_match.cpp:(.text+0xc3e): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xc4e):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0xc94): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xca4):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0xdaa): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xdba):未定义的引用cv::_OutputArray::_OutputArray(cv::Mat&)' stereo_match.cpp:(.text+0xdce): undefined reference to
cv :: cvtColor(cv :: _ InputArray const&,cv :: _ OutputArray const&,int, INT)' stereo_match.cpp :(。text + 0xdde):未定义的引用cv::_InputArray::_InputArray(cv::Mat const&)' stereo_match.cpp:(.text+0xdee): undefined reference to
CV :: _ OutputArray :: _ OutputArray(CV ::垫&安培;)' stereo_match.cpp :(。text + 0xe02):未定义的引用cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' stereo_match.cpp:(.text+0xe4e): undefined reference to
cv :: gpu :: GpuMat :: upload(cv :: Mat const&)' stereo_match.cpp :(。text + 0xe60):未定义的引用cv::gpu::GpuMat::upload(cv::Mat const&)' stereo_match.cpp:(.text+0xe92): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xea2):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0xee8): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&)' stereo_match.cpp :(。text + 0xef8):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0xf22): undefined reference to
CV :: GPU ::流::空()' stereo_match.cpp :(。text + 0xf34):undefined 引用cv::gpu::StereoBM_GPU::operator()(cv::gpu::GpuMat const&, cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::gpu::Stream&)' stereo_match.cpp:(.text+0xf4c): undefined reference to
cv :: gpu :: Stream :: Null()' stereo_match.cpp :(。text + 0xf5e):undefined 参考cv::gpu::StereoBeliefPropagation::operator()(cv::gpu::GpuMat const&, cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::gpu::Stream&)' stereo_match.cpp:(.text+0xf76): undefined reference to
CV :: GPU ::流::空()' stereo_match.cpp :(。text + 0xf88):undefined 参考cv::gpu::StereoConstantSpaceBP::operator()(cv::gpu::GpuMat const&, cv::gpu::GpuMat const&, cv::gpu::GpuMat&, cv::gpu::Stream&)' stereo_match.cpp:(.text+0xfa0): undefined reference to
cv :: gpu :: GpuMat :: download(cv :: Mat&amp;)const&#39; stereo_match.cpp :(。text + 0xff6):未定义的引用cv::putText(cv::Mat&, std::string const&, cv::Point_<int>, int, double, cv::Scalar_<double>, int, int, bool)' stereo_match.cpp:(.text+0x1032): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&amp;)&#39; stereo_match.cpp :(。text + 0x1042):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0x105c): undefined reference to
CV :: waitKey(INT)&#39; /tmp/ccvj1IgD.o:在功能上App::handleKey(char)': stereo_match.cpp:(.text+0x1630): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&amp;)&#39; stereo_match.cpp :(。text + 0x1640):未定义的引用cv::_OutputArray::_OutputArray(cv::Mat&)' stereo_match.cpp:(.text+0x1654): undefined reference to
cv :: cvtColor(cv :: _ InputArray const&amp;,cv :: _ OutputArray const&amp;,int, INT)&#39; stereo_match.cpp :(。text + 0x1664):未定义的引用cv::_InputArray::_InputArray(cv::Mat const&)' stereo_match.cpp:(.text+0x1674): undefined reference to
CV :: _ OutputArray :: _ OutputArray(CV ::垫&安培;)&#39; stereo_match.cpp :(。text + 0x1688):未定义的引用cv::cvtColor(cv::_InputArray const&, cv::_OutputArray const&, int, int)' stereo_match.cpp:(.text+0x169a): undefined reference to
cv :: gpu :: GpuMat :: upload(cv :: Mat const&amp;)&#39; stereo_match.cpp :(。text + 0x16ac):未定义引用cv::gpu::GpuMat::upload(cv::Mat const&)' stereo_match.cpp:(.text+0x1718): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&amp;)&#39; stereo_match.cpp :(。text + 0x1728):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' stereo_match.cpp:(.text+0x176e): undefined reference to
cv :: _ InputArray :: _ InputArray(cv :: Mat const&amp;)&#39; stereo_match.cpp :(。text + 0x177e):未定义的引用cv::imshow(std::string const&, cv::_InputArray const&)' /tmp/ccvj1IgD.o: In function
CV ::垫::〜垫()&#39 ;: stereo_match.cpp :( text._ZN2cv3MatD2Ev [_ZN2cv3MatD5Ev] + 0×20): 未定义引用cv::fastFree(void*)' /tmp/ccvj1IgD.o: In function
cv :: Mat :: operator =(cv :: Mat const&amp;)&#39;: 。stereo_match.cpp :(文本 ZN2cv3MataSERKS0 [ ZN2cv3MataSERKS0 ] + 0xa2): 未定义引用cv::Mat::copySize(cv::Mat const&)' /tmp/ccvj1IgD.o: In function
cv :: Mat :: create(int,int,int)&#39;: stereo_match.cpp :( text._ZN2cv3Mat6createEiii [_ZN2cv3Mat6createEiii] + 0x66): 对cv::Mat::create(int, int const*, int)' /tmp/ccvj1IgD.o: In function
cv :: Mat :: release()&#39;的未定义引用: stereo_match.cpp :( text._ZN2cv3Mat7releaseEv [ ZN2cv3Mat7releaseEv] +的0x30)。: 未定义引用cv::Mat::deallocate()' /tmp/ccvj1IgD.o: In function
cv :: gpu :: GpuMat :: GpuMat(cv :: Size ,int)&#39;: stereo_match.cpp :( text._ZN2cv3gpu6GpuMatC2ENS_5Size_IiEEi [_ZN2cv3gpu6GpuMatC5ENS_5Size_IiEEi] + 0x5c): 未定义引用cv::gpu::GpuMat::create(int, int, int)' /tmp/ccvj1IgD.o: In function
cv :: gpu :: GpuMat :: ~GpuMat()&#39;: stereo_match.cpp :( text._ZN2cv3gpu6GpuMatD2Ev [_ZN2cv3gpu6GpuMatD5Ev] +是0xA): 对cv::gpu::GpuMat::release()' /tmp/ccvj1IgD.o: In function
App :: workBegin()&#39;的未定义引用: stereo_match.cpp :( text._ZN3App9workBeginEv [_ZN3App9workBeginEv] + 0x8中): 对cv::getTickCount()' /tmp/ccvj1IgD.o: In function
App :: workEnd()&#39;的未定义引用: stereo_match.cpp :( text._ZN3App7workEndEv [_ZN3App7workEndEv] + 0x8中): 未定义引用cv::getTickCount()' stereo_match.cpp:(.text._ZN3App7workEndEv[_ZN3App7workEndEv]+0x20): undefined reference to
cv :: getTickFrequency()&#39; collect2:错误:ld 返回1退出状态
答案 0 :(得分:2)
请参阅cmake说明中的宏,了解如何在opencv中打包并坚持使用make。再次感谢线索&#39; Iwillnotexist Idonotexist&#39;。
就我而言,我错过了两个依赖项: / modules / gpu / src / nvidia&amp;&amp; /模块/ GPU / SRC / NVIDIA /芯 ......并且有人提到“非自由”。在其他部分。
隐藏的依赖性东西......哦,男孩。
感谢所有有贡献的回复 - 现在似乎微不足道。