libfmodstudio and c++11

Hi,

I’m working on an OSX/IOS application using c++11.
However, when i try to compile the IOS Simulator version, it can’t link against libfmodstudio_iphonesimulator.a because of a problem related to the used c++ library implementation.
It seems that libfmodstudio_iphonesimulator.a needs to link against libstdc++ while my application needs libc++.
How can i deal with that ?

The OSX version compiles successfully.

Thanks.

Here is the errors :

Undefined symbols for architecture i386:
  "std::_Rb_tree_decrement(std::_Rb_tree_node_base*)", referenced from:
      std::_Rb_tree<FMOD::ID<FMOD::VCAModel>, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::less<FMOD::ID<FMOD::VCAModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::VCAModel>, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::less<FMOD::ID<FMOD::VCAModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> > >::_M_insert_unique(std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::VCAInstance*>, std::_Select1st<std::pair<int const, FMOD::VCAInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::VCAInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::VCAInstance*> >, std::pair<int const, FMOD::VCAInstance*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::VCAInstance*>, std::_Select1st<std::pair<int const, FMOD::VCAInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::VCAInstance*> > >::_M_insert_unique(std::pair<int const, FMOD::VCAInstance*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EffectModel>, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::less<FMOD::ID<FMOD::EffectModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EffectModel>, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::less<FMOD::ID<FMOD::EffectModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> > >::_M_insert_unique(std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::EffectInstance*>, std::_Select1st<std::pair<int const, FMOD::EffectInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::EffectInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::EffectInstance*> >, std::pair<int const, FMOD::EffectInstance*> const&) 
      ...
  "std::_Rb_tree_increment(std::_Rb_tree_node_base const*)", referenced from:
      FMOD::RuntimeAPI::Manager::fixUpSendReturns(FMOD::ObjectLookup*, FMOD::BasicRepository<FMOD::EffectModel, FMOD::SendEffectModel> const&) 
      FMOD::RuntimeAPI::Manager::fixUpSideChainTargets(FMOD::ObjectLookup*, FMOD::BasicRepository<FMOD::EffectModel, FMOD::SideChainEffectModel> const&) 
      FMOD::RuntimeAPI::Manager::fixUpVCAStrips(FMOD::ObjectLookup*, FMOD::BasicRepository<FMOD::VCAModel, FMOD::VCAModel> const&) 
      FMOD::RuntimeAPI::Manager::fixUpEventChildren(FMOD::ObjectLookup*, FMOD::BasicRepository<FMOD::EventModel, FMOD::EventModel> const&) 
      FMOD::RuntimeAPI::Manager::validateModelRelationships(FMOD::RuntimeAPI::ObjectMissingCallbackInterface*) 
      FMOD::RuntimeAPI::Manager::lookupGUID(char const*, FMOD_GUID*) const 
      void FMOD::RuntimeAPI::updateHashForRepository<FMOD::BasicRepository<FMOD::BusModel, FMOD::InputBusModel> >(FMOD::MD5Hash*, FMOD::BasicRepository<FMOD::BusModel, FMOD::InputBusModel> const&) 
      ...
  "std::_Rb_tree_increment(std::_Rb_tree_node_base*)", referenced from:
      std::_Rb_tree<FMOD::ID<FMOD::VCAModel>, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::less<FMOD::ID<FMOD::VCAModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::VCAInstance*>, std::_Select1st<std::pair<int const, FMOD::VCAInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::VCAInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::VCAInstance*> >, std::pair<int const, FMOD::VCAInstance*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EffectModel>, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::less<FMOD::ID<FMOD::EffectModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::EffectInstance*>, std::_Select1st<std::pair<int const, FMOD::EffectInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::EffectInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::EffectInstance*> >, std::pair<int const, FMOD::EffectInstance*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::BusModel>, std::pair<FMOD::ID<FMOD::BusModel> const, FMOD::BusInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::BusModel> const, FMOD::BusInstanceContainer*> >, std::less<FMOD::ID<FMOD::BusModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::BusModel> const, FMOD::BusInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::BusModel> const, FMOD::BusInstanceContainer*> >, std::pair<FMOD::ID<FMOD::BusModel> const, FMOD::BusInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::BusInstance*>, std::_Select1st<std::pair<int const, FMOD::BusInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::BusInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::BusInstance*> >, std::pair<int const, FMOD::BusInstance*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EventModel>, std::pair<FMOD::ID<FMOD::EventModel> const, FMOD::EventInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EventModel> const, FMOD::EventInstanceContainer*> >, std::less<FMOD::ID<FMOD::EventModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EventModel> const, FMOD::EventInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::EventModel> const, FMOD::EventInstanceContainer*> >, std::pair<FMOD::ID<FMOD::EventModel> const, FMOD::EventInstanceContainer*> const&) 
      ...
  "std::_Rb_tree_rebalance_for_erase(std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
      FMOD::FMODMap<FMOD::ID<FMOD::EventModel>, FMOD::EventInstanceContainer*>::remove(FMOD::ID<FMOD::EventModel> const&) 
      FMOD::FMODMap<FMOD::ID<FMOD::BusModel>, FMOD::BusInstanceContainer*>::remove(FMOD::ID<FMOD::BusModel> const&) 
      FMOD::FMODMap<FMOD::ID<FMOD::EffectModel>, FMOD::EffectInstanceContainer*>::remove(FMOD::ID<FMOD::EffectModel> const&) 
      FMOD::FMODMap<FMOD::ID<FMOD::VCAModel>, FMOD::VCAInstanceContainer*>::remove(FMOD::ID<FMOD::VCAModel> const&) 
      FMOD::FMODMap<int, FMOD::VCAInstance*>::move(int const&, FMOD::FMODMap<int, FMOD::VCAInstance*>*) 
      FMOD::FMODMap<FMOD::ID<FMOD::VCAModel>, FMOD::VCAInstanceContainer*>::move(FMOD::ID<FMOD::VCAModel> const&, FMOD::FMODMap<FMOD::ID<FMOD::VCAModel>, FMOD::VCAInstanceContainer*>*) 
      FMOD::FMODMap<int, FMOD::EffectInstance*>::move(int const&, FMOD::FMODMap<int, FMOD::EffectInstance*>*) 
      ...
  "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
      std::_Rb_tree<FMOD::ID<FMOD::VCAModel>, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::less<FMOD::ID<FMOD::VCAModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::VCAModel>, std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> >, std::less<FMOD::ID<FMOD::VCAModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> > >::_M_insert_unique(std::pair<FMOD::ID<FMOD::VCAModel> const, FMOD::VCAInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::VCAInstance*>, std::_Select1st<std::pair<int const, FMOD::VCAInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::VCAInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::VCAInstance*> >, std::pair<int const, FMOD::VCAInstance*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::VCAInstance*>, std::_Select1st<std::pair<int const, FMOD::VCAInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::VCAInstance*> > >::_M_insert_unique(std::pair<int const, FMOD::VCAInstance*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EffectModel>, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::less<FMOD::ID<FMOD::EffectModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> const&) 
      std::_Rb_tree<FMOD::ID<FMOD::EffectModel>, std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*>, std::_Select1st<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> >, std::less<FMOD::ID<FMOD::EffectModel> >, FMOD::Allocator<std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> > >::_M_insert_unique(std::pair<FMOD::ID<FMOD::EffectModel> const, FMOD::EffectInstanceContainer*> const&) 
      std::_Rb_tree<int, std::pair<int const, FMOD::EffectInstance*>, std::_Select1st<std::pair<int const, FMOD::EffectInstance*> >, std::less<int>, FMOD::Allocator<std::pair<int const, FMOD::EffectInstance*> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<int const, FMOD::EffectInstance*> >, std::pair<int const, FMOD::EffectInstance*> const&) 
      ...
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Could you send a modified FMOD example that exhibits this problem to support@fmod.org and I’ll investigate.

First, thanks for your quick answer :slight_smile:

I’ve created a small project at https://github.com/kdridi/FMODSample that reflects my problem.

[list]
[] The first commit only imports the various FMOD samples i found on your website.[/:m:15ff9msf]
[] On the second commit, i’ve configured the IOS samples in order to link them with -stdlib=libstdc++. Everything works fine.[/:m:15ff9msf]
[] Then, on the third commit, i’ve configured the IOS samples in order to link them with -stdlib=libc++ and then the problem occurs.[/:m:15ff9msf][/list:u:15ff9msf]

It’s kinda annoying knowing that my entire project use many c++11 features that are only available with the libc++ but it seems that FMOD use libstdc++.

Those problems doesn’t exist with the OSX version thanks to the dynamic linked library you provide that has already been linked with the libstdc++ STL implementation.

I think that you’ll need to provide both versions, the libc++ linked one and the libstdc++ linked one, for your static libraries (i.e. the IOS libfmod*.a).

I hope to hear quick news from this post and i wish you a very good day :wink:

Thanks for the sample, I’m treating this as a bug since we don’t want to preclude C++11 developers from using FMOD.

Having a separate library linked with libc++ would be my last resort, I am investigating completely removing our dependency on STL at this stage.

I hope to have this fixed up for our next release.

Thank you for your quick answer !

I know that my request is quite difficult to handle knowing that switching over STL implementations certainly need some tests on your side.

Unfortunately, i don’t think we’ve got a lot of time here waiting for the next FMOD release due to a release date for our game that comes very soon and we switch over FMOD a few weeks ago for the MAC version that works well. At that time i didn’t notice the IOS problem and now it’s quick painful to me to switch back to my previous-homemade-ugly sound engine :oops:

However, i tried to import the missing STL functions, using what i found at http://www.opensource.apple.com/source/libstdcxx/libstdcxx-56/src/tree.cc, in the projet that now compiles and seems to work well… thank’s god :smiley:

I’ve committed this workaround in the previous project and if you’re interested, please have a look at https://github.com/kdridi/FMODSample.git

Again, thank a lot for your quick answers and i hope i’ll get some good news for the next FMOD release soon :slight_smile:

Have a nice day !

Sorry for the long delay, as you expected removing the offending STL took a little while. I’m glad you have a work around in place.

With the release of 1.3 we will no longer be dependent on STL, so this problem will be solved.