Building and Installing GNUstep on Linux

From Techotopia
Revision as of 19:45, 16 September 2009 by Neil (Talk | contribs) (Obtaining the GNUstep Source Code)

Jump to: navigation, search

In Installing and Using GNUstep and Objective-C on Linux, we covered the steps involved in installing the GNUstep environment on Linux distributions for which pre-built GNUstep packages are available. Unfortunately, very few Linux distributions have pre-hbuilt packages available making it necessary download and build the GNUstep sources.

The purpose of this chapter of Objective-C 2.0 Essentials is to outline the steps necessary to download and build the GNUstep sources. The process outlined here is known to work on Fedora, Red Hat Enterprise Linux and CentOS. The steps should be largely similar for other Linux distributions, though the exact command to perform package installations may differ from the one used here. For details on how to install specific packages for your chosen Linux distribution it may be necessary to refer to the corresponding documentation.

Installing gcc and Objective-C Support on Linux

The first step in the build process is to install gcc together with the gcc Objective-C package. These packages are called gcc and gcc-obj respectively and on Red Hat, Fedora and CentOS systems may be installed as follows:

su - 
yum install gcc
yum install gcc-objc

Once installed, the next step is to resolve some additional package dependencies.

Package Dependencies

A Linux distribution is essentially a Linux kernel and a range of packages. Each distribution conists of a vast array of packages, many of which are not installed by default when the operating system is first installed. The idea behind this is to keep in the size of the installed operating system to a minium, encouraging users to only install a package when they actually need it. Consequently, there are many packages upon GNUstep is dependent that are not installed by default on most Linux systems. Before we can embark on a GNUstep environment build, therefore, it is necessary to install these package dependencies. Fortunately, these can be installed using a single command:

yum install make libpng libpng-devel libtiff libtiff-devel libobjc libxml2 libxml2-devel libX11-devel libXt-devel libjpeg libjpeg-devel

Keep in mind that some of these packages may already be installed, in which case the package manager will simply move on to the next package. In addition, many of these packages will have dependencies of their own which will be added to the installation process automatically.

Once the packages are installed we are ready to download the GNUstep source code.


Obtaining the GNUstep Source Code

The GNUstep core consist of the following packages:

  • GNUstep Make
  • GNUstep Base
  • GNUstep GUI
  • GNUstep Backend

Each of these packages needs to be built and installed on your Linux system in order to gain access to the full power of Objective-C and to be able to work with the examples in the remainder of this book. Fortunately a single package called GNUstep Startup is provided that contains the source code for all four of the above packages. This package can be downloaded from the GNUstep.org website.

Once the package has been download to a suitable work folder it can be unpacked as follows:

tar xvfz gnustep-startup-0.22.0.tar.gz

The source files will be unpacked into a new directory named gnustep-startup-0.22.0. Change directory into this folder as follows:

cd gnustep-startup-0.22.0