libtool
[Top][All Lists]
Advanced

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

Re: Developing against $HOME/lib libraries and LD_LIBRARY_PATH


From: Paul \"LeoNerd\" Evans
Subject: Re: Developing against $HOME/lib libraries and LD_LIBRARY_PATH
Date: Fri, 1 Dec 2017 22:52:56 +0000

On Fri, 1 Dec 2017 17:11:23 -0500
Nick Bowler <address@hidden> wrote:

> If library A is a libtool library then libtool should do the right
> thing automatically.  All you should need to do is add the libtool
> library to your link command.
> 
> If library A is not a libtool library then libtool won't necessarily
> know how to link it correctly, so it might need some help...

I admit I'm really not entirely sure what the-above means. Both of my
libraries use libtool-based commands internally in their Makefiles to
do their things.

> It's hard to say more without knowing what libtool commands you are
> running and in what way they are not behaving as you expect.

OK, so I'll now attach (and expand sections below) the two Makefiles
concerned.

The lower-level library (termkey) builds a .pc file and installs
that as part of its target:

  install-inc: termkey.h
          install -d $(DESTDIR)$(INCDIR)
          install -m644 termkey.h $(DESTDIR)$(INCDIR)
          install -d $(DESTDIR)$(LIBDIR)/pkgconfig
          LIBDIR=$(LIBDIR) INCDIR=$(INCDIR) sh termkey.pc.sh \
            >$(DESTDIR)$(LIBDIR)/pkgconfig/termkey.pc

The .pc file contains the libs and cflags arguments that others will
link against:

  cat <<EOF
  libdir=$LIBDIR
  includedir=$INCDIR

  Name: termkey
  Description: Abstract terminal key input library
  Version: @VERSION@
  Libs: -L\${libdir} -ltermkey
  Cflags: -I\${includedir}
  EOF

The higher-level library (tickit) then uses pkg-config --cflags and
pkg-config --libs to find this:

  override CFLAGS +=$(shell pkg-config --cflags termkey)
  override LDFLAGS+=$(shell pkg-config --libs   termkey)

At no point in here has an -rpath argument been created.

> All you should need to do is add the libtool library to your link
> command.

I guess in summary I don't really understand what you mean by this
instruction. Is that not what I've done here? If not, what do I need to
change? (either with respect to the above pasted snippets or the
attached files)

-- 
Paul "LeoNerd" Evans

address@hidden      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Attachment: termkey-Makefile
Description: Text Data

Attachment: tickit-Makefile
Description: Text Data

Attachment: termkey.pc.sh
Description: application/shellscript


reply via email to

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