[freetds] ct-lib unit tests link statically

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Thu Jul 10 03:20:16 EDT 2008


>
> Johnny C. Lam wrote:
> > > When I configure, I set LDPATH:
>                             ^^^^^^ I meant LDFLAGS
> > >
> > > LD_search='-L/usr/local/lib -L/usr/pkg/lib'
> > > LD_rpath='-Wl,--rpath -Wl,/usr/local/lib:/usr/pkg/lib'
> > > export LDFLAGS="${LD_search} ${LD_rpath}"
> > >
> > > And that rpath precedes the "local" one in the unit test binaries.
> > >
> > > $ ldd datafmt
> > > datafmt:
> > >          -lpthread.0 => /usr/lib/libpthread.so.0
> > >          -lct.4 => /usr/local/lib/libct.so.4
> > >          -lc.12 => /usr/lib/libc.so.12
> > >
> > > $ readelf -d datafmt | grep -i rpath
> > >  0x0000000f (RPATH)                      Library rpath:
> > >
> [/usr/local/lib:/usr/pkg/lib:/usr/users/home/jklowden/freetds/build/s
> > > rc/c tlib/.libs]
>
> > Setting LD_LIBRARY_PATH will override any embedded rpath
>
> Huh, so it does!
>
> OT: Now I *really* don't know why NetBSD doesn't ship by
> default with a
> ld.so.conf that includes /usr/local/lib and /usr/pkg/lib.  I had been
> given to understand that relying on RPATH was more secure than using
> LD_LIBRARY_PATH but, because the environment variable
> overrides, any user
> can cause any shared object to be used.
>
> I think maybe I should simplify my life by adding usr/local/lib and
> /usr/pkg/lib to /etc/ld.so.conf.
>
> > How are you verifying that the wrong shared libraries are
> being used?
>
> See above.  datafmt is a ct-lib unit test.  readelf(1) shows
> the embedded
> RPATH.  The first part -- /usr/local/lib:/usr/pkg/lib -- 
> comes directly
> from LDFLAGS.  ldd(1) shows datafmt is dynmically linked to
> /usr/local/lib/libct.so.4.
>

I personally use LD_RUN_PATH environment to do the job and it works for me. LD_RUN_PATH 
instructs ld/libtool to add some RPATHs.

freddy77
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3129 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080710/1987c8e6/attachment.bin 


More information about the FreeTDS mailing list