Using GCCSDK: Difference between revisions
(Removed the 'this is a quick outline, hope to expand soon' line - it's grown a lot since that was added!) |
(Add template) |
||
Line 105: | Line 105: | ||
* [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) |
||
* [[Accelerating GCCSDK autobuilder using apt-proxy]] - how to speed fetching of sources when developing autobuilder scripts |
* [[Accelerating GCCSDK autobuilder using apt-proxy]] - how to speed fetching of sources when developing autobuilder scripts |
||
{{GCC and GCCSDK pages}} |
Revision as of 12:15, 29 March 2007
Using GCCSDK to cross-compile for RISC OS
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):
mkdir gccsdk svn co svn://svn.riscos.info/gccsdk/branches/release_3_4_6/gcc gccsdk/gcc svn co svn://svn.riscos.info/gccsdk/trunk/autobuilder gccsdk/autobuilder
Detailed 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). First we set the GCCSDK_SRC variable so this tutorial can refer to the position of the sources.
bash export GCCSDK_SRC=$PWD/gccsdk
Then we build GCCSDK (this may take many minutes, depending on the speed of your computer):
cd gccsdk/gcc autoconf ; autoheader ./do-configure make setup make build-cross make porting-scripts
You now have a complete GCC cross compiler environment. If you wanted to go on and build GCC for RISC OS also, you can just type 'make' at this point.
GCCSDK Autobuilder Usage
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 Debian's packages for them, other distributions may vary)
wget rman cvs realpath pkg-config automake glib-1.2 libpopt-dev liborbit-dev
Now use the autobuilder to build a package:
mkdir ~/build cd ~/build $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.
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.
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 (or see HTML source from WebSVN) for more detailed instructions.
Other Package, Dependencies and Usages
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.
The method for building them is precisely the same. For example:
$GCCSDK_SRC/autobuilder/build -v firefox
This will build the version of Mozilla Firefox for RISC OS. This version is approximately equivalent to the Beta 4 version. 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.
Troubleshooting
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 or Ubuntu 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 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.
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.
Links
- GCCSDK/GCC home
- An excellent tutorial on GNU Autotools can help you understanding how most packages are configured and built in Autobuilder.
- The Goat Book (GNU Autoconf, Automake and Libtool)
- Accelerating GCCSDK autobuilder using apt-proxy - how to speed fetching of sources when developing autobuilder scripts
GCC and GCCSDK pages |
GCC under RISC OS GCC for RISC OS, GCC tutorial, GCC common switches, GCC for beginners, UnixLib, ELFLoader |