Obj-C on Linux

Member
Posts: 370
Joined: 2002.04
Post: #16
There is a file called Foundation.h, and it has the proper contents, it's just not being found by gcc.
It's at /usr/GNUstep/System/Headers/Foundation/Foundation.h

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #17
I browsed GCC's docs, and set the environment variable OBJC_INCLUDE_PATH to /usr/GNUstep/System/Headers/
Now it shows this:
Quote:main.m:1:2: warning: #import is obsolete, use an #ifndef wrapper in the header file
In file included from /usr/GNUstep/System/Headers/Foundation/Foundation.h:29,
from main.m:1:
/usr/GNUstep/System/Headers/Foundation/NSObjCRuntime.h:112:32: base/objc-gnu2next.h: No such file or directory
In file included from main.m:1:
/usr/GNUstep/System/Headers/Foundation/Foundation.h:30:22: GSConfig.h: No such file or directory
In file included from /usr/GNUstep/System/Headers/Foundation/NSDebug.h:30,
from /usr/GNUstep/System/Headers/Foundation/Foundation.h:31,
from main.m:1:
/usr/GNUstep/System/Headers/Foundation/NSObject.h:39:26: base/preface.h: No such file or directory
/usr/GNUstep/System/Headers/Foundation/NSObject.h:40:22: GSConfig.h: No such file or directory
In file included from /usr/GNUstep/System/Headers/Foundation/Foundation.h:39,
from main.m:1:
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:27:22: GSConfig.h: No such file or directory
In file included from /usr/GNUstep/System/Headers/Foundation/Foundation.h:39,
from main.m:1:
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:32: parse error before "NSSwappedFloat"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:33: parse error before "NSSwappedDouble"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:53: parse error before "GSSwapI16"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:53: parse error before "in"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:55: parse error before "GSSwapI32"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:55: parse error before "in"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:57: parse error before "GSSwapI64"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:57: parse error before "in"
/usr/GNUstep/System/Headers/Foundation/NSByteOrder.h:59: parse error before "GSSwapI128"

... lots of similar errors omitted from NSByteOrder.h ...

In file included from /usr/GNUstep/System/Headers/Foundation/NSDecimalNumber.h:31,
from /usr/GNUstep/System/Headers/Foundation/Foundation.h:49,
from main.m:1:
/usr/GNUstep/System/Headers/Foundation/NSDecimal.h:30:22: GSConfig.h: No such file or directory
main.m:141:2: warning: no newline at end of file

Thanks,
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #18
Find that base directory and add its parent to the header search paths.
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #19
Ok, thanks. After adding that and a few other directories to the search path, it compiles. But, the linker barfs up:
Quote:/tmp/ccL6nm6c.o: In function `main':
/tmp/ccL6nm6c.o(.text+0x28): undefined reference to `objc_get_class'
/tmp/ccL6nm6c.o(.text+0x28): relocation truncated to fit: R_PPC_REL24 objc_get_class
/tmp/ccL6nm6c.o(.text+0x3c): undefined reference to `objc_msg_lookup'
/tmp/ccL6nm6c.o(.text+0x3c): relocation truncated to fit: R_PPC_REL24 objc_msg_lookup
/tmp/ccL6nm6c.o(.text+0x64): undefined reference to `objc_msg_lookup'
/tmp/ccL6nm6c.o(.text+0x64): relocation truncated to fit: R_PPC_REL24 objc_msg_lookup
for thousands of lines. I think I need to tell the linker where the compiled Foundation code is, but I don't know how.
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #20
probably -lobjc -lfoundation -lappkit or something... what are the libraries called and where are they installed?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #21
Now it says this:
Quote:/usr/bin/ld: cannot find -lFoundation
And I honestly don't know what to look for- what will it be named? I've been using locate to find stuff, but I need a file name.
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #22
It'll be called something like libFoundation.so or libfoundation.so. At a wild guess, /usr/X11R6/lib/, /usr/GNUstep/Libraries/, /usr/X11R6/lib/GNUstep/ seem like reasonable places to try.
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #23
I tried doing
locate *foundation*.so
locate *Foundation*.so
locate *.so

and there was nothing like libfoundation.so.
However, I did find /usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so
I don't know if that's right though, or how to pass it to the linker. And, I don't have X11 installed, so those other paths don't exist.
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #24
I'm off to bed now, so I'll try anything that you say tomorrow morning... thanks OSC.
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #25
Try adding this to your link arguments:

[font=monaco,courier]-L/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu -lgnustep-base[/font]
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #26
I added the above path to LIBRARY_PATH and now use this command to compile:
Code:
gcc -lobjc -lgnustep-base Card.m CardStack.m main.m -o war

and it spits out ten thousand lines like this, including the stuff mentioned before:
Quote:/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `objc_lookup_class'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `objc_get_type_qualifiers'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `sel_types_match'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `search_for_method_in_list'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `dlerror'

Thanks,
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Feanor
Unregistered
 
Post: #27
Please tell me that you have read this: Installation instructions

Granted it is complicated. There appear to be some support libraries needed. The instructions suggest that you need to compile the gnustep libraries. Did you do that, or do they have binaries? (I cannot find any binary downloads...)

There are other links to docs, but they don't work. Mad
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #28
I did follow those instructions, except I didn't install the gui package as I don't have an X server installed on the computer. I compiled my own.
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #29
Have you tried -lobjc and/or -ldl ?

Have you tried 'sudo apt-get install gnustep'?
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #30
I didn't think of using apt-get, I just reinstalled GNUstep from the package.
Quote:gcc -lobjc -lgnustep-base -ldl Card.m CardStack.m main.m -o war

returns:

Quote:/tmp/cc2IsoPM.o: In function `_i_Card__compare_':
/tmp/cc2IsoPM.o(.text+0x84): undefined reference to `objc_msg_lookup'
/tmp/cc2IsoPM.o(.text+0x84): relocation truncated to fit: R_PPC_REL24 objc_msg_lookup
/tmp/cc2IsoPM.o(.text+0xb0): undefined reference to `objc_msg_lookup'
/tmp/cc2IsoPM.o(.text+0xb0): relocation truncated to fit: R_PPC_REL24 objc_msg_lookup
...
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `objc_lookup_class'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `objc_get_type_qualifiers'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `sel_types_match'
/usr/GNUstep/System/Libraries/powerpc/linux-gnu/gnu-gnu-gnu/libgnustep-base.so: undefined reference to `search_for_method_in_list'
Could there be another library which defines all of these? What would it be called?
Thanks,
Steven

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Unholy method to link Linux library? Cochrane 3 3,191 Jun 30, 2008 06:37 AM
Last Post: OptimisticMonkey
  Linux geek wanting to get into Mac games programming supenguin 8 5,168 Nov 16, 2005 09:49 PM
Last Post: EvolPenguin
  porting linux glut code to mac os x zynek 12 6,465 Jan 23, 2005 05:47 PM
Last Post: zynek
  Linux Games/Tibia Kris 3 4,555 Sep 27, 2004 04:08 PM
Last Post: ERaZer
  Linux IDE's wadesworld 5 4,920 Jul 20, 2004 08:17 AM
Last Post: Iron Wallaby