简体   繁体   English

将OpenCV框架导入Unity Project iOS时出错

[英]Error Importing OpenCV Framework to Unity Project iOS

I built OpenCV using the script available here: http://aptogo.co.uk/2011/09/opencv-framework-for-ios/ 我使用此处提供的脚本构建了OpenCV: http : //aptogo.co.uk/2011/09/opencv-framework-for-ios/

Then created a Unity3d iOS project, generated the xcode project from Unity3d, added the OpenCV framework to the project and tried to compile. 然后创建一个Unity3d iOS项目,从Unity3d生成xcode项目,将OpenCV框架添加到该项目中并尝试进行编译。

I get the following error: 我收到以下错误:

duplicate symbol _adler32 in /my-path/Libraries/libiPhone-lib.a(adler32.o) and /my-path/OpenCV.framework/OpenCV(adler32.o) for architecture armv7

I tried to remove adler32.so from the OpenCV lib, using "lipo" and "ar" then repackaged the lib, and I got another duplicated symbol. 我尝试使用“ lipo”和“ ar”从OpenCV库中删除adler32.so,然后重新打包该库,然后得到另一个重复的符号。 Eventually I removed a lot of objects from the OpenCV lib and it started complaining about missing symbols. 最终,我从OpenCV库中删除了许多对象,并且开始抱怨缺少符号。

It was a fun experiment but didn't work. 这是一个有趣的实验,但是没有用。

If I create a project on xcode with OpenCV it compiles without errors. 如果我使用OpenCV在xcode上创建项目,则编译时不会出错。 Unity3d project without OpenCV also works. 没有OpenCV的Unity3d项目也可以使用。

  • xcode version: 4.3.3 xcode版本:4.3.3
  • unity3d version: 3.5.2 (latest) unity3d版本:3.5.2(最新)
  • OpenCV: 2.4.1 - Adding OpenCV as a framework. OpenCV:2.4.1-添加OpenCV作为框架。

I searched for a linker option under xcode to see if I could make it more permissive but didn't found anything. 我在xcode下搜索了一个链接器选项,以查看是否可以使其更加宽松,但未找到任何内容。

Any idea how to solve the error? 任何想法如何解决错误?

It sounds like both Unity and OpenCV are being built with their own copies of libz , and are conflicting at link time. 听起来Unity和OpenCV都是用自己的libz副本构建的,并且在链接时发生冲突。 ( _adler32 is a checksumming function used in this library.) _adler32是此库中使用的校验和功能。)

You will need to pick one framework to own these common libraries and rebuild accordingly. 您将需要选择一个框架来拥有这些公共库并进行相应的重建。 Since libz is in iOS anyway, you might as well build both frameworks to use the system versions of those libraries. 由于libz无论如何都在iOS中,因此您最好构建两个框架以使用这些库的系统版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM