User avatar
matt.rudder
Topic Author
Posts: 21
Joined: 24 May 2013, 08:12
Location: San Francisco, CA
Contact:

Building a native project for iOS: stdlibc++ vs libc++

29 Mar 2014, 16:34

Hey guys,

I've been playing a bit with getting a sample project building for iOS and I've run into a bit of a road block. This project is using some newer C++11 features (std::unique_ptr, std::function, etc) that are not available in the version of stdlibc++ shipped by Apple, so I've been linking against libc++.

This has worked fine for Mac projects (though not ideal) since Noesis is setup as a shared library. Unfortunately, since iOS requires static libraries I end up with errors because of the conflicts between the two separate standard libraries.

Would it be insane to have Noesis link against libc++ on Mac/iOS? I know Xcode 5 defaults to linking against libc++ for new projects, to enable C++11 features. Could this be more of an issue in the future if Apple decides to never update their libstdc++ version? I could make my project link against libstdc++, and rely on Boost to provide the C++11 standard library features I'm using, but I'd prefer avoiding that if possible. Curious about anyone's thoughts on the matter.
 
User avatar
matt.rudder
Topic Author
Posts: 21
Joined: 24 May 2013, 08:12
Location: San Francisco, CA
Contact:

Re: Building a native project for iOS: stdlibc++ vs libc++

01 Apr 2014, 04:22

The more time I spend thinking about this, the more I wonder if it's the right approach for you guys as library writers. Still, would love to hear your thoughts.
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Building a native project for iOS: stdlibc++ vs libc++

01 Apr 2014, 12:25

Hi Matt,

For now, we are using "Compiler Default" for "C++ Standard Library" and "C++ Language Dialect". This means "libstdc++" and "gnu++98".

As you said, this is problematic if our library is being linked in a project with a different configuration. Problem is that we cannot change to libc++ exclusively because all our clients are using libstdc++ (including Unity).

I suppose that XCode will deprecate libstdc++ in the future, but until now we will have to release two different libraries for iOS: both libc++ and libstdc++.

For now, our code is not ready for libc++, I am adding a ticket for this job. Meanwhile can you find a workaround?
 
User avatar
matt.rudder
Topic Author
Posts: 21
Joined: 24 May 2013, 08:12
Location: San Francisco, CA
Contact:

Re: Building a native project for iOS: stdlibc++ vs libc++

01 Apr 2014, 18:10

Yeah, I can work around this for the time being. I mainly just wanted to raise the issue. I figured I wasn't seeing the full picture. :)
 
User avatar
jsantos
Site Admin
Posts: 3906
Joined: 20 Jan 2012, 17:18
Contact:

Re: Building a native project for iOS: stdlibc++ vs libc++

02 Apr 2014, 12:40

Thanks for your feedback, it is quite important for us!

Who is online

Users browsing this forum: No registered users and 8 guests