Re: bad_typeid dyld Error on Leopard (10.5)
Re: bad_typeid dyld Error on Leopard (10.5)
- Subject: Re: bad_typeid dyld Error on Leopard (10.5)
- From: Manfred Schwind <email@hidden>
- Date: Tue, 18 May 2010 10:47:37 +0200
> The dylibs in an SDK don't need a text section (i.e. code). All they need are symbols. This is because an SDK is only used during development, not to actually run anything.
Ah, I understand. That makes sense.
> Try the 'nm' command instead of otool.
Thanks!
> And to your basic issue, are you compiling with 10.5 as the minimum deployment target? If not, then you need to do that if you expect your code to run on 10.5.
Yes. Building against 10.6 SDK but targeting 10.5 as minimum OS.
I think there is really a bug in the SDKs:
If you look into the <typeinfo> header, you can see the following:
In the 10.5 SDK, bad_typeid is declared that way:
class bad_typeid : public exception
{
public:
bad_typeid () throw() { }
virtual ~bad_typeid() throw();
};
But in the 10.6 SDK, bad_typeid is declared that way:
class bad_typeid : public exception
{
public:
bad_typeid () throw() { }
virtual ~bad_typeid() throw();
virtual const char* what() const throw();
};
Note that only in the 10.6 SDK the what() method is declared (but not defined). So when compiling with the 10.6 SDK but targeting 10.5 as minimum OS, the compiled code assumes that bad_typeid has a what() method. When running on 10.5 the symbol for bad_typeid::what() is just missing and dyld will bail out.
So I think the different declarations break ABI compatibility, don't they?
My workaround is now to define std::bad_typeid::what() somewhere in my own code. Now my app is running fine on 10.5. It's also still running fine on 10.6 (I thought I may get duplicate symbol error from dyld, but luckily that's not the case):
#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
/*virtual*/ const char* ::std::bad_typeid::what() const throw()
{
return exception::what();
}
#endif
I think I should file a bug report to Apple?
Regards,
Mani
--
http://mani.de - friendly software
iVolume - listen to music hands-free
LittleSecrets - the encrypted notepad
Sahara - sand in your pocket
Watchdog - baffle the curious
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden