Using GCCSDK: Difference between revisions

From RISC OS
Jump to navigationJump to search
(Mention syslogd support in the cross-compiler)
 
 
(71 intermediate revisions by 10 users not shown)
Line 1: Line 1:
= Using GCCSDK to cross-compile for RISC OS =
= Using GCCSDK and Autobuilder to cross-compile for RISC OS =


== Building the cross-compiler ==
== Building the cross-compiler ==


''The [[Using_GCCSDK_3.4.6|previous version]] of these instructions referred to the use of the [[Using GCCSDK 3.4.6|GCC 3.4.6 cross compiler]]. Due to ongoing development, using GCC 3.4.6 may no longer work with all Autobuilder packages. The focus is now on the GCC 4.7.x (stable) or GCC 4.1.2 (deprecated) cross compiler with the Autobuilder.''
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).


Cross-compiling for RISC OS is done by using [[GCCSDK]] on a 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 and Autobuilder infrastructure to the current directory:
First we set the GCCSDK_SRC variable so this tutorial can refer to the position of the sources (assuming Bash shell is used):


In case you want to use the stable cross-compiler (based on gcc 4.7.x):
export GCCSDK_SRC=$PWD/gccsdk


<nowiki>$ mkdir gccsdk
Then fetch GCCSDK:
$ cd gccsdk
$ svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder/ autobuilder
$ svn co svn://svn.riscos.info/gccsdk/trunk/gcc4/ gcc4</nowiki>


In case you want to use old (deprecated) cross-compiler (based on gcc 4.1.2):
mkdir $GCCSDK_SRC
svn co svn://svn.riscos.info/gccsdk/branches/release_3_4_6/gcc $GCCSDK_SRC/gcc


<nowiki>$ mkdir gccsdk
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.
$ cd gccsdk
$ svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder/ autobuilder
$ svn co svn://svn.riscos.info/gccsdk/branches/release_4_1_2/ gcc4</nowiki>


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)


Build the cross compiler and follow the prompts:
We also need to be able to write to a directory named /home/riscos (this can be changed, see the README).


$ cd gcc4
To build GCCSDK (this may take many minutes, depending on the speed of your computer):
$ ./build-world


When ''build-world'' is run for the first time, it will ask you to confirm the settings in the created file ''gccsdk-params''. Note that its default settings are installing the cross-compiler at gccsdk/gcc4/cross (known as the parent directory of ''GCCSDK_INSTALL_CROSSBIN'') and all with the cross-compiler built RISC OS libraries, binaries and included files in gccsdk/gcc4/env (known as ''GCCSDK_INSTALL_ENV''). More detailed help can be found in the [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fgcc4%2FREADME&rev=0&sc=0 README file] in the ''gcc4'' directory.
cd $GCCSDK_SRC/gcc
autoconf ; autoheader
./do-configure
make setup
make build-cross
make porting-scripts


It may ask you to install additional tools. The full list is as follows (the first 6 entries are likely not installed with standard distributions):
You now have a complete GCC cross-compiler environment.


* autogen v5.5.4 (or later)
== Using the cross-compiler on its own ==
* m4 v1.4.16 (or later)
* makeinfo : version 4.8 (Debian package is 'texinfo')
* gcc and g++ : v3.4.x or v4.x.y
* bison: version 2.3 (other versions might work too)
* flex : version 2.5.4 (other versions might work too)
* svn (subversion) : version 1.2 or later
* bash
* gperf : version 2.7.2
* sed : version 2.05
* GNU make : version 3.81 (other versions might work too)
* libtool : version 1.5.22 (other versions might work too)
* patch : version 2.5.9 (other versions might work too)
* wget
* help2man


For Ubuntu 14.04, install these packages (for GCC and autobuilder):
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.


<tt>libtool patch wget help2man autogen m4 gcc g++ bison flex subversion gperf sed make build-essential autoconf2.13 automake automake1.9 automake1.11 cvs doxygen dpkg-dev gettext intltool libglib2.0-dev liborbit2-dev libpopt-dev pkg-config policykit-1 realpath rman subversion unzip wget xsltproc texinfo git libx11-dev tcl</tt>
Since [[GCCSDK_Releases#GCCSDK_GCC_3.4.6_Release_3|GCCSDK GCC 3.4.6 Release 3]] and with the aid of [[syslogd|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.


Other non-essential packages that are needed for specific autobuilder packages:
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):


<tt>fontforge dos2unix texi2html libfreetype6-dev libfont-ttf-perl</tt>
cd $GCCSDK_SRC/gcc
autoconf ; autoheader
./do-configure
make setup
make


You will also need CVS installed, in order to fetch the binutils source - build-world does not check for this dependency, so your build will fail later if it is missing. http://sourceware.org/ml/binutils/2011-08/msg00198.html
== Using the cross-compiler and porting-scripts ==


Then run build-world again. For a fast build, run:
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.


$ MAKEFLAGS=-j4 ./build-world
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.


where '4' is the number of CPU cores your computer has. If you're on Linux this can be detected automatically via:
== Using the cross-compiler with Autobuilder ==


$ MAKEFLAGS=-j$(nproc) ./build-world
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.


If you have a problem you may wish to run a serialised build, which is slower but the debugging output is easier to understand. Please do this if you want to report an error to the mailing list (run 'make clean' beforehand if you've previously built):
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 [http://www.riscos.info/unix/downloads.html Unix Porting Project download pages].

$ ./build-world

Depending on your hardware, a build may take an hour or more to complete. If this all went ok, then the cross compiler has been built successfully, and you can proceed to use the Autobuilder. If anything went wrong, or you want to build the RISC OS port of GCC, consult the README file for more detailed instructions.

== Using the cross-compiler ==

The '''autobuilder''' is a way to fetch and cross-compile software from other platforms automatically.
If you want to use the tools to develop new software, or to port a new program to RISC OS (which you might later put in the autobuilder), first see the [[Cross-compiling software with GCCSDK|Cross-compiling Guide]].

== Using Autobuilder ==


=== Autobuilder requirements ===
=== Autobuilder requirements ===


The Autobuilder will have already been checked out in the above instructions and lives in the directory ''gccsdk/autobuilder''. You should not try to build from within that directory. Under the ''gccsdk'' directory, create an additional directory ''build''.
To install the Autobuilder code itself and a large set of projects which can be built using the Autobuilder:


$ cd ../
svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder $GCCSDK_SRC/autobuilder
$ mkdir build


You will then have these directories in the ''gccsdk'' directory:
The Autobuilder contains a number of programs with quite complex build systems, and has some additional requirements itself which need to be present on the build system. They are the following: (these are the names of [http://packages.debian.org/ Debian's packages] for them, other distributions may vary)


* ''autobuilder'' (Autobuilder files)
wget
* ''build'' (Build work directory)
rman
* ''gcc4'' (Cross compiler source)
cvs
realpath
pkg-config
automake
glib-1.2
libpopt-dev
liborbit-dev
doxygen


The Autobuilder contains a number of programs with quite complex build systems, and has some additional requirements itself which need to be present on the build system. They are the following:
The availability of some of these programs is checked by the Autobuilder.


* autoconf2.13
=== Source code ===
* automake
* automake1.7
* cvs
* doxygen
* dpkg-source (Debian 6, dpkg-dev)
* gettext (for xgettext)
* git
* intltool (for intltoolize)
* libglib1.2-dev (not in Debian 6, try libglib2.0-dev)
* liborbit-dev (Debian 6, liborbit2-dev)
* libpopt-dev
* libx11-dev
* pkg-config
* policykit (for polkit-policy-file-validate)
* realpath
* rman
* svn
* unzip
* wget
* xsltproc


These are the names of [http://packages.debian.org/ Debian's packages] for them, other distributions may vary (for example, see the [[Cygwin setup|Cygwin]] page). We strongly recommend that these packages are installed before using Autobuilder, as their absence can lead to wasted time trying to identify the potential resulting problems.
Fetching the source code of the open-source programs can be done via different methods like apt-get, ftp, http, svn, cvs, etc. Because of conveniance reasons we try to do that by preference via Debian's 'apt-get' command and specifying their 'unstable' packages (which despite the name usually means stable and up-to-date upstream releases).


The availability of these programs is checked as needed by the Autobuilder, and they aren't all required for simple builds.
To specify which mirror you can use in your /etc/apt/sources.list file, have a look at [http://www.debian.org/mirror/list Debian worldwide mirror sites] list. For the UK this is probably something like:
deb-src http://ftp.uk.debian.org/debian/ unstable main non-free contrib


=== Source code ===
When you do regular builds using Autobuilder you can make use of [[Accelerating GCCSDK autobuilder using apt-proxy|apt-proxy]] which caches the fetched sources from the Debian mirrors saving on time and bandwidth.

Fetching the source code of the open-source programs are done via different methods like apt-get, ftp, http, svn, cvs, etc. Historically, the Autobuilder relied upon running on Debian and using the local machine's apt list of sources. This can still be done, but the Autobuilder by default will fetch the source lists itself and download from its own copies. This means it can run on any Linux or Unix setup (including Cygwin).

Most sources are pulled from Debian ''stable'', but the Autobuilder might fall back to oldstable for some packages. Other packages may use alternate download methods where the source does not exist in Debian, or we desire a specific version.


=== Simple Autobuilder example ===
=== Simple Autobuilder example ===
Line 102: Line 129:
Now use the Autobuilder to build a package:
Now use the Autobuilder to build a package:


mkdir ~/build
$ cd build
cd ~/build
$ ../autobuilder/build -v wget
$GCCSDK_SRC/autobuilder/build -v wget


This will attempt to build in the ~/build/wget directory (that is, in build/wget in your home directory). If the build is successful this will be deleted and the results placed in $GCCSDK_SRC/autobuilder/autobuilder_packages. This is a Zip file which can be copied to RISC OS to be unpacked and run. If not successful the ~/build/wget directory will remain for you to inspect. The output from the build process is also saved in $GCCSDK_SRC/autobuilder/network/wget as either a file last-success or last-failure depending on what happened.
This will attempt to build the ''wget'' package in your ''build'' directory. For any package, the Autobuilder will first try to build the package's dependencies. In this case, there are a few. For instance, a special RISC OS specific version of 'zip' to run on the cross compiling system which understands RISC OS filetype conventions under Unix in order to usefully package the result. The wget package also relies upon the zlib library (zlib1g) and the OpenSSL library (libssl1.0.2), so these will be built too.


The work is done under a created ''wget'' subdirectory. If the build is successful this will be deleted and the results placed in ''../autobuilder/autobuilder_packages''. This is a zip file which can be copied to RISC OS to be unpacked and run (it's actually a RiscPkg package). If not successful, the wget directory in ''build'' will remain for you to inspect. The output from the build process is also saved in ''../autobuilder/network/wget'' as either a file ''last-success'' or ''last-failure'' depending on what happened.
The cross-build process is controlled by files in the $GCCSDK_SRC/autobuilder/network/wget directory, mostly the 'setvars' file which is executed by $GCCSDK_SRC/autobuilder/build via fetch-program and build-program - look at these three scripts to see what's going on. Sources are fetched automatically from the Debian project's source repository unless otherwise stated, then local patches (if any) are applied before configuring and building.


See the [[Autobuilder development|developing for Autobuilder]] page for complete details.
Porting a new package involves creating a new directory in a suitable place in $GCCSDK_SRC/autobuilder tree and producing a setvars file. You may provide patch files in that directory with names ending in .p will be automatically applied. Look at some of other packages' directories for examples. If you can't find the directory for the package 'foo' you want, try:
find $GCCSDK_SRC/autobuilder -name foo

See Autobuilder documentation gccsdk/autobuilder/AutoBuilder.html ([http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2FAutoBuilder.html&rev=0&sc=0 or see HTML source from WebSVN]) for more detailed instructions.


=== A more complex Autobuilder example ===
=== A more complex Autobuilder example ===


There are many more packages and libraries in the Autobuilder, too many to list here. Many of the programs in the Unix Porting Project are represented here. Many of these contain dependencies, which means they will instruct other packages to be built first before they can be built.
There are many more packages and libraries in the Autobuilder, too many to list here. Most of the programs in the Unix Porting Project are represented here. Many of these contain dependencies, which means they will instruct other packages to be built first before they can be built.


The method for building them is precisely the same. For example:
The method for building them is precisely the same. For example:


$GCCSDK_SRC/autobuilder/build -v firefox
$ ../autobuilder/build -v otterbrowser -D


This will build a version of Mozilla Firefox for RISC OS (see its 'setvars' file to know which version is selected). Note that this has many dependencies and could take some hours depending upon your hardware and network connection.
This will build a version of Otter Browser for RISC OS (see its ''setvars'' file to know which version is selected). Note that this has many dependencies and could take some hours depending upon your hardware and network connection.


If you want to retain the source to a package (e.g. for debugging or development), simply use the -d flag alongside the -v flag.
If you want to retain the source to a package (e.g. for debugging or development), simply use the <code>-D</code> flag alongside the <code>-v</code> flag as in the example here.

=== Using ChoX11 with the Autobuilder ===

Any program in the Autobuilder which has dependencies upon the X libraries will also require [[ChoX11]] and [[DeskLib]] (which ChoX11 uses) to be built. The Autobuilder will instruct the linker to automatically replace library references to the X11 library with ChoX11 and DeskLib.


=== Troubleshooting ===
=== Troubleshooting ===

See also: [[GCCSDK build debugging tips]]


Most problems with using the Autobuilder come from one of three sources:
Most problems with using the Autobuilder come from one of three sources:
* Missing packages on your build Unix system
* Missing packages on your build Unix system
* Out of date installation of GCCSDK/autobuilder
* Out of date installation of GCCSDK/Autobuilder
* Upstream changes
* Upstream changes


If you have an error about missing files when trying to build something, it's most likely that there's something missing from your build Unix system. Try searching your distribution to find out which package these files are installed in: try the 'search within packages' for [http://packages.debian.org/ Debian] if you use those, or a similar facility for your build OS.
If you have an error about missing files when trying to build something, it's most likely that there's something missing from your build Unix system. Try searching your distribution to find out which package these files are installed in: try the 'search within packages' for [http://packages.debian.org/ Debian] if you use those, or a similar facility for your build OS.


If you think you've got all the files (ask the GCCSDK list if you aren't sure), it's worth a try to rename /home/riscos to something else and run through these instructions from scratch: this will grab the latest compilers and libraries.
If you think you've got all the files (ask the GCCSDK list if you aren't sure), it's worth a try to rename ''/home/riscos'' to something else and run through these instructions from scratch: this will ensure the latest compilers and libraries are used.


If neither of those have any luck, there have probably been upstream changes. Ideally it's best to fix the Autobuilder and/or libraries so the newer upstream will build, but otherwise you can look at the 'setvars' file and tweak it so it fetches older sources (from a specific tarball, instead of CVS, for example). Look at a few 'setvars' files to see how this syntax works.
If neither of those have any luck, there have probably been upstream changes. Ideally it's best to fix the Autobuilder and/or libraries so the newer upstream will build, but otherwise you can look at the ''setvars'' file and tweak it so it fetches older sources (from a specific tarball, instead of CVS, for example). Look at a few ''setvars'' files to see how this syntax works.


If you still have trouble, ask the [[GCCSDK]] mailing list. Also if you manage to get anything to build, or spot things which have broken, do inform the list or submit patches.
If you still have trouble, ask on the [[GCCSDK]] mailing list. Also if you manage to get anything to build, or spot things which have broken, do inform the list or submit patches.

=== Using ChoX11 with the Autobuilder ===

Any program in the Autobuilder which has dependencies upon the X libraries will also require [[ChoX11]] and [[DeskLib]] (which ChoX11 uses) to be built. The Autobuilder will instruct the linker to automatically replace library references to the X11 library with ChoX11 and DeskLib.


== Help wanted ==
== Help wanted ==


We want to come to a situation where all the projects defined in the Autobuilder can be built from start to end with a single command and this on all times, and where the resulting packages are uploaded to a single spot at [http://www.riscos.info/ riscos.info]. We strongly believe that once this state is reached, only a minimal of effort is needed to keep those projects from then on buildable and up-to-date and that bug fixes in libraries immediately benefit all projects using these libraries.
Ideally, all projects in the Autobuilder can be built with a single command. In practice at any one time there are a few packages which need attention. However, in this state, it is generally minimal effort to update a package to the latest version.


In order to achieve this, we need help in the follow areas:
What are we currently missing for this ?


* Simply testing of builds. In most cases, the developers can fix issues quickly.
* We are in a desparate need of some volunteers to make use of the Autobuilder in order to keep all the projects already defined in Autobuilder up-to-date.
* Complete packaging. Many packages are now uploaded in a [[RiscPkg]] format, but this work is still on going.
* Building a large set of Autobuiler projects requires sometimes that a certain project build order is respected. Currently this is done via the 'depends' file. However this is a quite error-prone method and certainly not bulletproof. Usually this 'depends' file gets updated because someone runs into a dependancy problem and fixes that. A possible replacement would be to derive the dependancy from the Debian APT database. More thought is needed on this but for sure it could be improved. It's a nice project on its own. Such a thing is vital if we want to build all Autobuilder projects from start to end.<br>Such an improvement would have a major advantage if it would easily allow parallel builds as these days most host hardware have more than one cpu or core and it would be a shame not being able to use them all.
* Bringing up to date [http://www.riscos.info/pipermail/gcc/2009-November/004972.html abandoned RISC OS ports] from other developers, and added them to the Autobuilder.
* Currently the built packages are not yet uploaded somewhere. Alan Buckley made a very nice start to automatically create [http://www.riscos.info/packages/ a webpage pointing to those built packages] but we're not there yet. His latest report can found [http://www.riscos.info/pipermail/gcc/2007-March/003762.html here].
* Currently packages are zip files. Ideally we want to package them using [http://www.riscpkg.org/ The RISC OS Packaging Project] so that users can easily install them and keep their versions up-to-date (that's why we want to have all Autobuilder projects buildable at all times).
* For most projects inside the Autobuilder it should not matter if you build them using the GCCSDK 3.4.6 cross-compiler or with the [[GCCSDK Development|experimental GCCSDK 4 cross-compiler]] which is currently in development. For those projects were it matters, it would be nice to have them buildable for both cross-compilers for at least the transition period until we have a first stable GCCSDK 4 release.
* Of course we can always use more projects defined in Autobuilder. The cross-compile build infrastructure is there, it simply waits for you to port your favourate program to RISC OS. Certainly not wishing to limit your ideas but these are particular interesting because they are a missing technologies or libraries or simply too nice not to try them out:
** It would be great to have a port of Mesa and particular [http://www.simonrules.com/iyonixmesa/ IyonixMesa] in Autobuilder as it would all kind of OpenGL based programs to be ported.
** It would be great to have a port of Mesa and particular [http://www.simonrules.com/iyonixmesa/ IyonixMesa] in Autobuilder as it would all kind of OpenGL based programs to be ported.
** Flash support: either [http://www.gnu.org/software/gnash/ Gnash] (talk to John-Mark Bell as he already did some work), either [http://swfdec.freedesktop.org/wiki/ Swfdec].
** Flash support: either [http://www.gnu.org/software/gnash/ Gnash] (talk to John-Mark Bell as he already did some work), either [http://swfdec.freedesktop.org/wiki/ Swfdec].
Line 163: Line 185:
** [http://sourceforge.net/projects/pidgin/ Pidgin] : previously known as GAIM is a GTK+ instant messaging application. It supports multiple protocols, including AIM, ICQ, Yahoo!, MSN, Jabber, IRC, Napster, Gadu-Gadu, Zephyr, and SILC.
** [http://sourceforge.net/projects/pidgin/ Pidgin] : previously known as GAIM is a GTK+ instant messaging application. It supports multiple protocols, including AIM, ICQ, Yahoo!, MSN, Jabber, IRC, Napster, Gadu-Gadu, Zephyr, and SILC.


Discussions, questions, new ideas or just a statement you're want to help here can be done in [http://www.riscos.info/mailman/listinfo/gcc GCCSDK mailing list].
Discussions, questions, new ideas or just a statement you want to help can be done in the [http://www.riscos.info/cgi-bin/mailman/listinfo/gcc GCCSDK mailing list].


== Links==
== Links==


* An excellent [http://www-src.lip6.fr/homepages/Alexandre.Duret-Lutz/autotools.html tutorial on GNU Autotools] can help you understanding how most packages are configured using the GNU Autotools and built in Autobuilder.
* An excellent [http://www.lrde.epita.fr/~adl/autotools.html tutorial on GNU Autotools] can help you understanding how most packages are configured using the GNU Autotools and built in Autobuilder.
* [http://www.flameeyes.eu/autotools-mythbuster/ Autotools Mythbuster] : Handy set of notes for autoconf, automake, libtool.
* [http://sources.redhat.com/autobook/ The Goat Book] (GNU Autoconf, Automake and Libtool)
* [http://sources.redhat.com/autobook/ The Goat Book] (GNU Autoconf, Automake and Libtool)



Latest revision as of 14:10, 8 November 2021

Using GCCSDK and Autobuilder to cross-compile for RISC OS

Building the cross-compiler

The previous version of these instructions referred to the use of the GCC 3.4.6 cross compiler. Due to ongoing development, using GCC 3.4.6 may no longer work with all Autobuilder packages. The focus is now on the GCC 4.7.x (stable) or GCC 4.1.2 (deprecated) cross compiler with the Autobuilder.

Cross-compiling for RISC OS is done by using GCCSDK on a 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 and Autobuilder infrastructure to the current directory:

In case you want to use the stable cross-compiler (based on gcc 4.7.x):

$ mkdir gccsdk
$ cd gccsdk
$ svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder/ autobuilder
$ svn co svn://svn.riscos.info/gccsdk/trunk/gcc4/ gcc4

In case you want to use old (deprecated) cross-compiler (based on gcc 4.1.2):

$ mkdir gccsdk
$ cd gccsdk
$ svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder/ autobuilder
$ svn co svn://svn.riscos.info/gccsdk/branches/release_4_1_2/ gcc4


Build the cross compiler and follow the prompts:

$ cd gcc4
$ ./build-world

When build-world is run for the first time, it will ask you to confirm the settings in the created file gccsdk-params. Note that its default settings are installing the cross-compiler at gccsdk/gcc4/cross (known as the parent directory of GCCSDK_INSTALL_CROSSBIN) and all with the cross-compiler built RISC OS libraries, binaries and included files in gccsdk/gcc4/env (known as GCCSDK_INSTALL_ENV). More detailed help can be found in the README file in the gcc4 directory.

It may ask you to install additional tools. The full list is as follows (the first 6 entries are likely not installed with standard distributions):

  • autogen v5.5.4 (or later)
  • m4 v1.4.16 (or later)
  • makeinfo : version 4.8 (Debian package is 'texinfo')
  • gcc and g++ : v3.4.x or v4.x.y
  • bison: version 2.3 (other versions might work too)
  • flex : version 2.5.4 (other versions might work too)
  • svn (subversion) : version 1.2 or later
  • bash
  • gperf : version 2.7.2
  • sed : version 2.05
  • GNU make : version 3.81 (other versions might work too)
  • libtool : version 1.5.22 (other versions might work too)
  • patch : version 2.5.9 (other versions might work too)
  • wget
  • help2man

For Ubuntu 14.04, install these packages (for GCC and autobuilder):

libtool patch wget help2man autogen m4 gcc g++ bison flex subversion gperf sed make build-essential autoconf2.13 automake automake1.9 automake1.11 cvs doxygen dpkg-dev gettext intltool libglib2.0-dev liborbit2-dev libpopt-dev pkg-config policykit-1 realpath rman subversion unzip wget xsltproc texinfo git libx11-dev tcl

Other non-essential packages that are needed for specific autobuilder packages:

fontforge dos2unix texi2html libfreetype6-dev libfont-ttf-perl

You will also need CVS installed, in order to fetch the binutils source - build-world does not check for this dependency, so your build will fail later if it is missing. http://sourceware.org/ml/binutils/2011-08/msg00198.html

Then run build-world again. For a fast build, run:

$ MAKEFLAGS=-j4 ./build-world

where '4' is the number of CPU cores your computer has. If you're on Linux this can be detected automatically via:

$ MAKEFLAGS=-j$(nproc) ./build-world

If you have a problem you may wish to run a serialised build, which is slower but the debugging output is easier to understand. Please do this if you want to report an error to the mailing list (run 'make clean' beforehand if you've previously built):

$ ./build-world

Depending on your hardware, a build may take an hour or more to complete. If this all went ok, then the cross compiler has been built successfully, and you can proceed to use the Autobuilder. If anything went wrong, or you want to build the RISC OS port of GCC, consult the README file for more detailed instructions.

Using the cross-compiler

The autobuilder is a way to fetch and cross-compile software from other platforms automatically. If you want to use the tools to develop new software, or to port a new program to RISC OS (which you might later put in the autobuilder), first see the Cross-compiling Guide.

Using Autobuilder

Autobuilder requirements

The Autobuilder will have already been checked out in the above instructions and lives in the directory gccsdk/autobuilder. You should not try to build from within that directory. Under the gccsdk directory, create an additional directory build.

$ cd ../
$ mkdir build

You will then have these directories in the gccsdk directory:

  • autobuilder (Autobuilder files)
  • build (Build work directory)
  • gcc4 (Cross compiler source)

The Autobuilder contains a number of programs with quite complex build systems, and has some additional requirements itself which need to be present on the build system. They are the following:

  • autoconf2.13
  • automake
  • automake1.7
  • cvs
  • doxygen
  • dpkg-source (Debian 6, dpkg-dev)
  • gettext (for xgettext)
  • git
  • intltool (for intltoolize)
  • libglib1.2-dev (not in Debian 6, try libglib2.0-dev)
  • liborbit-dev (Debian 6, liborbit2-dev)
  • libpopt-dev
  • libx11-dev
  • pkg-config
  • policykit (for polkit-policy-file-validate)
  • realpath
  • rman
  • svn
  • unzip
  • wget
  • xsltproc

These are the names of Debian's packages for them, other distributions may vary (for example, see the Cygwin page). We strongly recommend that these packages are installed before using Autobuilder, as their absence can lead to wasted time trying to identify the potential resulting problems.

The availability of these programs is checked as needed by the Autobuilder, and they aren't all required for simple builds.

Source code

Fetching the source code of the open-source programs are done via different methods like apt-get, ftp, http, svn, cvs, etc. Historically, the Autobuilder relied upon running on Debian and using the local machine's apt list of sources. This can still be done, but the Autobuilder by default will fetch the source lists itself and download from its own copies. This means it can run on any Linux or Unix setup (including Cygwin).

Most sources are pulled from Debian stable, but the Autobuilder might fall back to oldstable for some packages. Other packages may use alternate download methods where the source does not exist in Debian, or we desire a specific version.

Simple Autobuilder example

Now use the Autobuilder to build a package:

$ cd build
$ ../autobuilder/build -v wget

This will attempt to build the wget package in your build directory. For any package, the Autobuilder will first try to build the package's dependencies. In this case, there are a few. For instance, a special RISC OS specific version of 'zip' to run on the cross compiling system which understands RISC OS filetype conventions under Unix in order to usefully package the result. The wget package also relies upon the zlib library (zlib1g) and the OpenSSL library (libssl1.0.2), so these will be built too.

The work is done under a created wget subdirectory. If the build is successful this will be deleted and the results placed in ../autobuilder/autobuilder_packages. This is a zip file which can be copied to RISC OS to be unpacked and run (it's actually a RiscPkg package). If not successful, the wget directory in build will remain for you to inspect. The output from the build process is also saved in ../autobuilder/network/wget as either a file last-success or last-failure depending on what happened.

See the developing for Autobuilder page for complete details.

A more complex Autobuilder example

There are many more packages and libraries in the Autobuilder, too many to list here. Most of the programs in the Unix Porting Project are represented here. Many of these contain dependencies, which means they will instruct other packages to be built first before they can be built.

The method for building them is precisely the same. For example:

$ ../autobuilder/build -v otterbrowser -D

This will build a version of Otter Browser for RISC OS (see its setvars file to know which version is selected). Note that this has many dependencies and could take some hours depending upon your hardware and network connection.

If you want to retain the source to a package (e.g. for debugging or development), simply use the -D flag alongside the -v flag as in the example here.

Using ChoX11 with the Autobuilder

Any program in the Autobuilder which has dependencies upon the X libraries will also require ChoX11 and DeskLib (which ChoX11 uses) to be built. The Autobuilder will instruct the linker to automatically replace library references to the X11 library with ChoX11 and DeskLib.

Troubleshooting

See also: GCCSDK build debugging tips

Most problems with using the Autobuilder come from one of three sources:

  • Missing packages on your build Unix system
  • Out of date installation of GCCSDK/Autobuilder
  • Upstream changes

If you have an error about missing files when trying to build something, it's most likely that there's something missing from your build Unix system. Try searching your distribution to find out which package these files are installed in: try the 'search within packages' for Debian if you use those, or a similar facility for your build OS.

If you think you've got all the files (ask the GCCSDK list if you aren't sure), it's worth a try to rename /home/riscos to something else and run through these instructions from scratch: this will ensure the latest compilers and libraries are used.

If neither of those have any luck, there have probably been upstream changes. Ideally it's best to fix the Autobuilder and/or libraries so the newer upstream will build, but otherwise you can look at the setvars file and tweak it so it fetches older sources (from a specific tarball, instead of CVS, for example). Look at a few setvars files to see how this syntax works.

If you still have trouble, ask on the GCCSDK mailing list. Also if you manage to get anything to build, or spot things which have broken, do inform the list or submit patches.

Help wanted

Ideally, all projects in the Autobuilder can be built with a single command. In practice at any one time there are a few packages which need attention. However, in this state, it is generally minimal effort to update a package to the latest version.

In order to achieve this, we need help in the follow areas:

  • Simply testing of builds. In most cases, the developers can fix issues quickly.
  • Complete packaging. Many packages are now uploaded in a RiscPkg format, but this work is still on going.
  • Bringing up to date abandoned RISC OS ports from other developers, and added them to the Autobuilder.
    • It would be great to have a port of Mesa and particular IyonixMesa in Autobuilder as it would all kind of OpenGL based programs to be ported.
    • Flash support: either Gnash (talk to John-Mark Bell as he already did some work), either Swfdec.
    • Gnumeric : well known open-source spreadsheet.
    • Pidgin : previously known as GAIM is a GTK+ instant messaging application. It supports multiple protocols, including AIM, ICQ, Yahoo!, MSN, Jabber, IRC, Napster, Gadu-Gadu, Zephyr, and SILC.

Discussions, questions, new ideas or just a statement you want to help can be done in the GCCSDK mailing list.

Links

GCC and GCCSDK pages
GCC under RISC OS

GCC for RISC OS, GCC tutorial, GCC common switches, GCC for beginners, UnixLib, ELFLoader
GCCSDK and Unix porting
GCCSDK, GCCSDK Releases, GCCSDK Development, Using GCCSDK, Autobuilder Development and Packaging Cygwin setup, Accelerating autobuilder with apt-proxy, ChoX11, Developer help wanted