I've got some free time to work both on my ObjectiveC web framework
and pure linux cocotron builds. Got basic code working but lots of
source files fail with
error: cannot find interface declaration for 'NXConstantString'
I've got the corresponding .h file from gcc and put it into Foundation/
objc adding the required #import into every file that fails. Is there
any cleaner solution for this?
--
Sincerely,
Vladimir "Farcaller" Pouzanov
Stock gcc 4.1.2. It's pretty useless to make a patched gcc at this
point.
I've got my helloworld.m building but failing at runtime. While
digging into the code I've noticed that
1) my build script failed to recognize *.s, so objc/platform_linux/
objc_msg_sendv.s has been never built
2) I've added -lobjc at some point, so it used wrong objc_msg_sendv
I've removed gcc objc and now missing two references:
__gnu_objc_personality_v0
__objc_class_name_NXConstantString
Should I try ripping that off my gcc's objc lib?
Fixed NXConstantString by copying its implementation into cocotron's
objc. Still failing at __gnu_objc_personality_v0. If I get all
correct, cocotron does provide all the objc runtime, so it should not
depend on GCC's libobjc. So where do I miss __gnu_objc_personality_v0?
If I try to link with -lobjc it seem to override the runtime, failing
at calls like this:
ObjC:OBJCDoesNotRecognizeSelector:+[NSString (null)(134520992)]
Any hints?
To sum it up and to see that I'm getting everything correctly. The
runtime is being split into two parts. The invocation logics and other
objc stuff (that's provided as libobjc or cocotron's Foundation) and
metadata that's being compiled by GCC into .o files. Right?
So, it's absolutely not possible to use vanilla gcc with other runtime
- they wouldn't just work with each other.
That's pretty discouraging. I thought it would be possible to provide
an user with buildable (by their vanilla gcc) Foundation library.
Seems that now I'll have to write "build your own obj-c patched gcc
HOWTO" :)
PS: looking at svn I see binutils there. Guessing that stock binutils
is a non-go too?
It wasn't that hard. GCC is mostly working (some Win32 compiler issue
is reproducible on linux too, see ticket 141). Cocotron builds
correctly (I still have to add several sources to CMake build file,
but it should work). Test source is running:
$ ./test
ObjC:internal error, unable to locate NSUserDefaults.plist,
path=(null), bundle at ../cocotron/Contents/Resources
2008-08-05 00:43:46.038 [6309] hello, linux cocoa world!
Now it's time for more fun, like implementing missing api :)
PS: I think I'll just make combined gcc-cocotron installation script,
so users could get both patched gcc and runtime in one package.