[gccsdk] Creating shared libraries

Lee Noar leenoar at sky.com
Sat Nov 29 09:46:24 PST 2008

alan buckley wrote:
> I don't seem to be able to create shared libraries
> on RISC OS.
> I found a simple example on the web and tried the
> following to build it in an Obey file:
> gcc -fPIC -Wall -g -c libhello.c
> gcc -shared -Wl,-soname,libhello.so.0 -olibhello/so/0/0 libhello.o
> The Result I got was:
> /ADFS::HardDisc4.$/Apps/Development/!GCC/bin/ld: cannot open output file libhello/so/0/0: Can't open 'libhello.so.0.0'
> collect2: ld returned 1 exit status
> I also tried -olibhello.so.0.0 and that also did not work.
> Can anyone suggest what I might be doing wrong?

You're not doing anything wrong, as such, it's just unfortunate that 
riscosify() doesn't handle library filenames very well, perhaps because 
it has what might be seen as multiple suffixes. The easiest way around 
it is to use:

  -o /libhello.so.0.0

The leading backslash forces riscosify() to assume a unix filename.


More information about the gcc mailing list