Stable version?

Peter N Lewis peter at stairways.com.au
Thu Jul 7 13:43:18 CEST 2005


>  > Which GCC version should I compile to compile the latest GPC snapshot (the
>>  only downloadable file at the time being)?
>
>3.2.x, 3.3.x or 3.4.3 should all work well. If you need to download
>one anyway, I suggest 3.4.3. (This is the source GCC you need for
>building GPC. The installed GCC compiler versions shouldn't matter
>much, just use the one you have installed.)

I posted instructions for getting gpc to compile from scratch on Mac 
OS X 10.4 recently (I'll repeat them below).  The process should be 
similar for any unix system, although you may not need the patches 
and tweaks described in my docs).

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

-- 
<http://www.stairways.com/>  <http://download.stairways.com/>




More information about the Gpc mailing list