Elephant users,

I promoted a change that enables the -ldb option on linux. The db extension is computed as follows on Mac and Linux:

If you provide a pointer to the library such as /usr/lib/libdb45.so. The build script in ele-bdb.asd extracts the name "libdb45" and returns the substring starting at offset 3: "db45"

This will result in "-ldb45" being passed to gcc.

This will not work if a system does not have the lib prefix on their library name. Please let me know if we need to handle additional cases.

I'm aiming to re-test the recent patches and formally announce 0.9 next Monday, so test now or forever squelch your protests. I am willing to support minor patches to 0.9 through the release of 1.0 to keep the system stable, but any major new features or significant bug fixes will be done on our 0.9.x darcs tree on common-lisp.net.

For the record, the patches to RC1 thus far are:

Functional:
- fix typo in elephant.asd
- remove linux conditional on -l link option for gcc builds
- Make the elephant code version 0.9.0 instead of 0.6.1
- Update the upgrade version map to accommodate 0.6.0 => 0.9.0 databases

Aesthetic:
- update parameter names for bdb performance tuning in my-config.sexp
- fix typos in manual
- document collect option (and fix bug in that promotion)

Ian



On May 5, 2007, at 8:07 PM, Lui Fungsin wrote:

On 5/5/07, Ian Eslick <[EMAIL PROTECTED]> 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.
_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to