Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-08

set SONAME in LINUX shared libraries

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Werner Bochtler

Hi,

Can anyone give me a hint how to set the 'soname'in FPC shared libraries for LINUX?

I have tried to pass "-soname libTest.so.0" via the k-switch to the linker but this doesn't seem to work.

The ppas.sh file (see excerpt below) shows that the passed option "-soname libTest.so.0" is overwritten by an automatic generated "-soname libTest.so".

---
/usr/bin/ld -b elf32-i386 -m elf_i386 -soname=libTest.so.0 -init FPC_LIB_START -fini FPC_LIB_EXIT -soname libTest.so -shared -L. -o ../bin/libTest.so ../bin/link.res
----

Many thanks in advance,

Werner

Reply by email

Marco van de Voort
to Werner Bochtler

In our previous episode, Werner Bochtler said:

Can anyone give me a hint how to set the 'soname'in FPC shared libraries for LINUX?

If -o doesn't work, nothing will.

I have tried to pass "-soname libTest.so.0" via the k-switch to the linker but this doesn't seem to work.

-k is a stopgap. The compiler doesn't parse this for possible conflicting switches.

Reply by email

Werner Bochtler
to Marco van de Voort
> Can anyone give me a hint how to set the 'soname'in FPC shared libraries > for LINUX? If -o doesn't work, nothing will.

-o does work but it changes the output name *and* the soname.

My intention is to generate e.g. a library libTest.so.0.1.0 with soname libTest.so.0.

Using -o libTest.so.0 and renaming the generated library to libTest.so.0.1.0 is a possible workaround but it is not very straightforward.

BTW: According to the description of -o (see fpc -h) it should set the name of the generated binary only. Is it really a good idea to set the soname as well? As far as I can remember in earlier revisions of FPC the -o switch has not influenced the soname. The soname was always constant <somename.so.0>.

A possible solution would be to support the Kylix directive {$SONAME}. (-> fpc bugtracker: 0008128)

Best regards,
Werner

Reply by email