Wednesday, May 14, 2008

Installing GCC on SCO OpenServer 5.0.6


A short log of issues when configuring a GNU development environment on SCO OpenServer 5.0.6. I've had problems over the years with separate packages overwriting files from other GNU packages, so I wanted to clean up my installs and wanted to write about the problems here for others and for my future reference. This is 5.0.6 specific, though this procedure should work for 5.0.x, or any that oss646c, gnutools and a recent version of gwxlibs will install on.

My test system for this was a VMWare Server 1.0.5 virtual box so I could grab a sequence of screenshots and vm snapshots.


Invaluable SCO resources:

I had a box that no amount of installing/uninstalling gnutools/gwxlibs/oss646c in any order would result in a working gcc compiling environment, I rolled back ALL software I could see in the software manager including rs506a, then followed the procedure below and everything was back to working perfectly.

Basic steps:
  1. Base SCO install
  2. Install the linkers and libraries package from the SCO distribution media.
  3. Install any required OS patches including oss646c.
  4. Install gnutools-5.0.7Kj
  5. touch /tmp/gnutools.nocheck
  6. Install gwxlibs-2.1.0Ba (or latest gwxlibs available).
  7. Configure paths. /usr/gnu/i586-pc-sco3.2v5.0/bin to your PATH.

1. Base SCO install

Nothing special to know during the installation. Just go by all the defaults unless you know what you're doing. Install the SMP supplement from the instsall CD first, then I consider rs506a to be part of the base install so please install that before the next step. It's probably meant to be installed AFTER the Linkers and Libraries, but this is the order everyone seems to do it, so you're better off running into the same problems as everyone else when something fails to compile and you google for the error.

2. Libraries and linkers.

From the original install CD, install the package named "SCO OpenServer Linker and Application Development Libraries". On my media it is version 5.1.2A.












When it asks for the license codes, select "defer", they won't be required since we aren't using SCO's compiler.

NOTE: Don't get this package confused with the Unixware & OpenServer Development Kit that is on a separate CD to the OSR5 install disk.

3. Install your OS patches.

I install the following patches and packages in this order. At the very least you probably should install oss646c before the next step.
UDKCompat 7.1.1 (or the version you require - it's up to 8.0.2)
oss630a
oss629a
oss646c
oss631b (This one is actually upgraded by gwxlibs)
oss635a
oss636a
oss638a
oss640a
oss642a
oss643a
oss644b
oss645a
oss648a
oss650a
oss651a
oss663a

UDKCompat and oss630a can be installed with the pkgadd command. eg.

cd /tmp/OSRCompat711
pkgadd -d`pwd`/OSRCompat711 all
cd /tmp/oss630a
pkgadd -d`pwd`/oss630a all
But UDK Compat libraries 8.0.2 includes the OSRCompat UDK package as part of VOLs, so depends what version is in your SOE. We had no need to upgrade so kept it at 7.1.1.

oss629a must be installed manually since it has 2 components, using the custom software manager. This can be automated with the custom command below if you work out the sub package names in the volume.

The rest of the oss patches can be installed by changing to their directory and running this command:

custom -i -p `grep "^PROD:" VOL.000.000 |head -1 |cut -d: -f2,3` -z `pwd`


Some may prompt for an "i" to ignore the warning that some software isn't installed or is installed and will be upgraded. You can probably pipe "yes i" to the custom command to have it automatically send "i" to the prompt, or maybe there's a custom flag, I can't remember now.

Why install all these patches? Well we actually encountered quite a number of problems resolved by these patches, so all servers are brought up to the same patch level (and see note above about OSR/UDK compat patches).

To compile your own version of GCC, the GCC docs now claims you need oss631c as well, which includes a number of libraries such as zlib. From snippets I've found it seems oss631 was renamed to gwxlibs which might just confuse you more.

4. Install gnutools-5.0.7Kj

eg.
cd /tmp/gnutools-5.0.7Kj
custom -i -p `grep "^PROD:" VOL.000.000 |head -1 |cut -d: -f2,3` -z `pwd`

5. gwxlibs install fix

Type this command to prevent software manager errors which prevent gwxlibs from installing properly:

touch /tmp/gnutools.nocheck

6. Install gwxlibs-2.1.0Ba

Or the latest gwxlibs you can find.

eg.

cd /tmp/gwxlibs-2.1.0Ba
custom -i -p `grep "^PROD:" VOL.000.000 |head -1 |cut -d: -f2,3` -z `pwd`


7. Adding new bin PATH and LD_LIBRARY path

Edit ~/.profile, add paths as required. eg. (as suggested by Boyd Gerber).

[ -d /usr/local/bin -a -x /usr/local/bin ] && PATH=$PATH:/usr/local/bin
[ -d /usr/gnu/bin -a -x /usr/gnu/bin ] && PATH=$PATH:/usr/gnu/bin

PATH=$PATH:$HOME/bin:. # set command search path
export PATH

[ -d /usr/local/lib -a -x /usr/local/lib ] && LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
[ -d /usr/gnu/lib -a -x /usr/gnu/lib ] && LD_LIBRARY_PATH=/usr/gnu/lib:$LD_LIBRARY_PATH

[ -d /usr/X11R6/lib -a -x /usr/X11R6/lib ] && LD_LIBRARY_PATH=/usr/X11R6/lib:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH

I'ts possible you may need to add /usr/gnu/i586-pc-sco3.2v5.0/bin to your path also, unless it was a shell bug that didn't pick up the correct directories.


Testing time


1. Let's whip up a hello.c.


2. Let's compile it!

# gcc -o hello hello.c
#
hello.c: In function `main':
hello.c:3: warning: return type of `main' is not `int'
#

Never mind the warning, teehee.

3. And finally, will it execute?

# ./hello
Hello World!



4. Now a basic package that needs to be built with make. Downloaded GNU Barcode, ran ./configure, make. No errors and nice "barcode" and "sample" binaries created. Looks like a nice working environment.

Known Compiling Issues

  • The Korn shell, while reasonably good, doesn't like some build scripts (eg. GNU GCC definitely requires and recommends BASH).
  • MAXPATHLEN doesn't seem to be defined in system headers according to a few packages I built.

1 comment:

Anonymous said...

to iX:
many thanks, buddy!
it really useful for me.
--
sincere regards