Installation of 32bit GNUstep on 64bit Linux

From GNUstepWiki
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.

Proceed at your own risk. ;)

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. Some of the supporting libraries for GNUstep aren't included as 32bit devel libs, so they must be provided. Your mileage may vary. There are two ways to get around this:

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

Also, please note, that these instructions only seem to apply to SuSE and distros derived from it. Debian derived distributions don't seem to have an issue building 64bit using the normal build process.

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, which called "32bit" and put in my ~/bin directory, 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 so that it will not interfere with the one installed in /usr/lib (or /usr/lib64).

Please note that on some systems you might have to re-install the 64bit packages after you install the i586 or i386 packages in /usr/local. Doing this prevents the rpm database from being inconsistent. Otherwise the system will not warn you about missing dependencies for any packages which depend on the libraries you install in this way.

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  --build=i386-linux-gnu --libdir=/usr/lib && make
   su -c 'make install'
   
   ## install base
   cd ../base
   make distclean
   sh ./configure  --build=i386-linux-gnu --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  --build=i386-linux-gnu --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  --build=i386-linux-gnu --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.