Important changes to Makefiles for OS X
Posted: Thu Aug 27, 2009 2:44 am
NOTE: This post is in reference to newlisp version 10.1.4.
This may not be an issue for some people, but for anyone (e.g. me) using "link.lsp", this is potentially serious, and actually could be serious for everyone if the machine used to generate the newlisp binaries runs on 10.6.
The current Makefiles for OS X compile against the system's libraries, and this means that the binaries they generate will likely not run on older systems. I know that this is definitely true if you've compiled newlisp on 10.6. A version of newlisp compiled on 10.6 won't run on any older system, you'll get this mysterious error:
I've modified the 'makefile_darwin_universal_utf8' to make it compile against the 10.5 SDK. Whether this means it will run on 10.4 I'm not sure though. But it would be easy enough to modify it to get it to run on 10.4.
Here's my modified Makefile (it includes some of the stuff from the existing Makefile):
Two important notes:
1) When compiling the object files, you *must* include:
On my machine changing that to the 10.4u SDK resulted in compile errors, but those might be fixable, or it may not be necessary.
2) When linking all the object files together, you *must* include:
Again, that should probably be changed to say '10.4'.
This may not be an issue for some people, but for anyone (e.g. me) using "link.lsp", this is potentially serious, and actually could be serious for everyone if the machine used to generate the newlisp binaries runs on 10.6.
The current Makefiles for OS X compile against the system's libraries, and this means that the binaries they generate will likely not run on older systems. I know that this is definitely true if you've compiled newlisp on 10.6. A version of newlisp compiled on 10.6 won't run on any older system, you'll get this mysterious error:
Code: Select all
dyld: unknown required load command 0x80000022
Here's my modified Makefile (it includes some of the stuff from the existing Makefile):
Code: Select all
# makefile for newLISP v. 10.x.x on Mac OSX with readline support
#
# for OS X 10.4/Tiger, Tiger comes standard with libreadline
#
# needs readline library and headerfiles installed (X tools)
# use the Mac OS X lipo utitlity to extract one or the other ppc/intel
# example: lipo newlisp-universal -output newlisp-ppc -thin ppc7400
# note: architecture id for ppc on Tiger: ppc on Leopard: ppc7400
OBJS = newlisp.o nl-symbol.o nl-math.o nl-list.o nl-liststr.o nl-string.o nl-filesys.o \
nl-sock.o nl-import.o nl-xml.o nl-web.o nl-matrix.o nl-debug.o nl-utf8.o pcre.o
CFLAGS = -Wall -arch i386 -arch ppc -O2 -c -g -DREADLINE -DMAC_OSX -DSUPPORT_UTF8 -isysroot /Developer/SDKs/MacOSX10.5.sdk
#CFLAGS = -Wall -I/usr/include -c -g -DREADLINE -DMAC_OSX
default: $(OBJS)
$(CC) $(OBJS) -mmacosx-version-min=10.5 -arch i386 -arch ppc -g -lm -lreadline -o newlisp-universal
strip newlisp-universal
# lipo newlisp-universal -output newlisp-intel -thin i386
# lipo newlisp-universal -output newlisp-ppc -thin ppc
.c.o:
$(CC) $(CFLAGS) $<
$(OBJS): primes.h protos.h makefile_darwin_universal_utf8
1) When compiling the object files, you *must* include:
Code: Select all
-isysroot /Developer/SDKs/MacOSX10.5.sdk
2) When linking all the object files together, you *must* include:
Code: Select all
-mmacosx-version-min=10.5