GCC for RISC OS: Difference between revisions
m (Wiki link CryptRandom) |
m (aemulor site is longtime gone, relink ProfileMod to adrianl's drobe pages) |
||
Line 94: | Line 94: | ||
* [http://www.reallysmall.co.uk/Pages/normal/software/development/sourcery/sourcery.html 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. |
* [http://www.reallysmall.co.uk/Pages/normal/software/development/sourcery/sourcery.html 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. |
||
* [http:// |
* [http://adrianl.drobe.co.uk/udp.html ProfileMod] : ProfileMod can be used to profile your code at expense of having to recompile it with the GCC option -finstrument-functions. |
||
* [http://www.riscos.info/websvn/listing.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Fdevelop%2Fdmalloc%2F&rev=0&sc=0 dmalloc port] : [http://dmalloc.com/ 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 [[Using_GCCSDK#GCCSDK_Autobuilder_Usage|GCCSDK Autobuilder]] in the develop/dmalloc subdirectory. |
* [http://www.riscos.info/websvn/listing.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Fdevelop%2Fdmalloc%2F&rev=0&sc=0 dmalloc port] : [http://dmalloc.com/ 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 [[Using_GCCSDK#GCCSDK_Autobuilder_Usage|GCCSDK Autobuilder]] in the develop/dmalloc subdirectory. |
||
Revision as of 19:09, 10 July 2013
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 RiscPkg 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
- http://www.riscos.info/packages/DevelopmentDetails.html#gcc4 - base GCC with C support
This is dependent on (handled by RiscPkg):
- http://www.riscos.info/packages/SupportDetails.html#SharedUnixLibrary - SharedUnixLib
You will also need the SharedUnixLib module if you do not already have it. This provides essential runtime servicea to UnixLib, and is not to be confused with Shared Library functionality. - http://www.riscos.info/packages/LibraryDetails.html#sharedlibs - SharedLibs application
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs-c - SharedLibs C support
Additional languages and tools
It is also recommended you download the 'make' utility either via RiscPkg 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.
For ELF runtime and shared library support, you will need the SharedLibs packages:
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs - SharedLibs application
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs-c - SharedLibs C support
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs-c++ - SharedLibs C++ support
Sources
If you're interested in the sources (an alternative is to do download them from our SVN server):
- Source GCC including the GCCSDK changes
- Source GCCSDK tools (elf2aif, mkresfs, somanager, ...)
- Source cmunge including the GCCSDK changes
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.
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 :
- SharedUnixLibrary module (mandatory) : http://www.riscos.info/packages/SupportDetails.html#SharedUnixLibrary
- Digital Renderer module (only needed when your code is using the OSS sound interface via the /dev/dsp device) : http://www.riscos.info/packages/SupportDetails.html#drenderer
- Iconv module (only needed when your code is using iconv routines) : http://www.netsurf-browser.org/projects/iconv/
- CryptRandom module (only needed when random data is read via /dev/(u)random device) : http://www.markettos.org.uk/
- (Deprecated) !UnixHome application (typically required by some ported Unix programs wishing to store configuration files and settings in the Unix user's home directory) : !UnixHome. The !UnixHome application should be 'seen' by the RISC OS Filer before they can make use of it. Most applications will instead fall back to using standard RISC OS Choices paths in the absence of !UnixHome, and this is generally more desirable.
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.
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:
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs - SharedLibs application
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs-c - SharedLibs C support
The C++ shared libraries are available as an extra package:
- http://www.riscos.info/packages/LibraryDetails.html#sharedlibs-c++ - SharedLibs C++ support
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 |