GCC for RISC OS

From RISC OS

Jump to: navigation, search

Contents

Using GCC under RISC OS

Prerequisites

An APCS-32 supporting Shared C Library (version 5.17 or later) is required to run GCC. This means that only pre-RISC OS 4.39 (Select 3i4) users need an update of their Shared C Library which they can get from Castle, see below. All later versions of RISC OS have this prerequisite fulfilled.

Download

GCC is very easy to setup on RISC OS. It is available via PackMan as a package from riscos.info and this will automatically take care of all dependencies on other packages. It can also be downloaded directly and unpacked manually but here you need to take care of loading and unpacking all necessary dependencies yourself.

Base Install

This is dependent on (handled by PackMan):

Additional languages and tools

It is also recommended you download the 'make' utility either via PackMan or directly:

C++ support is in the gcc4-c++ package:

Additional tools such as flex, bison, etc which were previously bundled with the GCC compiler are available in separate packages.

Shared Library Support

For ELF runtime and shared library support, you will need the SharedLibs packages:

Sources

If you're interested in the sources (an alternative is to do download them from our SVN server):

RISC OS GCC Tutorials and information

In addition, the !GCC application itself contains a number of examples (inside !GCC.Examples).

Distributing GCC compiled programs

GCC can compile programs using either the SharedCLibrary or UnixLib as runtime libraries. In case UnixLib runtime library is used as shared library, additional requirements are needed to run the distributed program.

SharedCLibrary

When you distribute a GCC compiled program and are using the SharedCLibrary as runtime library (i.e. using option -mlibscl), then no additional support files generally need to be made available with your program.

GCC does produce code which requires an APCS-32 supporting version of the SharedCLibrary (version 5.17 or later), however, so you should check (in the !Run file) that your user has a suitably up-to-date version installed. See the Castle documentation for details of this and the IYONIX pc download page for recent versions of SharedCLibrary suitable for RISC OS versions prior to RISC OS 4.39 (Select 3i4).

Note that all new RISC OS platforms ship with a sufficiently up-to-date version of the module present already.

UnixLib

When you are using UnixLib as runtime library (and that's the default runtime library), then an up-to-date version of some UnixLib support modules need to be used together with your program. The following is an overview of these support modules :

The modules SharedUnixLibrary, Digital Renderer, Iconv and CryptRandom will be RMEnsure'd with their minimal needed version number by the UnixLib code at the moment their functionality is needed. Error message will be returned when these modules are not available or are too old, so programmers don't need to RMEnsure those module versions.

When you distribute a copy of these UnixLib support modules with your program, please also mention the URLs in documentation and/or installation notes or program where up-to-date versions can be found.

Shared libraries

When the built program is using shared libraries, a copy of the shared libraries is needed to run the program. Instead of distributing the shared libraries together with your program, we strongly recommend to refer to the following URLs where the latest up-to-date copy of the shared libraries can be found:

The C++ shared libraries are available as an extra package:

Useful programs

The following list contains useful programs helping you to develop with GCC on RISC OS :

  • Sourcery : Sourcery will manage the source code that makes up a project but it will also manage the various resources files that are required to produce a RISC OS application. These include Sprite, Message and Template files.
  • ProfileMod : ProfileMod can be used to profile your code at expense of having to recompile it with the GCC option -finstrument-functions.
  • dmalloc port : dmalloc can be used to find memory leaks or memory corruptions due to wrong malloc()/free()/etc. use. It has been ported to RISC OS and is currently located in GCCSDK Autobuilder in the develop/dmalloc subdirectory.

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

Personal tools