Installation of 32bit GNUstep on 64bit Linux

From GNUstepWiki
Revision as of 22:09, 23 August 2005 by Bheron (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Installation of 32bit GNUstep on 64bit Linux

Recently, I got a new machine. My old machine was fried by a power surge, in spite of being behind a UPS. I decided to go all out and get a new machine w/ a P4 EM64T Processor with Hyperthreading 2GB of memory, etc. Unfortunately, there are currently some problems with running GNUstep configured under 64bit. While these problems are being worked on, it's helpful to be able to install a 32bit version of the GNUstep environment into your machine. Here are some of my notes on how I did it.

Differences between distros

The distribution that I have is SuSE9.3. SuSE keeps it's 64bit versions of libraries in /usr/lib64, /usr/local/lib64 etc. The 32bit versions go into the regular lib directories. SuSE gives both 32bit and 64bit development versions of some libraries, but not for others. Your mileage may vary. There are two ways to get around this:

1) find and build each package as a 32bit library (more on this later) 2) find the rpms for each library as a i586 or i386 library and install it under /usr/local using the --relocate

Building 32bit binaries

64bit distros of either linux or BSD are equipped, obviously, with a copy of gcc that can compile 64bit binaries. These have an option which allows you to build 32bit binaries as well... it's -m32. When you build, it's possible to override certain settings in "configure" scripts by setting evironment variables. The following script worked for me:

   #!/bin/sh
   export CC="gcc -m32"
   export CXX="g++ -m32"
   export LD="ld -m elf64_i386"
   export AS="gcc -c -m32"
   export LDFLAGS="-L/usr/lib -L/usr/local/lib"

I simply source this script prior to the build. Additionally, when running configure you might want to add the following parameters:

./configure --libdir=/usr/lib --x-libraries=/usr/X11R6/lib

If your machine puts the 64bit libraries into lib and 32bit binaries into lib32, you should modify the above accordingly.

Using RPMs w/ relocate

As mentioned above some of the libraries have 32bit devel counterparts and some don't. I'm not sure why it's done this way. All you need to do to get around this is rpm -ivh --relocate=/usr=/usr/local <name of package>. This allows you to have a i586/i386 package installed under /usr/local that will not interfere with the one installed in /usr/lib.

Building GNUstep

Here is my build script to build all of GNUstep in one shot, more or less. :) I've modified it here to include all of the options which I used to build GNUstep as a 32bit. See below:

   #/bin/sh
   
   # Source the 32bit build script...
   . ~/bin/32bit
   
   ## install make
   cd ~/Development/gnustep/core/make
   make distclean
   sh ./configure && make
   su -c 'make install'
   
   ## install base
   cd ../base
   make distclean
   sh ./configure --libdir=/usr/lib --x-libraries=/usr/X11R6/lib
   make debug=yes
   su -c '. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh && make debug=yes install'
   
   ## install gui
   cd ../gui
   make distclean
   sh ./configure --disable-cups --libdir=/usr/lib --x-libraries=/usr/X11R6/lib
   make debug=yes
   su -c '. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh && make debug=yes install'
   
   ## install back
   cd ../back
   make distclean
   sh ./configure --enable-graphics=art --libdir=/usr/lib --x-libraries=/usr/X11R6/lib
   make debug=yes
   su -c '. /usr/GNUstep/System/Library/Makefiles/GNUstep.sh && make debug=yes install'
   ## complete
   echo "Completed"
   date
   exit 0

There you have it. This is what worked for me. Please feel free to add additional sections to this page for BSD and other 64bit OSs.