【发布时间】:2018-01-30 14:03:45
【问题描述】:
我正在尝试为 OpenCV 3.4 的目标 c 库创建 C#绑定(https://opencv.org/releases.html,预编译并使用额外模块从源代码构建)但没有成功。 要么我使用了错误的 Sharpie 参数,要么编译的 opencv2.framework 有问题。
工具/版本:
- Sharpie 3.4.0
- Iphone11.2 SDK
- OpenCV 3.4.0(预编译和/或使用额外模块从源代码成功构建)
我尝试了以下 Sharpie 参数(当当前目录包含 opencv2.framework 时):
$ sharpie bind -framework opencv2
$ Done. Exiting with error code 1.
error: opencv2: Umbrella header file does not exist: opencv2.framework/Headers/opencv2.h
$
那是因为伞形文件是 Headers/opencv.hpp。所以我把参数改成:
$ sharpie bind -fx-umbrella opencv2.framework/Headers/opencv.hpp -framework opencv2
Done. Exiting with error code 1.
error: opencv2: Umbrella header file does not exist: opencv2.framework/Headers/opencv2.h
$
在每个订单中都会被完全忽略。
我还尝试了许多其他可能性,例如仅定义 .a 文件(结合使用 lipo 删除包含的库):
$ sharpie bind opencv2.a
Parsing 1 header files...
warning: [SomePath]/opencv2.a: 'linker' input unused [-Wunused-command-line-argument]
warning: argument unused during compilation: '-c' [-Wunused-command-line-argument]
warning: argument unused during compilation: '-fno-spell-checking' [-Wunused-command-line-argument]
warning: argument unused during compilation: '-Xclang -detailed-preprocessing-record' [-Wunused-command-line-argument]
error: unable to handle compilation, expected exactly one compiler job in ''
Error while processing [SomePath]/opencv2.a.
Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
$
或直接使用:
$ sharpie bind Headers/opencv.hpp
失败是因为找不到“opencv2/...hpp”文件,因为每个包含的 hpp 都引用“opencv2/...”结构
【问题讨论】:
-
您是否尝试将
Headers文件夹临时移动到opencv2.framework? -
我试过了,但没有帮助。在 opencv2.framework 目录中,有一个指向 Versions/A/Headers 的符号链接(Versions/A 还包含 .a 文件)和一个指向 .a 文件的符号链接 opencv2(如果有机会,请查看文件夹结构,包的链接在我的开始帖中)
标签: c# ios opencv xamarin.ios objective-sharpie