Compiling GCC 4.4.7 on Tru64 5.1B

Updated on 1st May 2017 – added some more gcc configure options

We don’t want to die … and having the Easter feast recently I wanted to bring from the dead the OSF1 Tru64 5.1B Unix once again.

Another thing that I have brought from the dead is my old Twitter account @ https://twitter.com/astr0baby

This took me a while to find out exact steps so I decided to share my experiment with others if needed.  Quoting one of the greatest thinkers and philosophers of the 11th Century AD

Some samples from Rubáiyát of Omar Khayyám

Who knows the meaning of a grain of sand
Knows the whole meaning of the sea and land,
And simple One by thousands multipliedg
Is no more difficult to understand.
When, with wild joys and sorrows broken quite,
I face the morning of the endless night,
Still shall I call for wine, and still for thee,
And Pleasure close the eyes she once kept bright.

 

The following steps should work on a real Alpha system running Tru64, but since I dont have the hardware, all my experiments are done via alphavm_free emulator

Some additional information on how to setup/install Tru64 on alphavm_free is here

https://astr0baby.wordpress.com/2014/04/07/running-tru64-unix-inside-a-vm-for-metasploit-testing/
https://astr0baby.wordpress.com/2014/04/08/setting-up-x11-on-tru64-vm-via-vnc/
https://astr0baby.wordpress.com/2017/02/20/unix-os-archaeology-tru64-unix-part-2/
https://astr0baby.wordpress.com/2017/03/08/marrakech-express-has-arrived-to-tru64/
https://astr0baby.wordpress.com/2017/03/22/tru64-unix-v5-1-metasploit-payloads-pt-2/
https://astr0baby.wordpress.com/2017/04/09/unix-os-archaeology-digital-unix-osf1-v4-0-1091-alpha/
https://astr0baby.wordpress.com/2017/04/12/all-tru64-unix-5-1e-licenses/

Lets presume we all know how to run Tru64 in alphavm or on real hardware.

Pre-requisites:

  • Make sure you use a large enough disk for GCC 4.4.7 compilation (16 Gigs )
  • Make sure you use a relatively new gnu tar !
  • Remove any obsolete gtar
  • (remove any gtar package that you might have)
  • ccc Compaq C Compiler (Compaq C for Tru64 UNIX Version 5.1A or higher)
 # rpm -e gtar 
 # mkdir /data/ 
 # cd /data/
 # wget http://ftp.gnu.org/gnu/tar/tar-1.23.tar.gz
 # gunzip tar-1.23.tar.gz 
 # tar -xvf tar-1.23.tar 
 # cd tar-1.23
 # env CPPFLAGS=-I/usr/local/include LDFLAGS=-s FORCE_UNSAFE_CONFIGURE=1 ./configure
 # make 
 # make install

GCC 4.8 > does not support Tru64 anymore … GCC 4.7 only with –enable-legacy configure script … so stick to something older :) We will choose GCC 4.4.7 from 2012 GCC needs libiconv to build.

Download libiconv

 # cd /data
 # wget http://ftp.gnu.org/gnu/libiconv/libiconv-1.8.tar.gz
 # gunzip libiconv-1.8.tar.gz
 # /usr/local/bin/tar -xvf libiconv-1.8.tar
 # cd libiconv-1.8
 # env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 # make
 # make install

Download GCC

 # cd /data
 # wget http://ftp.gnu.org/gnu/gcc/gcc-4.4.7/gcc-4.4.7.tar.gz
 # gunzip gcc-4.4.7.tar.gz
 # /usr/local/bin/tar -xvf gcc-4.4.7.tar.gz
 # mv /data/gcc-4.4.7 /data/gcc-new
 # cd /data/gcc-new
 #./configure --prefix=/data/gcc447 --enable-threads=posix --disable-nls --enable-languages=c,c++ --without-gnu-ld --with-ld=/usr/ccs/bin/ld --without-gnu-as --with-as=/usr/bin/as --disable-libssp --with-libiconv-prefix=/usr/local
 - error needs gmp

–prefix=/usr/local/gcc4 –enable-languages=c,c++ –enable-threads=posix –disable-nls –host=alpha-dec-osf5.1b –without-gnu-ld –with-ld=/usr/ccs/bin/ld –without-gnu-as –with-as=/usr/bin/as –disable-libssp

Download gmp

 # cd /data
 # wget http://ftp.gnu.org/gnu/gmp/gmp-5.0.5.tar.bz2
 # bunzip2 gmp-5.0.5.tar.bz2
 # /usr/local/bin/tar -xvf gmp-5.0.5.tar
 # cd gmp-5.0.5
 # env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 # make
 # make install
 # make install-data-hook

Go back to build gcc-new

 # cd /data/gcc-new
 #./configure --prefix=/data/gcc447 --enable-threads=posix --disable-nls --enable-languages=c,c++ --without-gnu-ld --with-ld=/usr/ccs/bin/ld --without-gnu-as --with-as=/usr/bin/as --disable-libssp --with-libiconv-prefix=/usr/local --with-gmp=/usr/local
 checking for correct version of mpfr.h... no (MPFR 2.3.2+.)
 -error needs mpfr

