The reason that there is a conflict between libobjc and libFoundation is that libFoundation depends on its own implementation "libobjc.so.lf2" (lf = libFoundation). Why libFoundation can't use the regular libobjc, or why the special lf version don't work as a drop-in replacement, I don't know.
I don't think there's anything in OC_PikeInterpreter that assumes anything special about the runtime (whereas Public.ObjectiveC does at this point), so it should be possible to switch out libobjc at will.
What were the specific errors you were getting? I'm travelling, so I don't have access to your past messages on the subject.
Bill
The reason that there is a conflict between libobjc and libFoundation is that libFoundation depends on its own implementation "libobjc.so.lf2" (lf = libFoundation). Why libFoundation can't use the regular libobjc, or why the special lf version don't work as a drop-in replacement, I don't know.
What were the specific errors you were getting? I'm travelling, so I don't have access to your past messages on the subject.
Well, linking with just libFoundation (and thus by implication its own version of libobjc), I get the following link errors
/home/marcus/Pike/7.7/build/linux-2.6.22-12-powerpc-ppc/libOCpike.so: undefined reference to `__gnu_objc_personality_v0' /home/marcus/Pike/7.7/build/linux-2.6.22-12-powerpc-ppc/libOCpike.so: undefined reference to `objc_exception_throw'
These symbols exist in /usr/lib/libobjc.so.1 (which is what I would get with -lobjc), but not in /usr/lib/libobjc.so.lf2 (which is what libFoundation pulls in).
The reference to the symbols come from OCPikeInterpreter.o, presumably due to the statement "@throw exception;". It's possible that I need to specify some GCC option when compiling this file to get exceptions which work with libFoundation rather than with libobjc...
If I specify both -lFoundation and -lobjc on the command line, I get both versions of libobjc.so, which satisifes all symbols but is probably not a safe thing to do. And sure enough gcc gives the following warning:
/usr/bin/ld: warning: libobjc.so.lf2, needed by /usr/lib/gcc/powerpc-linux-gnu/4.1.3/../../../../lib/libFoundation.so, may conflict with libobjc.so.1
And when trying to run the resulting binary, I get
You must call +[NSProcessInfo initializeWithArguments:count:environment:] in main()
I tested removing the NSAutoreleasePool stuff to see if that was what was causing it, but it made no difference.
The best way forward is probably trying to figure out the correct way to support exceptions together with libFoundation so that I can get down to just one libobjc... ;-)
On Mon, 8 Oct 2007, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
/home/marcus/Pike/7.7/build/linux-2.6.22-12-powerpc-ppc/libOCpike.so: undefined reference to `__gnu_objc_personality_v0' /home/marcus/Pike/7.7/build/linux-2.6.22-12-powerpc-ppc/libOCpike.so: undefined reference to `objc_exception_throw'
Hmm... I don't know much about libFoundation, but perhaps their libobjc doesn't support exceptions? That's awefully odd, though.
I found this, which seems to offer a different (incompatible) way of doing exceptions.
http://www.geocities.com/SiliconValley/Monitor/7464/libFoundation/doc/libFou...
The reference to the symbols come from OCPikeInterpreter.o, presumably due to the statement "@throw exception;". It's possible that I need to specify some GCC option when compiling this file to get exceptions which work with libFoundation rather than with libobjc...
You must call +[NSProcessInfo initializeWithArguments:count:environment:] in main()
I tested removing the NSAutoreleasePool stuff to see if that was what was causing it, but it made no difference.
I'm guessing that this is a non-Darwin Foundationism, as that's not needed (or defined, for that matter) on Darwin. I don't think that really has anything to do with "my" code; it seems like you'd always need to do it.
See: http://gnustep.org/resources/documentation/Developer/Base/Reference/NSProces...
The best way forward is probably trying to figure out the correct way to support exceptions together with libFoundation so that I can get down to just one libobjc... ;-)
Yeah, I think that URL above describes it, using -fobjc-exceptions is the way to enable it on darwin, it's possible that gnu gcc works similarly, but probably depends on support in libobjc. It's probably best to get some configure support for selecting the runtime and foundation framework. Then we can add some conditionals.
Isn't objective-c grand??? :O
Bill
I found this, which seems to offer a different (incompatible) way of doing exceptions.
http://www.geocities.com/SiliconValley/Monitor/7464/libFoundation/doc/libFou...
Ugh...
You must call +[NSProcessInfo initializeWithArguments:count:environment:] in main()
I tested removing the NSAutoreleasePool stuff to see if that was what was causing it, but it made no difference.
I'm guessing that this is a non-Darwin Foundationism, as that's not needed (or defined, for that matter) on Darwin. I don't think that really has anything to do with "my" code; it seems like you'd always need to do it.
See: http://gnustep.org/resources/documentation/Developer/Base/Reference/NSProces...
Well, it says "if none of the system-specific hacks to auto-initialize it are working", which seems to suggest that it's not needed quite always, but it doesn't say what those hacks are or how they work...
Anyway, this is as you say nothing related to the pike glue per se, it's just something you have to deal with when linking with libFoundation.
Adding the call to main gets me a little further:
WARNING(+[NSBundle _resourcesSearchPathes]): nested call to function! (probably some libFoundation setup issue) WARNING(+[NSBundle _resourcesSearchPathes]): nested call to function! (probably some libFoundation setup issue) Segmentation fault (core dumped)
So here are the famed bundles. :-) Apparently libFoundation again needs some extra setup...
The best way forward is probably trying to figure out the correct way to support exceptions together with libFoundation so that I can get down to just one libobjc... ;-)
Yeah, I think that URL above describes it, using -fobjc-exceptions is the way to enable it on darwin, it's possible that gnu gcc works similarly, but probably depends on support in libobjc.
-fobjc-exceptions is already specified, and removing it doesn't seem to make any difference in what symbols are referenced. Exceptions (using @throw) are working fine when compiling a non-Foundation program with -fobjc-exceptions -lobjc.
It's probably best to get some configure support for selecting the runtime and foundation framework. Then we can add some conditionals.
First we need to understand what options are needed to get something that works, then we can teach configure about it. :-)
Isn't objective-c grand??? :O
Needs some ISO standardization methinks...
pike-devel@lists.lysator.liu.se