Tiago
Tiago

Reputation: 934

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/

Then created a Unity3d iOS project, generated the xcode project from Unity3d, added the OpenCV framework to the project and tried to compile.

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. Eventually I removed a lot of objects from the OpenCV lib and it started complaining about missing symbols.

It was a fun experiment but didn't work.

If I create a project on xcode with OpenCV it compiles without errors. Unity3d project without OpenCV also works.

I searched for a linker option under xcode to see if I could make it more permissive but didn't found anything.

Any idea how to solve the error?

Upvotes: 0

Views: 1760

Answers (1)

gavinb
gavinb

Reputation: 20028

It sounds like both Unity and OpenCV are being built with their own copies of libz, and are conflicting at link time. (_adler32 is a checksumming function used in this library.)

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.

Upvotes: 1

Related Questions