Recently I developed an urgent need to compile some C stuff on one HP-UX 11.11 host. You know, one of those little wonderful machines,
that have no gmake, no gcc
no bison, flex, or gas,
just a K&R's /usr/bin/cc
and /usr/bin/as
The problem is that I'm not a system administrator of the abovementioned machine, hence I can't install libraries/compilers under /usr or /usr/local. I decided to place all necessary tools under my home directory (/home/xrgtn/bin), but precompiled gcc refused to work with bundled /usr/bin/as while GNU assembler refused to find symlinked /home/xrgtn/lib/libbfd.sl despite all power of the LD_LIBRARY_PATH and SHLIB_PATH magic applied.
I decided to build gcc&Co from sources. I probably won't comment on all gory details of this wonderful (and equally useful and exciting) process, just outline what's necessary to build gcc on HP-UX 11.11 starting with K&R only.
- get binutils-2.11 and compile it with K&R (later versions of binutils won't do). Install under /home/xrgtn/*. In short, to do this you must:
CC=/usr/bin/cc CFLAGS= ./configure --prefix=/home/xrgtn/xxx
make
make install
cp -pR ~/xxx/* ~/
- get, build and install m4-1.4.1 (later versions won't do)
- get, build and install autoconf-2.13 (later versions won't do)
- get, build and install make-3.75 (later versions won't do)
- get, build and install bison-1.25 (later versions won't do)
- get, build and install flex-2.5.4 (later versions won't do)
- then comes the real adventure - get gcc-3.0.4, and build it that way (the MAKE="make -j 4" part was particularly useful for my HP-UX host, since it had 4 CPUs and it was real fun to witness at times four cc1 processes running in parallel):
CC=/usr/bin/cc CFLAGS= ./configure --prefix=/home/xrgtn/xxx \
--enable-languages="c,c++,f77,objc" \
--with-as=/home/xrgtn/bin/as
make bootstrap MAKE="make -j 4"
make install
cp -pR ~/xxx/* ~/
- after the last cp -pR ~/xxx/* ~/ you should be able to compile and run your favourite helloworld.c program :)
Well, actually what you'd probably like to do next is to upgrade all that pretty old make/gcc/binutils/etc stuff to the latest versions. Since you have now the real ANSI/ISO C compatible compiler (gcc 3.0.4) and GNU make, you can easily do this yourself without my further guidance.