At 17:40 -0700 30/6/05, Gale Paeper wrote:
Given that with Mac OS X 10.4 Apple's gcc is based on gcc 4.x and Apple had documented some backward compatibility issues with prior gcc versions (I think it is primarily with C++ support), it didn't seem like a GPC install was going to be a simple, trouble free install. So, I deferred GPC install attempts until I had a sufficiently sized block of time to deal with posssible installation issues.
I have GPC running on 10.4, compiled from source. I'll include the docs of what I did below (lots of info is much the same as Adriaan's docs previously).
There are a couple gotchas:
You need to patch gcc 3.4.3's darwin.h to include -lSystemStubs. I gues probably somehow configure or whatever should figure out if there is a SystemStubs library and include it, or it should be conditionally included for 10.4+ (darwin8+?). This isn't a GPC issue, so I wouldn't include the patch with GPC. Adriaan will no doubt include a reference to the patch on his pages.
When doing "make bootstrap" on gpc/gcc, there is a problem where the default flags include -no-cpp-precomp for STAGE1, which is fine until it tries to use the built compiler (xgpc) with this flag to compile the RTS. Then it fails with an error because the flag is supported only on the Apple installed gcc, not the newly build gpc/gcc. This seems to be a failure in the build system, since the new compiler should not be called with flags not suitable for it. But the easiest way I found to avoid it is to specify the STAGE1_CFLAGS explicitly to exclude the -no-cpp-precomp - I could not find any way to set STAGE1_CFLAGS to "STAGE1_CFLAGS without -no-cpp-precomp" - perhaps someone smarter than me knows how to do that.
The documentation below is a draft spec of what I did to get gpc compiling under 10.4
Enjoy, Peter.
Compiling GPC from scratch
0 - Create a build directory 1 - Install bison version 2.0 2 - Install flex version 2.5.27 3 - Install sed version 4.1.4 4 - Install help2man version 1.35.1 5 - Download gcc version 3.4.3 6 - Download gpc-20050331 7 - Configure gcc/gpc 8 - Patch gcc for Mac OS X 9 - Build gcc 10 - Install gp 11 - Setup some links
STEP 0 - Create a build directory
cd mkdir gpc-build cd gpc-build
STEP 1 - Install bison version 2.0
curl -s -S -O http://ftp.gnu.org/gnu/bison/bison-2.0.tar.gz tar zxf bison-2.0.tar.gz cd bison-2.0 ./configure make sudo make install cd ..
STEP 2 - Install flex version 2.5.31
curl -s -S -O http://easynews.dl.sourceforge.net/sourceforge/lex/flex-2.5.27.tar.gz tar zxf flex-2.5.27.tar.gz cd flex-2.5.27 ./configure make sudo make install cd ..
STEP 3 - Install sed version 4.1.4
curl -s -S -O http://ftp.gnu.org/gnu/sed/sed-4.1.4.tar.gz tar zxf sed-4.1.4.tar.gz cd sed-4.1.4 ./configure make sudo make install cd ..
STEP 4 - Install help2man version 1.35.1
curl -s -S -O ftp://ftp.gnu.org/gnu/help2man/help2man-1.35.1.tar.gz tar zxf help2man-1.35.1.tar.gz cd help2man-1.35.1 ./configure --enable-nls=no make sudo make install cd ..
STEP 5 - Download gcc version 3.4.3
curl -s -S -O ftp://ftp.gnu.org/gnu/gcc/gcc-3.4.3/gcc-core-3.4.3.tar.bz2 bunzip2 gcc-core-3.4.3.tar.bz2 tar xf gcc-core-3.4.3.tar
STEP 6 - Download gpc-20050331
curl -s -S -O http://www.g-n-u.de/gpc/gpc-20050331.tar.bz2 bunzip2 gpc-20050331.tar.bz2 tar xf gpc-20050331.tar mv p gcc-3.4.3/gcc
STEP 7 - Configure gcc/gpc
mkdir build cd build ../gcc-3.4.3/configure --enable-languages=pascal,c --enable-threads=posix --prefix=/Developer/Pascal/gpc-20050331
STEP 8 - Patch gcc for Mac OS X
gcc 3.4.3 has a problem with Mac OS X 10.4, so apply the patch from http://cvs.opendarwin.org/index.cgi/dports/lang/gcc34/files/patch-darwin.h?rev=1.3&content-type=text/x-cvsweb-markup, execute the patch command, paste in the following lines, then press control D (^D)
patch -p0 --ignore-whitespace --- ../gcc-3.4.3/gcc/config/darwin.h.sav 2005-05-18 13:56:37.000000000 -0400 +++ ../gcc-3.4.3/gcc/config/darwin.h 2005-05-18 13:57:48.000000000 -0400 @@ -275,7 +275,8 @@ /* Machine dependent libraries. */
#undef LIB_SPEC -#define LIB_SPEC "%{!static:-lSystem}" +#define LIB_SPEC "%{!static:-lSystemStubs -lSystem}" +
/* We specify crt0.o as -lcrt0.o so that ld will search the library path. */ ^D
STEP 9 - Build gcc
make EXTRA_PFLAGS=--longjmp-all-nonlocal-labels STAGE1_CFLAGS='-g -DHAVE_DESIGNATED_INITIALIZERS=0' bootstrap sudo make install cd ..
STEP 10 - Install gp
gp does not handle capital letters in unit names, even on case insensitive file systems. The patch resolves that issue. Remember that ^D means press control-D.
curl -s -S -O http://fjf.gnu.de/misc/gp.tar.bz2 bunzip2 gp.tar.tar.bz2 cd gp-0.60 ./configure --prefix=/Developer/Pascal/gpc-20050331 patch -p1 --ignore-whitespace --- gp-0.60/gp.pas 2005-06-06 04:31:51.000000000 +0800 +++ gp-0.60-mine/gp.pas 2005-06-25 11:21:53.000000000 +0800 @@ -708,7 +710,7 @@ if FileName <> '' then UnitNameMatch := (Dep.SrcBaseNameExt = FileName) or (Dep.SrcBaseName = FileName) else - UnitNameMatch := Dep.SrcBaseName = InterfaceName + UnitNameMatch := LoCaseStr( Dep.SrcBaseName ) = LoCaseStr( InterfaceName ); end;
function NewUsesElement (const InterfaceName, FileName: String; Next: PUnitList) = p: PUnitList; ^D make sudo make install cd ..
STEP 11 - Setup some links
sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/gpc /usr/bin/gpc sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/gcc /usr/bin/gpcgcc sudo ln -s -f -h /Developer/Pascal/gpc-20050331/lib/gcc/powerpc-apple-darwin7/3.4.3/ /Developer/Pascal/gpclibs sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/gpidump /usr/bin/gpidump sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/binobj /usr/bin/gpcbinobj sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/gpc-run /usr/bin/gpc-run sudo ln -s -f /Developer/Pascal/gpc-20050331/bin/gp /usr/bin/gp