[I'm running CMU CL 19a on FreeBSD 4.x; I can give more details
if they're helpful.]

I'm feeling very dim; MERGE-PATHNAMES isn't behaving
at all as I'd naively expect it to.

I am, I'm sure, just about unique in feeling that I don't fully
grasp the Common Lisp pathname facility. So, what am I
doing wrong here? I'll spell out what I'm doing in tedious
detail because my stupidity is such that I'm unclear exactly
where my understanding is most drastically lacking. Those
who are quicker on the uptake than me and don't want to
wade through piles of verbiage are advised to read the next
five lines or so, and then skip to the paragraph beginning
"A more self-contained illustration".

In my .cmucl-init.lisp:

    (setf (logical-pathname-translations "cl-library")
      '(("**;*.*.*" "/home/gjm11/u/lib/lisp/**/")))

I have a pile of packages under ~/u/lib/lisp; for instance,
the one I'm currently trying to get to work is Elephant, at
/home/gjm11/u/lib/lisp/elephant/ . In its ASDF system
definition, I've put

      :pathname #p"cl-library:elephant;"

and when I say (asdf:operate 'asdf:compile-op :elephant)
everything seems to go smoothly. However ... Elephant
makes use of a UFFI-wrapped library called libsleepycat.so .
I've compiled that and placed it at
    /home/gjm11/u/lib/lisp/elephant/libsleepycat.so
which seems to be the intention of the package's
authors. Here's the code that is supposed to load
this library:

      (uffi:load-foreign-library 
       (if (find-package 'asdf)
           (merge-pathnames 
            #p"libsleepycat.so"
            (asdf:component-pathname (asdf:find-system 'elephant)))
           "/usr/local/share/common-lisp/elephant-0.2/libsleepycat.so")
       :module "libsleepycat")

This fails; that is, UFFI:LOAD-FOREIGN-LIBRARY returns
nil. Well, OK, so what's MERGE-PATHNAMES returning?

    * (asdf:component-pathname (asdf:find-system 'elephant))
    
    ; Loading #p"/home/gjm11/u/lib/lisp/systems/elephant.asd".
    #.(logical-pathname "CL-LIBRARY:ELEPHANT;")

That looks right ...

    * (merge-pathnames 
                #p"libsleepycat.so"
                (asdf:component-pathname (asdf:find-system 'elephant)))
    
    #p"/elephant/libsleepycat.so"

That, however, looks entirely wrong; no wonder UFFI is
failing to load the library, since it's looking for it in the wrong
place.

A more self-contained illustration of what confuses me:

    * (merge-pathnames #p"foo.lisp" #p"cl-library:zog;")
    
    #p"/zog/foo.lisp"

Is this the Right Thing? If so, presumably I shouldn't be
trying to use LOGICAL-PATHNAME-TRANSLATIONS to
abstract away from my directory structure; so what should
I be doing, and why?

-- 
Gareth McCaughan


Reply via email to