Using GCCSDK 3.4.6: Difference between revisions

From RISC OS
Jump to navigationJump to search
(Move old section to here.)
(Older build instructions)
 
Line 1: Line 1:
= Instructions for use of GCCSDK 3.4.6 with Autobuilder =
= Instructions for use of GCCSDK 3.4.6 with Autobuilder =


These are maintained for historical reference, and many not work exactly due to the focus being on GCC 4.1
These are maintained for historical reference, and many not work exactly due to the focus being on GCC 4.1.1.

== Building the cross-compiler ==

Cross-compiling for RISC OS is done by using [[GCCSDK]] on Unix-alike host system, such as GNU/Linux, FreeBSD, Solaris, MacOS X or even Windows ([[cygwin_setup|under Cygwin]]). To get started, ensure you have a [http://subversion.tigris.org/ Subversion] client installed for your system, and fetch the GCCSDK source to the current directory (which needs about 280MB disc space).

First we set the GCCSDK_SRC variable so this tutorial can refer to the position of the sources (assuming Bash shell is used):

export GCCSDK_SRC=$PWD/gccsdk

Then fetch GCCSDK:

mkdir $GCCSDK_SRC
svn co svn://svn.riscos.info/gccsdk/branches/release_3_4_6/gcc $GCCSDK_SRC/gcc

Detailed build instructions are given in the file gccsdk/gcc/README (or the [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Fbranches%2Frelease_3_4_6%2Fgcc%2FREADME&rev=0&sc=0 WebSVN copy]), however they are essentially as follows. Refer to the README where assumptions are noted.

You'll need at least the following programs (or later versions) installed on your Unix-alike machine:
gcc version 3 recommended
svn (subversion)
bash for this example
autoconf version 2.50
autoheader
bison version 1.27
flex version 2.5.4
gperf version 2.7.2
sed version 2.05
GNU make version 3.80
makeinfo version 4.2 (see README for Debian notes)

We also need to be able to write to a directory named /home/riscos (this can be changed, see the README).

To build GCCSDK (this may take many minutes, depending on the speed of your computer):

cd $GCCSDK_SRC/gcc
autoconf ; autoheader
./do-configure
make setup
make build-cross
make porting-scripts

You now have a complete GCC cross-compiler environment.



== Using the cross-compiler on its own ==
== Using the cross-compiler on its own ==

Latest revision as of 15:22, 2 February 2008

Instructions for use of GCCSDK 3.4.6 with Autobuilder

These are maintained for historical reference, and many not work exactly due to the focus being on GCC 4.1.1.

Building the cross-compiler

Cross-compiling for RISC OS is done by using GCCSDK on Unix-alike host system, such as GNU/Linux, FreeBSD, Solaris, MacOS X or even Windows (under Cygwin). To get started, ensure you have a Subversion client installed for your system, and fetch the GCCSDK source to the current directory (which needs about 280MB disc space).

First we set the GCCSDK_SRC variable so this tutorial can refer to the position of the sources (assuming Bash shell is used):

export GCCSDK_SRC=$PWD/gccsdk

Then fetch GCCSDK:

mkdir $GCCSDK_SRC
svn co svn://svn.riscos.info/gccsdk/branches/release_3_4_6/gcc $GCCSDK_SRC/gcc

Detailed build instructions are given in the file gccsdk/gcc/README (or the WebSVN copy), however they are essentially as follows. Refer to the README where assumptions are noted.

You'll need at least the following programs (or later versions) installed on your Unix-alike machine:

gcc		version 3 recommended
svn (subversion)
bash		for this example
autoconf 	version 2.50
autoheader
bison		version 1.27
flex		version 2.5.4
gperf		version 2.7.2
sed		version 2.05
GNU make	version 3.80
makeinfo	version 4.2 (see README for Debian notes)

We also need to be able to write to a directory named /home/riscos (this can be changed, see the README).

To build GCCSDK (this may take many minutes, depending on the speed of your computer):

 cd $GCCSDK_SRC/gcc
 autoconf ; autoheader
 ./do-configure
 make setup
 make build-cross
 make porting-scripts

You now have a complete GCC cross-compiler environment.


Using the cross-compiler on its own

The cross-compiler gets installed in the 'prefix' bin sub-directory given as parameter to the 'configure' script (see 'do-configure' file). You can find the following binaries : ar, c++, cc, cmunge, decaof, drlink, g++, g77, gcc, gcov, libfile, nm, ranlib, resgen, strip and zip, which you can on your Unix-alike host to build RISC OS programs.

Since GCCSDK GCC 3.4.6 Release 3 and with the aid of syslogd module you have RISC OS throwback support in the cross-compiler allowing to have warning and error feedback on RISC OS of compilations done on a remote host.

An example of a more advance use of the cross-compiler is to build GCC for RISC OS (the first 4 steps are not necessary when you already have the GCC cross-compiler built):

 cd $GCCSDK_SRC/gcc
 autoconf ; autoheader
 ./do-configure
 make setup
 make


Using the cross-compiler and porting-scripts

The porting-scripts are installed in the 'with-riscos-env' directory given as parameter to the 'configure' script (see 'do-configure' file - by default it's /home/riscos/env). The "ro-" prefixed scripts are wrappers around the similar named and well-known build tools to ensure that the cross-compiler is used instead of the native compiler on your Unix-alike host.

So you use '/home/riscos/env/ro-make' instead of 'make' and your project will be built using the cross-compiler instead of the native compiler. You use '/home/riscos/env/ro-config' instead of './configure' and your project will be 'configured' using the cross-compiler settings. And so on.

Using the cross-compiler with Autobuilder

The Autobuilder infrastructure is meant to be able to cross-compile a broad set of open-source programs with a minimal of manual work (ideally none) allowing to have constant access to recent versions of those programs under RISC OS. It consists of a couple of scripts in the Autobuiler directory gccsdk/autobuilder which fetches the to-be-built programs as source from internet and cross-compiles it using the GCCSDK cross-compiler and its porting-scripts.

The recipe to build these open-source programs is stored in a per program unique subdirectory of the 'autobuilder' directory and is holding one or more files specifying where the source can be found, the patches needing to be applied (if any) and how it needs to be built using the cross-compiler and porting-scripts. And finally how it should be packaged and published (either locally in a directory, either uploaded to a website such as Unix Porting Project download pages.