rif wrote:
> I apologize in advance for the length of this post.
> When I link my eight line C program, I have to link with a shared
> library libR.so ("-lR" in the call to gcc). Doing an ldd on libR.so,
> I see that it depends on a number of other libraries:
>
> [EMAIL PROTECTED] rif]$ ldd /usr/local/lib/R/bin/libR.so
> libblas.so.3 => /usr/lib/libblas.so.3 (0x00cf0000)
> libg2c.so.0 => /usr/lib/libg2c.so.0 (0x00c48000)
> libm.so.6 => /lib/tls/libm.so.6 (0x00111000)
> libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00f82000)
> libreadline.so.4 => /usr/lib/libreadline.so.4 (0x00f36000)
> libdl.so.2 => /lib/libdl.so.2 (0x003eb000)
> libncurses.so.5 => /usr/lib/libncurses.so.5 (0x00bc5000)
> libc.so.6 => /lib/tls/libc.so.6 (0x00ded000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x007dc000)
> libgpm.so.1 => /usr/lib/libgpm.so.1 (0x00522000)
A few random remarks:
(1) Have you had a look at /proc/<pid>/maps to see what library has been
loaded from where, especially if everything came from the place you
expected it. (Some public computer pools e.g. tend to develop a strange
attitude towards the use of LD_LIBRARY_PATH, but I wouldn't assume this
should be a problem at MIT.)
(2) I vaguely remember (I.e. I may be talking nonsense here) that for
gambit scheme, one had to build one single small "indirection" library
along the lines of
[EMAIL PROTECTED]:/tmp$ ld -shared -o mylib.so /lib/libc.so.6 /lib/libncurses.so.5
to use foreign code, as there were problems linking multiple shared objects.
Maybe the same technique could also be of use here.
(3) In order to at least get some clue what's going on, there are a
variety of different techniques. One is to set LD_LIBRARY_PATH to get an
own version of some lib loaded that dlopen()s the real thing and provides
debugging wrappers to the functions therein. One may see crconack as a
demonstration of such techniques. If you are lucky, ltrace may help you.
> >From the alien:load-foreign documentation, I see that load-foreign has
> a :libraries keyword: "libraries is a list of simple-strings
> specifying libraries in a format that ld, the Unix linker, expect."
Basically, it seems to me that you can just pass any options to the linker
here, but this is behaviour one should not rely on.
> Question: Can I just load the library I want to call, or do I need to
> climb up the tree of dependencies, calling load-foreign on each one
> independently?
For my Lisp-Gtk-libgtkglarea-OpenGL monster library, I do
(load-foreign "/usr/lib/libgtkgl.so.5"
:verbose t
:libraries '("--verbose" "-L/usr/lib" "-L/usr/X11R6/lib" "-lgtk"
"-lgdk" "-lgmodule" "-lglib" "-ldl" "-lXi" "-lXext" "-lX11" "-lm" "-lc" "-lGLU"
"-lGL"))
It's hackish, it works, and yes, I should find the time to clean that up.
Order is not entirely unimportant here.
--
regards, [EMAIL PROTECTED] (o_
Thomas Fischbacher - http://www.cip.physik.uni-muenchen.de/~tf //\
(lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y) V_/_
(if (= x 0) y (g g (- x 1) (* x y)))) n 1)) (Debian GNU)