libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Customizing soname


From: Roumen Petrov
Subject: Re: Customizing soname
Date: Fri, 28 Mar 2008 20:53:39 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.12) Gecko/20080212 SeaMonkey/1.1.8

Alon Bar-Lev wrote:
On 3/28/08, Peter O'Gorman <address@hidden> wrote:
-rpath is required for proper execution in many environments, the
 ability to change the soname is, as far as I can tell, not.

 Please present a more convincing argument.

Hello Peter,

I think that infrastructures such as libtool should allow customization
of any attribute that affect the output. Of course there should be defaults
but it should allow overriding to allow customization. This especially true
when the customization is simple to implement and to maintain.

Your example of not using automake simplified rules in order to
workaround the lack of ability to customize the soname attribute
is correct. But it is a workaround that makes build system much
more complex, just because customization is missing.

What you recommend is instead the following automake rules:
lib_LTLIBRARIES=module1.la
module1_la_SOURCES=m1.c m2.c m3.c m4.c
module1_la_LDFLAGS=-module -avoid-version -soname "@MYNAME@"

install-exec-local: install-libLTLIBRARIES
        mv -f "$(DESTDIR)$(libdir)/module1.so" "$(DESTDIR)$(libdir)/@MYNAME@"


Write the following make rules:

LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
        --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
        $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)

my_objects=m1.lo m2.lo m3.lo m4.lo
@MYNAME@: $(my_objects)
        $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
                $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
                -module -avoid-version $(LDFLAGS) -o $@ \
                -rpath $(libdir) $(my_objects) $(LIBS)

lib_LTLIBRARIES=#create
install-exec-hook: install-libLTLIBRARIES @MYNAME@
        $(LIBTOOL) --mode=install $(INSTALL) "@MYNAME@" \
                $(DESTDIR)$(libdir)

all-local:      @MYNAME@

.c.lo:
if am__fastdepCC
        $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
        mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
else
if AMDEP
        source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
        DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif
        $(LTCOMPILE) -c -o $@ $<
endif


But you request is not what I expect from soname:

$echo "void foo(void) {}" > module.c
$ gcc -shared -o module.so -Wl,-soname=test.so module.c
$ objdump -x module.so  | grep SONAME
 SONAME      test.so
$ /sbin/ldconfig -v -l module.so
        test.so -> module.so

You request is to change library name. So I could not understand what is related to SONAME. It came as a surprise to me to allow user(verdor) to change library name at configure time.


Roumen




reply via email to

[Prev in Thread] Current Thread [Next in Thread]