[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: LD_LIBRARY_PATH for make test



Michael Ströder writes:
> So this works great for you. But this won't work for others. And I'd
> really like to know what's wrong with my suggestion to generally set
> LD_LIBRARY_PATH in tests/scripts/defines.sh like this:

Does that help?  man ld.so on RHEL 5.3 says $LD_LIBRARY_PATH is used
_after_ an Elf binary's DT_RPATH attribute, unless the DT_RUNPATH
attribute is also set.  ld does not set DT_RUNPATH by default.

So when I edit servers/slapd/slapd and put
      echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" >&2
      ldd "$progdir/$program" >&2
before
      exec "$progdir/$program" ${1+"$@"}

it still shows that the installed libraries are used.

It works if I include "-Wl,--enable-new-dtags" in ./configure LDFLAGS.
This sets the DT_RUNPATH attribute, and I don't know what else.  The
ld(1) manpage says

    --enable-new-dtags
    --disable-new-dtags
        This linker can create the new dynamic tags in ELF.  But the
        older ELF systems may not understand them.  If you specify
        --enable-new-dtags, the dynamic tags will be created as needed.
        If you specify --disable-new-dtags, no new dynamic tags will be
        created.  By default, the new dynamic tags are not created.
        Note that those options are only available for ELF systems.

> LD_LIBRARY_PATH=$TESTWD/../libraries/liblber/.libs:$TESTWD/../libraries/libldap/.libs:$TESTWD/../libraries/libldap_r/.libs:${LD_LI
> BRARY_PATH} export LD_LIBRARY_PATH

Only append the ":" if LD_LIBRARY_PATH is already set, otherwise I
suppose you in practice include "." the path.  Also, include slapi:

LD_LIBRARY_PATH=$TESTWD/../libraries/liblber/.libs:$TESTWD/../libraries/libldap/.libs:$TESTWD/../libraries/libldap_r/.libs:$TESTWD/../servers/slapd/slapi/.libs${LD_LIBRARY_PATH+':'}${LD_LIBRARY_PATH} export LD_LIBRARY_PATH

-- 
Hallvard