View Full Version : SDL doesn't like C++...
sealfin
2006.09.10, 02:05 PM
I'm currently setting up a 'new' machine (Dual 450Mhz G4, 1GB RAM, 10.3.9), and I've run into a problem after installing the development tools (Xcode 1.1) and SDL: whenever I try to compile a C++ project using SDL (even the SDL project templates), I receive the following error:
ld: /usr/lib/gcc/darwin/3.3/libstdc++.a(eh_exception.o) illegal reference to symbol: operator delete(void*) defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib
These are the steps I've taken from a clean (but fully updated) install of 10.3.9 to try to install the development tools and SDL:
Installed Xcode 1.1 (Easy Install)
Copied SDL.framework 1.2.11 to /Library/Frameworks/
Copied contents of SDL-devel-1.2-11-extras.dmg/TemplatesForProjectBuilder/ into /Library/Application Support/Apple/Developer Tools/Project Templates/Application/ (except the file Application.trgttmpl, as it isn't mentioned in the SDL documentation?
Compiled a C++ Tool template-project, no problem.
Compiled an C SDL Application template-project project, no problem.
Created a fresh C SDL Application template-project, renamed main.c to main.cpp, tried to compile, but... :cry:
Cochrane
2006.09.10, 03:22 PM
Do you include libstdc++?
akb825
2006.09.10, 03:46 PM
For some reason, it looks like you're trying to statically link libstdc++ when it's already dynamically linked. You might want to look into the build options, and make sure it's dynamically linked in there. I'm guessing that SDL (or another framework) already dynamically links it, so it's looking for it in 2 places. Either that, or the other framework is statically linking it when you're dynamically linking it in your framework.
sealfin
2006.09.10, 05:44 PM
I just tried an eyeball-diff of the build settings/style used to build the project on the new machine, and the old, and they are identical...
OneSadCookie
2006.09.10, 06:21 PM
The latest SDL is built with GCC 4, which uses a libstdc++ that's incompatible with that of GCC 3. You need to upgrade your compiler, downgrade your SDL to one that was built with GCC 3, or build SDL yourself with GCC 3.
Or you could search the boards, where you'd find all the other threads where I've said that :p
sealfin
2006.09.10, 07:25 PM
OSC, unfortunately the error occurs even if I've dropped into /Library/Frameworks/ a version of SDL I know works with C++ under 10.3.9 - because I've just copied it off of the older system...
OneSadCookie
2006.09.10, 07:39 PM
Weird.
I'd start by looking at all the libraries and frameworks you're using with otool -L to find out which is using /usr/lib/libstdc++.6.dylib. Having found the culprit(s), I'd then be investigating whether having -lstdc++ *before* them in the link command makes any difference.
quarus
2006.09.24, 10:26 AM
Did you solve your problem, sealfin ? Because i have exactly the same one. My SDL/OpenGL Project also won't compile (link) after a fresh Panther install, giving me the same errors which you have encountered. I also tried to downgrade SDL with no luck. I then attempted to compile SDL 1.2.9 but linking failed because of the same error:
ld: /usr/lib/gcc/darwin/3.3/libstdc++.a(stl-inst.o) illegal reference to symbol: std::__throw_bad_alloc() defined in indirectly referenced dynamic library /usr/lib/libstdc++.6.dylib
However compilation of lib3ds, freetype and ftgl libraries completed just fine.
*sigh* i would like to continue my work on MacBomber, but i can't because of this stupid problem :cry: . Any clues ?
sealfin
2006.09.24, 12:50 PM
Did you solve your problem, sealfin ?
Not as yet; I intend to duplicate exactly the installation of SDL on the newer system as on the older system, but as yet haven't had the time to try...
quarus
2006.09.24, 02:39 PM
Not as yet; I intend to duplicate exactly the installation of SDL on the newer system as on the older system, but as yet haven't had the time to try...
Good luck with that! After a bit more googling it seems like that a quicktime software update is the one to blame(?) And examining the SDL Framework with otool shows that it loads quicktime dynamically. I will try to reinstall panther while avoiding the quicktime upgrade. I will post in a few days if it worked...
Greywhind
2006.09.24, 03:53 PM
I had the same problem... I didn't reinstall the OS, I found a (difficult) way of reverting Quicktime to the older version, fixing the issue.
After upgrading to Tiger, fortunately there hasn't been any trouble.
You'd think Quicktime would give us an EASY way to revert to an earlier version...
quarus
2006.09.24, 05:27 PM
I had the same problem... I didn't reinstall the OS, I found a (difficult) way of reverting Quicktime to the older version, fixing the issue.
After upgrading to Tiger, fortunately there hasn't been any trouble.
I really hope that i am not forced to upgrade. I would hate to give apple my money, because they screwed up :(
Well, we will see....
quarus
2006.09.25, 05:05 PM
Reinstalling panther without upgrading Quicktime solved the problem. :)
Reinstalling panther without upgrading Quicktime solved the problem. :)
What you could do now, is find the /System/Library/Frameworks/QuickTime.framework, duplicate it into ~/Library/Frameworks, then upgrade QuickTime. Then in your SDL apps, just link to the ~/Library/Frameworks/QuickTime.framework instead of the /System/Library/Frameworks/QuickTime.framework. Then you get access to the best of both worlds.
quarus
2006.09.26, 09:39 AM
What you could do now, is find the /System/Library/Frameworks/QuickTime.framework, duplicate it into ~/Library/Frameworks, then upgrade QuickTime. Then in your SDL apps, just link to the ~/Library/Frameworks/QuickTime.framework instead of the /System/Library/Frameworks/QuickTime.framework. Then you get access to the best of both worlds.
Thanks for your tip! But where can i specify the quicktime framework to be linked against? I guess i have to add a Linker flag entry? Or do i have to drag the right quicktime framework into my project?
vBulletin® v3.6.8, Copyright ©2000-2008, Jelsoft Enterprises Ltd.