• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by jscholler · Jan 17, 2013 at 05:02 AM · iospluginxcodeopencvlinker

Linker errors on Xcode 4.5.2 with OpenCV 2.4.3

Did anyone manage to link an Unity plugin for iOS including OpenCV 2.4.3 (from http://opencv.org/downloads.html) with xCode 4.5.2?

I managed to use the opencv2.framework in a project outside Unity. But when included inside the Unity-iPhone.xcodeproj it does not link anymore with an error Like this:

 Undefined symbols for architecture armv7:
   "std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
       cv::Exception::Exception(int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, int) in opencv2(system.o)
       cv::Exception::Exception(cv::Exception const&) in opencv2(system.o)
 ...

Then If I set the target > build settings > Apple LLVM compiler 4.1 - Language > C++ Standard Library to libc++ (LLVM C++ standard library with C++11 support) then OpenCV links just fine. But then Unity's libiPhone-lib.a is not linking properly anymore:

 Undefined symbols for architecture armv7:
   "std::string::push_back(char)", referenced from:
       GetParameter(UTF16String&, int&, bool) in libiPhone-lib.a(TextFormatting.o)
   "std::string::assign(char const*, unsigned long)", referenced from:
       Append(char const*, char const*) in libiPhone-lib.a(Word.o)
       DebugTextLineByLine(char const*) in libiPhone-lib.a(LogAssert.o)
 ...

I was wondering if anyone managed to get the 2 at the same time. Thanks!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by Kuboslav · Jan 19, 2013 at 05:23 PM

I have same problem with metaioSDK and OpenCV 2.4.3 including. MetaioSDK dose not support lib++ option for C++ Standard Language, which is the only option OpenCV lib accepted. I'm desperate for any solution of this.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jscholler · Jan 29, 2013 at 07:46 AM

I found a way to get it working by syncing the OpenCV project right before the switch to c++11 and building it manually.

You need to have the xCode command line tools installed first (in xCode > Preferences > Downloads). In a new terminal do:

 cd ~/my_working _directory
 git clone https://github.com/Itseez/opencv.git
 # Reset to just before the switch to c++11
 git reset d9d4e8df6f
 cd /
 sudo ln -s /Applications/Xcode.app/Contents/Developer Developer
 cd ~/my_working_directory
 mkdir build
 cd build
 ../opencv/ios/configure-device_xcode.sh
 xcodebuild -sdk iphoneos -configuration Release -target ALL_BUILD
 xcodebuild -sdk iphoneos -configuration Release -target install install
 # For some reason the library files are not in the lib folder
 # so we need to copy them manually
 cp lib/Release/*.a ../OpenCV_iPhoneOS/lib

../OpenCV_iPhoneOS is now ready to be dragged and drop to your unity xCode project.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image LoungeKatt · Jun 14, 2014 at 07:17 PM 0
Share

For anyone who stumbles on this like I did, do not try it. It is no longer valid.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

9 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Linker error when creating a static iOS library that depends on another static library. 1 Answer

Compiling plugin for iOS - need more info. 4 Answers

How do I remove Google Plus from iOS Build only? 1 Answer

Unity Facebook Plugin terminates app after login (iOS) 1 Answer

ios plugin Undefined symbols for architecture i386 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges