[gccsdk] Using ELF libraries

John Tytgat John.Tytgat at aaug.net
Tue May 27 18:42:20 PDT 2008

I just had a look at the static ELF libraries packaged and published
at http://www.riscos.info/packages.  E.g. for the libpng one the
documentation says:

To include in you C programs.

include "png.h"

and add the include flag

Link with

Actually with the binutils we're using in GCCSDK 4, we better follow the
rules & habits there, i.e.:

1) The library should be named libpng.a (i.e. ".a" extension) and I
   propose not to swap suffixes so to have "libpng/a" on RISC OS disc.
   The .o extension means object file and not a library file and although
   this is supported in GCCSDK 3.4.6 we don't have this support in GCCSDK 4.
2) To link, specify a link search directory and -l to name the library, i.e.

     -LLibPNG: -lpng

And to specify the include directory, you can use:


There is no need for extra '/' slashes.

As a full example, this is supposed work:

  gcc -ILibPNG: -IZLib1g: -o pngtest.o -c pngtest.c
  gcc -o pngtest -LLibPNG: -lpng -LZLib1g: -lz pngtest.o

Could the people doing the library packaging take this info into account
and update the packaging script in 'setvars' & documentation please ?

John Tytgat, in his comfy chair at home                                 BASS
John.Tytgat at aaug.net                             ARM powered, RISC OS driven

More information about the gcc mailing list