我在Ubuntu Linux上运行OpenCvShare时遇到了问题。它一直说找不到libOpenCvSharpExtern。
我在我的Ubuntu18.04.1 x64上运行OpenCvSharp时遇到了问题。我已经创建了一个.NET核心/标准解决方案(标准是一个库项目,核心是运行者)。库项目引用Nuget包: OpenCvSharp4 (4.0.0.20181225) OpenCvSharp4.runtime.ubuntu.18.04-x64 (4.0.0.20181225)。
然后,在成功编译之后,我使用以下命令发布了runner项目:
dotnet publish -c Release -r ubuntu.18.04-x64
当我在Ubuntu上运行可执行文件时,抛出了以下错误:
Unhandled Exception: OpenCvSharp.OpenCvSharpException: Failed to create VideoCapture System.TypeInitializationException: The type initializer for 'OpenCvSharp.NativeMethods' threw an exception. OpenCvSharp.OpenCvSharpException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory ---> System.DllNotFoundException: Unable to load shared library 'OpenCvSharpExtern' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: libOpenCvSharpExtern: cannot open shared object file: No such file or directory
文件libOpenCvSharpExtern.so与可执行文件在同一路径中,我也将其复制到usr/local/lib中,而id没有帮助。应用程序的目的是基于摄像头视频源检测人脸。
发布于 2019-01-08 16:03:10
好了,我终于让它运行起来了。问题出在包含路径中。当您从库所在路径中的终端执行ldd libOpenCvSharpExtern.so
时,它将输出此库使用的所有引用库。最初,我有一个完整的“未找到”的引用列表。所有缺少的库都已安装在/usr/local/lib
中。事实证明,该路径不是系统查找库的默认路径。Link to a question on ubuntu forum
在我添加export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/local/lib"
环境变量并重新启动系统后,一切都开始正常工作,并且在libOpenCvSharpExtern.so库上使用ldd
清楚地显示,所有的库都被找到了。
https://stackoverflow.com/questions/54039541
复制相似问题