On Thu, Mar 13, 2008 at 12:53 AM, Jonathan Woithe
<[EMAIL PROTECTED]> wrote:
> > On Wed, Mar 12, 2008 at 11:12 PM, Jonathan Woithe
>  > <[EMAIL PROTECTED]> wrote:
>  > >  I agree.  What about running ldd on <prefix>/lib/plplot-*/cairo.so?
>  > >  Anything differences in this between the two working directories?
>  > >
>  > >  The drivers are loaded dynamically on demand I think which is why the 
> cairo
>  > >  libraries (for example) aren't explicitly required by the test 
> application.
>  >
>  > This looks like it may be the culprit, though I don't know why.
>  >
>  > from the segfaulting location:
>  > ~/Projects/ocaml/tmp$ ldd 
> ~/Applications/plplot/lib/plplot5.9.0/driversd/cairo.so
>
> >       libplplotd.so.9 => /usr/lib/libplplotd.so.9 (0xb7f16000)
>
> >       libcsirocsa.so.0 => ~/Applications/plplot/lib/libcsirocsa.so.0 
> > (0xb7e6d000)
>  >       libcsironn.so.0 => ~/Applications/plplot/lib/libcsironn.so.0 
> (0xb7e65000)
>  >
>
> > from the build directory (no segfaults):
>  > ~/tmp/BUILD/plplot/plplot-svn/build/drivers$ ldd cairo.so
>
> >       libplplotd.so.9 =>  
> > ~/tmp/BUILD/plplot/plplot-svn/build/src/libplplotd.so.9 (0xb7eda000)
>
> >       libcsirocsa.so.0 => 
> > ~/tmp/BUILD/plplot/plplot-svn/build/lib/csa/libcsirocsa.so.0 (0xb7bd7000)
>  >       libcsironn.so.0 => 
> ~/tmp/BUILD/plplot/plplot-svn/build/lib/nn/libcsironn.so.0 (0xb7bcf000)
>  >
>
> > ~/Applications/plplot/* is my plplot-svn install, while /usr/lib/*
>  > holds the Debian packages.
>
>  How do you normally switch between these two plplot environments?  Do you
>  use LD_LIBRARY_PATH?  If so, was it active for any of the above tests?

LD_LIBRARY_PATH was set in both cases to $HOME/Applications/plplot/lib

>  What command line did you use to compile the test application?

The test was in OCaml, one was in octave.  I don't know if it will
help much, but the compilation command was:

ocamlfind ocamlopt -package plplot -linkpkg -o plot.native plot.ml

I checked the relevant files for the OCaml -> C PLplot interface and
they all point (according to ldd) to the ~/Applications/plplot/lib/
files.

>  I guess I'm curious to know how the compiler knows which of these to use
>  when compiling and linking your test application.  There is also the small
>  matter of how your test application seemingly correctly picks
>  libplplotd.so.9 from ~/Applications/plplot/lib/ in both cases - this puzzles
>  me a bit.

pkg-config is used to find the appropriate compilation flags.  For
compiling the OCaml PLplot interface I use pkg-config, with
PKG_CONFIG_PATH=$HOME/Applications/plplot/lib/pkgconfig:$PKG_CONFIG_PATH.
 A test of pkg-config --libs plplotd gives the expected results,
pointing to the files under ~.

>  In the above, the libplplotd.so.9 is found in the build directory in the
>  second test because the uninstalled cairo.so probably has a hardcoded path
>  to it; this might be done to assist in debugging as it allows one to run
>  things from the build directory without installing.
>
>  The situation in the first test is a concern since the wrong libplplot.so
>  is found.  What's not clear is why, given that the ~/Applications/ version
>  is located by the test application.

This seems to be confirmed by Alan's reply.

>  > Is there a way to make LD_LIBRARY_PATH or similar hold for the dynamically
>  > loaded cairo.so?
>
>  In theory at least LD_LIBRARY_PATH should be consulted when loading cairo.so
>  unless the underlying application is a setuid or setgid binary.  Refer to
>  the dlopen() manpage for details.
>
>  I've just checked the plplot source code.  The call to dlopen() uses a path
>  to the driver which is returned by plGetDrvDir() in plcore.c.  If you are
>  anywhere in the build tree then the directory is forced to refer to the
>  driver's directory in the build tree.  If not, it tries to find the driver
>  in the following places:
>
>   * The directory specified by the PLPLOT_DRV_DIR environment variable
>   * The ultimate install location of the drivers
>
>  This explains how the driver itself is found.  Resolving the driver's
>  dependencies should occur as previously explained.
>
>  I suspect there might be some issue going on between the different versions
>  of plplot on your system.  It would be nice to pinpoint the exact cause.
>
>  Regards
>   jonathan
>

Any suggestions on how to further track this down?  If I have left out
anything that can help please let me know.

If I remove the installed plplot-svn from ~/Applications/plplot/ and
unset PKG_CONFIG_PATH and LD_LIBRARY_PATH, I still get the
segmentation fault building everything against the Debian Sid PLplot
packages.

Hez

-- 
Hezekiah M. Carty
Graduate Research Assistant
University of Maryland
Department of Atmospheric and Oceanic Science

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to