Re: ct-lib unit tests link statically

"ZIGLIO, Frediano, VF-IT" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
>
> 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

_______________________________________________
FreeTDS mailing list
[email protected]
http://lists.ibiblio.org/mailman/listinfo/freetds
smime.p7s (application/x-pkcs7-signature, 3.1 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.