[elephant-devel] CVS HEAD w/ lispworks 5.0.1 linux

Lui Fungsin fungsin.lui at gmail.com
Sun May 6 00:07:25 UTC 2007


On 5/5/07, Ian Eslick <eslick at csail.mit.edu> wrote:
> PS - I've had several people load the current HEAD and run on linux/
> sbcl with the same positive result.  So far you are the only
> failure.

I also don't have any problem with SBCL at all.

I'm running fedora core 6, SBCL 1.0.3 and lispworks 5.0.2.

BTW, I found out that the MOP error only happens with lispworks 5.0.1.

I should have checked lispwork's website first, it turns out that
5.0.2 has been out for a while.

Sorry for the false alarm.

> I'll test Lispworks under Linux later and see if I can
> reproduce the problem, but it worked fine for me before I released
> RC1.  Do you have your library path setup correctly in your my-
> config.sexp?

I use henrik's install-bdb.sh script to install the latest bdb and it
creates my-config.sexp automatically.

Remember without the -ldb flag, ldd shows that

$ ldd src/db-bdb/libberkeley-db.so
        linux-gate.so.1 =>  (0x009fb000)
        libm.so.6 => /lib/libm.so.6 (0x00110000)
        libc.so.6 => /lib/libc.so.6 (0x00db5000)
        /lib/ld-linux.so.2 (0x0085f000)

> (asdf:operate 'asdf:load-op :elephant)
> (asdf:operate 'asdf:load-op :ele-bdb)

The elephant.asd loads both

(uffi:load-foreign-library
"/usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so" :module
"/usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so")

and

(uffi:load-foreign-library "src/db-bdb/libberkeley-db.so" :module
"src/db-bdb/libberkeley-db.so")

To verify that libdb is loaded, I type the following in the REPL

> (uffi:def-function ("db_strerror" test-db-strerror)
      ((error :int))
    :returning :cstring)

> (test-db-strerror 1)
"Operation not permitted"

Now in src/db-bdb/libberkeley-db.c there's a wrapper function
db_strerr which call the above db_strerror.

If I tried this in the REPL
> (%db-strerror 1)

lispworks-5-0-0-x86-linux: symbol lookup error:
src/db-bdb/libberkeley-db.so: undefined symbol: db_strerror

So even though both "*.so" are loaded with load-foreign-library,
libberkeley-db.so cannot access functions in libdb-4.5.so

Now with the -ldb flag

$ ldd src/db-bdb/libberkeley-db.so
        linux-gate.so.1 =>  (0x00d71000)
        libm.so.6 => /lib/libm.so.6 (0x00d43000)
        libdb-4.5.so => /usr/local/BerkeleyDB.4.5/lib/libdb-4.5.so (0x00918000)
        libc.so.6 => /lib/libc.so.6 (0x00b43000)
        /lib/ld-linux.so.2 (0x0085f000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00f9c000)

By the time libberkeley-db.so is loaded, it should pull in
libdb-4.5.so automatically, and the above test will succeed.

I really don't have much knowledge of how SBCL/lispworks implement
their FFI load-library function, but it seems that for SBCL, merely
using load-foreign-library is enough. Someone might have a clue of
what's going on.



More information about the elephant-devel mailing list