Download mpfr

 # cd /data
 # wget http://mpfr.loria.fr/mpfr-2.4.2/mpfr-2.4.2.tar.gz
 # gunzip mpfr-2.4.2.tar.gz
 # /usr/local/bin/tar -xvf mpfr-2.4.2.tar
 # cd mpfr-2.4.2
 # env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 # make
 # make install

Go back to build gcc-new

 # cd /data/gcc-new
 # ./configure --prefix=/data/gcc447 --enable-threads=posix --disable-nls --enable-languages=c,c++ --without-gnu-ld --with-ld=/usr/ccs/bin/ld --without-gnu-as --with-as=/usr/bin/as --disable-libssp --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local
 # make
 Makefile:27: *** GNU make version 3.80 or newer is required.. Stop.
 - error need gmake 3.8 >

Remove the obsolete gmake-3.79 rpm package

 # rpm -e gmake

Download gnu make

 # cd /data
 # wget http://ftp.gnu.org/gnu/make/make-3.80.tar.gz
 # gunzip make-3.80.tar.gz
 # /usr/local/bin/tar -xvf make-3.80.tar
 # cd make-3.80
 # env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
 # make
 # make install

Go back to build gcc-new

 # cd /data/gcc-new
 # /usr/local/bin/make

 ------<cut>-------
 e-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat
 -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
 -DHAVE_CONFIG_H -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include
 -I/usr/local/include -I/usr/local/include -I../.././gcc/../libdecnumber -I../.././gcc/../libdecnumber/dpd -I../libdecnumber
 -I/usr/local/include ../.././gcc/c-common.c -o c-common.o
 swap space below 10 percent free
 cc1: out of memory allocating 8016 bytes after a total of 129394960 bytes make[3]: *** [c-common.o] Error 1

Seems we are out of memory …. :(

I had little swap (256 MB) so I decided to add more just in case (power off the simulator)

 # shutdown -h now

Create a new disk 2GB on the linux host to have dedicated 2 GB swap for Tru64

 linux$ dd if=/dev/zero of=swap.dd bs=1024 count=2M

Add the new disk config to config.emu

 scsi_disk dka2 {
 scsi_bus = 0;
 scsi_id = 3;
 scsi_lun = 0;
 file = 'swap.dd';
 caching = no;
 write_through = yes;
 }

Boot Tru64, once inside

 # hwmgr -show scsi
 # disklabel -rw dsk3c
 # disklabel -r dsk3c
 # /dev/rdisk/dsk3c:

 # vi /etc/sysconfigtab

 Search for /dev/disk/dsk0b and add the following to it

 swapdevice = /dev/disk/dsk0b,/dev/disk/dsk3c

 # swapon -a

Check the memory Physical RAM:

 # /bin/vmstat -P grep "Total Physical Memory"

Swap Space:

 # /sbin/swapon -s
 Swap partition /dev/disk/dsk0b (default swap):
 Allocated space: 35098 pages (274MB)
 In-use space: 1 pages ( 0%)
 Free space: 35097 pages ( 99%)

 Swap partition /dev/disk/dsk4c:
 Allocated space: 262144 pages (2.00GB)
 In-use space: 1 pages ( 0%)
 Free space: 262143 pages ( 99%)

 Total swap allocation:
 Allocated space: 297242 pages (2.27GB)
 Reserved space: 8214 pages ( 2%)
 In-use space: 2 pages ( 0%)
 Available space: 289028 pages ( 97%)
 # ulimit -Sd unlimited

Go back to build gcc-new

 # cd /data/gcc-new
 # /usr/local/bin/make

.....<cut>.......
 e-strings -Wstrict-prototypes -Wmissing-prototypes -Wcast-qual -Wold-style-definition -Wc++-compat
 -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings
 -DHAVE_CONFIG_H -I. -I. -I../.././gcc -I../.././gcc/. -I../.././gcc/../include -I../.././gcc/../libcpp/include
 -I/usr/local/include -I/usr/local/include -I../.././gcc/../libdecnumber -I../.././gcc/../libdecnumber/dpd -I../libdecnumber
 -I/usr/local/include ../.././gcc/c-common.c -o c-common.o
 swap space below 10 percent free
 cc1: out of memory allocating 8016 bytes after a total of 129394960 bytes make[3]: *** [c-common.o] Error 1

Check the limits

 # ulimit -d
 131072
 # ulimit -d unlimited
 # ulimit -d
 131072
 # ulimit -d 500000
 # ulimit -d
 131072

 # sysconfig -q proc | grep per_proc_data_size
 per_proc_data_size = 134217728

Read https://docs.oracle.com/cd/B13866_04/wp.904/b15607/tru64.htm

Set the following values to /etc/sysconfigtab

proc:
 per_proc_stack_size = 33554432
 per_proc_data_size = 801326592

Reboot and check

# ulimit -d
 782546

Continue with the build process for gcc 4.4.7

 # cd /data/gcc-new
 # /usr/local/bin/make
 # /usr/local/bin/make install

Check the gcc version

# /data/gcc447/bin/gcc -v
 Using built-in specs.
 Target: alphaev67-dec-osf5.1b
 Configured with: ./configure --prefix=/data/gcc447 --enable-threads=posix --enable-languages=c,c++ --with-libiconv-prefix=/usr/local --with-gmp=/usr/local --with-mpfr=/usr/local
 Thread model: posix
 gcc version 4.4.7 (GCC)

Advertisements
Gallery | This entry was posted in Uncategorized and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s