Page 1 of 1

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

Posted: 29 Mar 2014, 16:34
by matt.rudder
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.

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

Posted: 01 Apr 2014, 04:22
by matt.rudder
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.

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

Posted: 01 Apr 2014, 12:25
by jsantos
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?

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

Posted: 01 Apr 2014, 18:10
by matt.rudder
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. :)

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

Posted: 02 Apr 2014, 12:40
by jsantos
Thanks for your feedback, it is quite important for us!