Linking with -objc solved that, but now I got a 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
Perhaps this can be fixed by removing the dependency on libFoundation?
Also, running the program does not work:
You must call +[NSProcessInfo initializeWithArguments:count:environment:] in main()
(Again this is caused by libFoundation, I think.)
I think the problem is that the NeXT runtime is different internally from the GNU runtime. Simply generating a shared library won't produce the same result, at least on Darwin. A framework is a "bundle" containing resources, a mach-o bundle, as well as headers and other items. It's a common construct on Darwin; I can't speak for the same with respect to GNUStep. I can state that the code in the example works with the Darwin runtime and frameworks.
A source with .m extension triggers objective-c mode on Darwin, and implies -lobjc and possible -framework Foundation, though it's been a month or two since I worked with this particular code. Additionally, - framework Foundation is required on Darwin to include the base classes (NSAutoreleasePool and NSBundle, for example).
Bill
On Oct 6, 2007, at 12:05 PM, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
Linking with -objc solved that, but now I got a 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
Perhaps this can be fixed by removing the dependency on libFoundation?
Also, running the program does not work:
You must call +[NSProcessInfo initializeWithArguments:count:environment:] in main()
(Again this is caused by libFoundation, I think.)
!DSPAM:4707b1d4138347134516841!
[...] framework Foundation is required on Darwin to include the base classes (NSAutoreleasePool and NSBundle, for example).
But do you need these classes? On non-Darwin?
If special linker options are needed on Darwin, these should be no problem testing for them in the configure script.
You almost definitely need NSAutoreleasePool, (possibly unless you're using some sort of GC, in which case I can't provide an answer) as any classes you have will rely on one existing, and you'll need NSBundle to make the rest of the embedded framework function (it needs to be able to find the master and lib locations, for example. That's also why just having a plain shared library won't work, as embedded Pike is more than just "libpike". A framework (by virtue of being an NSBundle) can contain a shared code resource in addition to other artifacts, and has an awareness of where it's located, which is critical in locating things like the master.
I'm not sure what the nature of the shared code component of a framework is under non-Darwin platforms; it's possible that it's simply a shared library (which isn't quite the case on Darwin [thanks, Apple, for that]).
GNUStep apparently has some prebuilt makefiles for generating frameworks; perhaps this would be useful in your attempts (either by pulling the parts you need, or using the mechanism wholesale to build the library when GNUStep is present):
http://www.koders.com/noncode/ fidCCC0239CF8F2347D17C7A4B42F65459646AA5713.aspx
On the configure side of things, I suppose we'll want an --enable- framework option to trigger everything, correct? I didn't want to start adding things to the configure script until I had independent confirmation that things were working on Darwin. I'm not sure whether anyone else has played around with it there yet.
Bill
On Oct 7, 2007, at 5:30 AM, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
[...] framework Foundation is required on Darwin to include the base classes (NSAutoreleasePool and NSBundle, for example).
But do you need these classes? On non-Darwin?
If special linker options are needed on Darwin, these should be no problem testing for them in the configure script.
!DSPAM:4708a6c0177525368818224!
I'm pretty sure you are talking about slightly different things here: Marcus, as he initially phrased it, about Objective-C bindings, you about the specialization Cocoa / Darwin bindings. (Just trying to sync up here, to keep discussion as productive as possible. :-)
Yes. I only want to call Pike from objc. I don't particularly want to use NextStep or anything like that.
I wasn't suggesting you need to use full-blown NeXTStep, only that it provided a makefile from which you may be able to glean the details for making the shared code component of the framework on non- Darwin platforms (the rest is just copying files into the framework directory structure.
You have to use libobjc, because that gets you basic support for the objective c syntax (though the fact that the GNU runtume is slightly different may be the problem here), and you need Foundation because it provides the basic object infrastructure (NSObject, NSBundle, etc). Trust me, everyone using objective c is using Foundation... they're not skipping it to roll their own NSObject classes. I have no idea why libobjc and libFoundation conflict, though. Perhaps because they're mismatched on your system?
Bill
On Oct 8, 2007, at 6:10 AM, Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum wrote:
Yes. I only want to call Pike from objc. I don't particularly want to use NextStep or anything like that.
!DSPAM:470a01a0232341202321987!
pike-devel@lists.lysator.liu.se