This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Add --print-dirs option for ldconfig


On Fri, Dec 19, 2008 at 9:47 AM, Ulrich Drepper <drepper@redhat.com> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Dan Nicholson wrote:
>> Build tools often want to determine whether a directory is part of the
>> system linker path or not when deciding to set an RPATH during linking.
>> For glibc based systems, this involves guessing the trusted directories
>> by platform and then parsing out ld.so.conf.
>
> It makes no sense to base decisions like RPATHs for linking based on
> this information since it's dynamic.  Thet /etc/ld.so.conf file can
> change and files can be transported to machines with different settings.

I agree that taking the information statically at build time can cause
problems, but how else can you use RPATH effectively? Libtool is
already guessing this information (and not handling multiarch), which
affects a lot of packages. They even have some nasty code to handle
include statements in ld.so.conf:

# Append ld.so.conf contents to the search path
if test -f /etc/ld.so.conf; then
    lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s
2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0;
}' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[   ]*hwcap[
]/d;s/[:,      ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
    sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi

Wouldn't it be better to just have glibc tell it where it's going to
look? Even if you take the extra directories in ld.so.conf out of the
question, you still have to do ugly platform matching to guess the
trusted directories:

http://cvs.fedoraproject.org/viewvc/rpms/libtool/F-10/libtool-1.5.24-multilib.patch?view=markup

I even think it's a nice little debugging tool for answering the
question: "Is the linker looking where I think it is?"

--
Dan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]