View Full Version : Makefile for Mac OS X

08-25-2004, 07:15 AM
Trying to write a makefile to compile the sample plugins w/ gcc. Here's what I have (a little hackish at the moment):

LWSDK_LIB = /Users/kcrane/Desktop/lwsdk8/source/
LWSDK_INCL = /Users/kcrane/Desktop/lwsdk8/include/

all: blotch.o blotch.p

blotch.o: blotch.c

blotch.p: blotch.o
ld -dylib -exported_symbols_list symbolList -L$(LWSDK_LIB) \
$(LWSDK_LIB)servmain.o $*.o -o [email protected] -L$(LWSDK_LIB)libserver.a $(OTHER_LIBS)

rm blotch.o blotch.p

where symbolList contains just a line w/ "_mod_descrip".
This is as best as I could determine from the SDK documentation (which is pretty out of date with regards to Mac OS X) and the ld man pages.
I get linker errors:

ld: blotch.o illegal undefined reference for multi module MH_DYLIB output file to symbol: dyld_stub_binding_helper from section (__DATA,__la_symbol_ptr) relocation entry: 0
ld: symbols names listed in -exported_symbols_list: symbolList not in linked objects
make: *** [blotch.p] Error 1

Anyone have a working makefile for the SDK samples?

08-25-2004, 09:14 AM
Just a heads up to possibly prevent too much time hitting your head against the wall. It looks like you are attempting to compile using the Unix command line out of the LW SDK. Unfortunately, this isn't going to work. Although OS X is Unix underneath, LW itself is built using the older object file format (CFM) instead of the new OS X object file format (Mach-O).

Because Xcode, and gcc that is part of it, only build Mach-O object files you can not use it to build LW plugins. Your only real options are Codewarrior (commercial) or the old MPW (free) from Apple. Personally, I use MPW. It doesn't have much to recommend it anymore other than it can be used to build plugins for applications like LW that still haven't transitioned to Mach-O and Xcode.

NewTek has said that at some point the Mac OS X version will be transitioned to be a Mach-O application, but until then our options are quite limited.

That said, if you want to forge ahead and prove me wrong, I would suggest using the nm tool to make sure that _mod_descrip is actually being exported from your servmain.o. If not, then double check how you built servmain.o.

08-25-2004, 09:19 AM
That's a shame.

Well, thanks for the heads up - I'll give MPW a try.