Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Dec 2012 13:08:29 -0800
From:      Kevin Oberman <kob6558@gmail.com>
To:        ajtiM <lumiwa@gmail.com>
Cc:        freebsd-ports@freebsd.org
Subject:   Re: dependencies
Message-ID:  <CAN6yY1tye-o%2BoWYvxx12B0nazLti-gV=BokY4fvHA7y2Gvi6Vw@mail.gmail.com>
In-Reply-To: <201212241104.59921.lumiwa@gmail.com>
References:  <201212241104.59921.lumiwa@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 24, 2012 at 9:04 AM, ajtiM <lumiwa@gmail.com> wrote:
> Hi!
>
> I update pcre, icu...on FreeBSD 9.1 RC-3 with success, I ran as I read in
> /usr/ports/UPDATING: portmaster -o net/openldap24-sasl-client openldap24-
> client looks like successful too but if I run
> portmaster --check-depends than I got some ports (inkscape, gimp and some
> more) which missed openldap24-client.
> But if I run pkg_libchk -o everything is okay.
> I rebuilt gvfs and py-gimp but after portmaster --check-depends those two
> ports still missed openldap24-client. I am using GIMP a lot and I don't have
> any problems...
>
> I use new pkng and I have in /etc/make.conf WITH_PKGNG=yes. Almost everything
> is built with clang.

We often are misusing the term "dependency". here, or at least
over-loading it.. A dependency, in the ports sense, is when some other
port is required to build or run another.  One common dependency is on
sharable libraries (.so), but they are only a portion of what show up
as dependencies.

To work, sharables need a fixed Application Binary Interface (ABI) so
that the routines in the library can be called from another program.
That is, the entry points in the .so file must not change or the
calling program is likely to crash or behave in an undefined manner.
All of this is mapped into the executable at link time with the
current version of the .so. Since the mapping is created when the
executable is linked, the library should change in a manner that does
not change any entry points or passed variables, changes can be made
to the library without the already built executable being impacted.
This happens fairly often and is of little note.

Sometimes an update changes the API, often by things like changing
arguments used or completely replacing routines. If the old API is
maintained, the calling program needs no changes, but it must be
re-linked so that al of the references are updated to match the new
ones in the ABI. This is normally done by incrementing the version of
the .so. Since this version is passed to the calling program at link
time, the code that "connects" the program (rtld) to the .so will only
load the .so if the version is unchanged. If that version cannot be
located by rtld, the program exits with an error.

In practical terms,this means that when an ABI is changed, every
program that is directly linked to this .so must be re-linked. This
almost always means that it must be re-built as we normally don't
retain all of the .o files to allow re-linking. If the old .so is
retained, programs linked to it will still work, but just keeping the
old .so around is not the solution.It is, at best, a band-aid.
\
The problem is that a program my link to two of more libraries that
also link to the same .so. An example would be a multimedia tool that
links to a whole bunch of decoders and codecs. It may link directly to
libpng and indirectly by linking to a .so that is, itslef inked to
libpng.  Or it may link to two .so's that link to libpng. In either
case, the actual executable can only load one, so if some things are
linked to .so.4 and some to .so.5, irtld will fail and exit.

So retaining old sharables is not a solution, but can make life a bit
easier. It is still important to try to re-build all ports that link
to the library that has had its version changed as soon as possible.

pkg_libchk "walks" through the packing list of each port and then uses
objdump to get a list of sharables used by that file and checks that
all are in the LD_LIBRARY_PATH, deliberately ignoring the files in
/usr/local/lib/compat, to provide a list of files or ports with
missing .so files.These are all dependencies of the port, but they are
only a sub-set of all dependencies or that port. But these
dependencies are all that need to be rebuilt to restore normal
operation. this is often a much smaller number of ports than the list
of ports that depend on the library.

Many details are missing from this discussion and I probably made an
error or two. The man pages for ldconfig, pkg_libchk, rtld, and others
go into more detail on how the loading of sharables works. It is a
part of an article on this that I hope to post to the FreeBSD wiki in
a few days if other things don't get in the way,

I know what "portmaster --check-depends" does in the case of the old
pkg database, but things would be done a bit differently for pkgng, so
I really can't explain exactly what you are seeing there. Brian might
be able to explain that.
-- 
R. Kevin Oberman, Network Engineer
E-mail: kob6558@gmail.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAN6yY1tye-o%2BoWYvxx12B0nazLti-gV=BokY4fvHA7y2Gvi6Vw>