如何运行 C++另一台计算机(linux)上有 OpenCV 的库吗?
我在 Ubuntu 11.04 中使用 C++、OpenCV 2.2 和 g++ 编写了一个小项目。我需要制作一个库(.so 会更好),但我希望它在另一台计算机上运行,而不安装 OpenCV。
我尝试使用 g++ 的 -shared 和 -fPIC 标志构建动态库,并将 OpenCV .so 库复制到工作目录。实际上我只需要 core 和 feature2d,但实际上它需要很多其他库,包括 highgui,它也有很多依赖项。
我尝试使用 -Wl、-Bstatic 标志进行静态链接,但也没有成功。 有人有同样的问题吗?我将不胜感激任何形式的帮助。
I wrote a small project using C++, OpenCV 2.2 and g++ in Ubuntu 11.04. I need to make a library (.so would be better), but I want it to run on the other computer, without OpenCV installed.
I've tried to build dynamic library using -shared and -fPIC flags for g++, and copied OpenCV .so libs to the working directory. Actually I need only core and feature2d, but actually it requested lot's of other libs, including highgui, which also has many dependencies.
I tried static linking, using -Wl,-Bstatic flags, but also unsuccessfully.
Did someone has the same problems? I would appreciate any kind of help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可以在不依赖系统库的情况下构建 OpenCV。要在 Linux 上关闭 OpenCV 2.2 的所有依赖项,您可以使用以下参数运行 cmake:
但在这种情况下,您将无法使用 highgui 模块中的许多功能:
It is possible to build OpenCV without dependencies from system libraries. To turn of all the dependencies for OpenCV 2.2 on Linux you can run cmake with following arguments:
But in this case you will not be able to use many of functions form highgui module: