[elephant-devel] Problem with LWW 5.1.2, BDB-backend
Ian Eslick
eslick at media.mit.edu
Tue Dec 8 20:19:54 UTC 2009
FYI - those warnings are not significant.
Elliott - these DLLs work on your system w/ Lispworks? Is everything working for you? I just want to make sure we have a baseline.
Thanks,
Ian
On Dec 8, 2009, at 12:17 PM, Elliott Slaughter wrote:
> On Tue, Dec 8, 2009 at 12:16 AM, Plamen . <plamen.usenet at gmail.com> wrote:
> Elliot, if you give me a script to compile the DLLs with GCC (I have
> the memutil one, but not the libberkeley-db.dll and following what is
> wirttten in the .ASD file doesn't produce for me the DLLs), I could
> start learning the GDB to try to see what happens on the C-side in the
> spare free time. Or I could try to compile the whole thing using VS,
> there at least I have some memories about the toolchain, but hope of
> course that you will be faster than me with the debugging :)
>
> If you set prebuilt-libraries to nil in my-config.sexp, then Lisp should theoretically build the dlls for you. In case that doesn't work for you, here are the commands I used. (I've got elephant in C:\Bin\asdf\elephant-1.0 and BDB in C:\Program Files (x86)\Oracle\Berkeley DB 4.7.25 )
>
> $ cd "c:\\Bin\\asdf\\elephant-1.0\\src\\db-bdb\\"
> $ gcc -L'/cygdrive/C/Program Files (x86)/Oracle/Berkeley DB 4.7.25/bin/' -I'/cygdrive/C/Program Files (x86)/Oracle/Berkeley DB 4.7.25/include/' -mno-cygwin -mwindows -Wall -c -std=c99 "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c"
> $ dlltool -z "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.def" --export-all-symbols -e exports.o -l "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.lib" "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.o"
> $ gcc -L'/cygdrive/C/Program Files (x86)/Oracle/Berkeley DB 4.7.25/bin/' -I'/cygdrive/C/Program Files (x86)/Oracle/Berkeley DB 4.7.25/include/' -ldb47 -shared -mno-cygwin -mwindows -Wall "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.o" exports.o -o "c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.dll"
>
> There is one strange thing I had to do to get this to compile: I had to comment out the typedef for ssize_t in db.h. (This is something I remember having to do previously, when elephant was working for me.)
>
> With that commented out, I got the following warnings:
>
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c: In function `lisp_compare2':
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c:1061: warning: unused variable `i'
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c: In function `lisp_compare_key2':
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c:1155: warning: unused variable `i'
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c: In function `case_cmp':
> c:\Bin\asdf\elephant-1.0\src\db-bdb\libberkeley-db.c:1314: warning: implicit declaration of function `_strnicmp'
>
> Don't know if either of those are significant or not, but I thought I'd mention them.
>
> Plamen
>
> On Tue, Dec 8, 2009 at 1:14 AM, Ian Eslick <eslick at media.mit.edu> wrote:
> > The error 22 is almost always an issue with:
> >
> > 1) Mismatch between code, libberkeley-db, BDB DLL assumptions about BDB version
> > Are you sure your code is using constants for BDB-4.7 (set in my-config.sexp)
> > 2) CFFI/UFFI
> > 3) Sometimes I've seen this be a 64-bit vs. 32-bit issue
> >
> > Your db-env-set-max-locks error seem to indicate an error in category #1. Are you certain that the code knows you're using BDB-4.7?
> >
> > Ian
> >
> >
> > On Dec 7, 2009, at 1:46 PM, Plamen . wrote:
> >
> >> Hello Elliott & Jan,
> >>
> >> ty a lot for the DLLs - especially the libberkeley-db.dll saved me may
> >> be hours today looking in the gcc & dlltool docs...
> >>
> >> But - now it seems LWW can talk to the DLLs & DB, but:
> >>
> >> 1. in the OPEN-CONTROLLER (in the bdb-controller.lisp) I get some new
> >> errors now :
> >> - (db-env-set-max-locks env max-locks) gives error 22 - invalid argument..
> >> - (db-env-set-max-transactions env max-transactions) - the same
> >> I didn't found them in the "Environment Configuration" of the
> >> "Environments" section of the 4.7.25 docs, so I tought may be they
> >> stayed in the Lisp code from previous BDB versions and commented them
> >> out. (Even if I oversee something I suppose BDB has it's defaults for
> >> that at least)
> >> 2. but when in the same method DB-ENV-OPEN gets called - I again get
> >> the error 22 : Invalid argument.
> >>
> >> From what I see in the code - the invocation uses meaningfull
> >> arguments, putting some debug statements tells that at least on the
> >> Lisp side we have the right constant-values which correspond with the
> >> "db.h"-declarations.
> >>
> >> So - I'm a step further with your help, but still can't even open a
> >> database. I hope - there is a solution. Of course, I could try to make
> >> the binding using directly the LW FFI, but that would be sad private
> >> solution or unnesessery source fragmentation when there is UFFI/CFFI
> >> as a base.
> >>
> >> (Now I use BDB 4.7.25, the newest UFFI in front of CFFI and the DLLs I
> >> receved today)
> >>
> >> If there is a chance for help - I would be very happy.
> >>
> >> On Mon, Dec 7, 2009 at 7:34 PM, Elliott Slaughter
> >> <elliottslaughter at gmail.com> wrote:
> >>> Here are the dlls I built for the newest version of Elephant with BDB
> >>> 4.7.25. If they work for you, then Ian can put them on the project page.
> >>> Hope this helps.
> >>>
> >>> On Mon, Dec 7, 2009 at 10:21 AM, Ian Eslick <eslick at media.mit.edu> wrote:
> >>>>
> >>>> Elliott said he was going to give this a shot. You might correspond with
> >>>> him directly. -Ian
> >>>> On Dec 7, 2009, at 12:09 AM, Plamen . wrote:
> >>>>
> >>>>> Hello Ian,
> >>>>>
> >>>>> thank you for the quick response!
> >>>>>
> >>>>> On Sun, Dec 6, 2009 at 5:44 PM, Ian Eslick <eslick at media.mit.edu> wrote:
> >>>>>> Hey, quick answers:
> >>>>>>
> >>>>>> 1) In the online FAQ you'll notice that you have to ensure that you are
> >>>>>> using uffi and not the uffi compatibility package from cffi.
> >>>>>
> >>>>> Ok, had missed that...
> >>>>>
> >>>>>> 2) The prebuilt DLLs are not up to date (sorry!), they need to be made
> >>>>>> current against BDB 4.7 which Elephant 1.0 depends on.
> >>>>>
> >>>>> Ok, had no idea from the doc or source that 4.7 is the current target,
> >>>>> but that's even better.
> >>>>>
> >>>>>> 3) We have one or two lispworks users that I'm aware of, so it should
> >>>>>> work, but I can't rule out a lispworks specific problem, although I think #1
> >>>>>> and #2 above explain what you're seeing.
> >>>>>>
> >>>>>> Are you a position to build the DLLs yourself?
> >>>>>
> >>>>> Haven't touched C for years now and never had the pleasure with cygwin
> >>>>> but now I'll try it :)
> >>>>>
> >>>>>>
> >>>>>> Ian
> >>>>>>
> >>>>>> On Dec 5, 2009, at 5:28 AM, Plamen . wrote:
> >>>>>>
> >>>>>>> Hello,
> >>>>>>> I need to use BDB for my current application and from what I see on
> >>>>>>> the net, elephant seems to be the most mature and functional solution.
> >>>>>>> After following the installation instructions (I use LispWorks 5.1.2
> >>>>>>> for Windows - yes - I need that configuration at the moment, with
> >>>>>>> Berkeley DB 4.5.20, with prebuild DLLs (libberkeley-db.dll and
> >>>>>>> libmemutil.dll) in the elephant-root and from what I see a correct
> >>>>>>> my-config.sexp also in the elephant-root directory), after loading
> >>>>>>> Elephant I get the following error :
> >>>>>>> ELE-USER 13 > (open-store '(:bdb "/temp/db2/"))
> >>>>>>> Error: The call (#<Function DB-BDB::%DB-ENV-CREATE 22053092> 0) does
> >>>>>>> not match definition (#<Function DB-BDB::%DB-ENV-CREATE 22053092>
> >>>>>>> DB-BDB::FLAGS DB-BDB::ERRNO).
> >>>>>>> From what I see in the sources - there are 3 relevant definitions :
> >>>>>>> 1. the BDB one :
> >>>>>>>
> >>>>>>> db_env_create
> >>>>>>>
> >>>>>>> ________________________________
> >>>>>>>
> >>>>>>> #include <db.h>
> >>>>>>>
> >>>>>>> int
> >>>>>>> db_env_create(DB_ENV **dbenvp, u_int32_t flags);
> >>>>>>>
> >>>>>>> 2. then the libberkeley-db one :
> >>>>>>>
> >>>>>>> DB_ENV *db_env_cr(u_int32_t flags, int *errno) {
> >>>>>>> DB_ENV *envp;
> >>>>>>> *errno = db_env_create(&envp, flags);
> >>>>>>> return envp;
> >>>>>>> }
> >>>>>>>
> >>>>>>> 3. and finally the Lisp definitions :
> >>>>>>>
> >>>>>>> (def-function ("db_env_cr" %db-env-create)
> >>>>>>> ((flags :unsigned-int)
> >>>>>>> (errno :int :out))
> >>>>>>> :returning :pointer-void)
> >>>>>>>
> >>>>>>> (defun db-env-create ()
> >>>>>>> "Create an environment handle."
> >>>>>>> (multiple-value-bind (env errno)
> >>>>>>> (%db-env-create 0)
> >>>>>>> (declare (type fixnum errno))
> >>>>>>> (if (= errno 0)
> >>>>>>> env
> >>>>>>> (error 'db-error :errno errno))))
> >>>>>>>
> >>>>>>> I have cffi_0.10.5 and uffi-1.6.2 (which are currently the newest
> >>>>>>> versions of that libraries).
> >>>>>>>
> >>>>>>> The call (%db-env-create 0) in the db-env-create function looks of
> >>>>>>> course weird for me, but if people use these lines of source on all
> >>>>>>> other Lisp-implementations, obviously I miss something. I know the LW
> >>>>>>> FFI, but I'm not really proficient in the CFFI/UFFI-conversion to see
> >>>>>>> the missing parts, but if there is someone outside in the WWW who runs
> >>>>>>> LWW & BDB and/or knows how to help, I would be very gratefull.
> >>>>>>>
> >>>>>>> Regards
> >>>>>>> Plamen
> >>>>>>>
> >>>>>>> _______________________________________________
> >>>>>>> elephant-devel site list
> >>>>>>> elephant-devel at common-lisp.net
> >>>>>>> http://common-lisp.net/mailman/listinfo/elephant-devel
> >>>>>>
> >>>>>>
> >>>>>> _______________________________________________
> >>>>>> elephant-devel site list
> >>>>>> elephant-devel at common-lisp.net
> >>>>>> http://common-lisp.net/mailman/listinfo/elephant-devel
> >>>>>>
> >>>>>
> >>>>> _______________________________________________
> >>>>> elephant-devel site list
> >>>>> elephant-devel at common-lisp.net
> >>>>> http://common-lisp.net/mailman/listinfo/elephant-devel
> >>>>
> >>>>
> >>>> _______________________________________________
> >>>> elephant-devel site list
> >>>> elephant-devel at common-lisp.net
> >>>> http://common-lisp.net/mailman/listinfo/elephant-devel
> >>>
> >>>
> >>>
> >>> --
> >>> Elliott Slaughter
> >>>
> >>> "Don't worry about what anybody else is going to do. The best way to predict
> >>> the future is to invent it." - Alan Kay
> >>>
> >>> _______________________________________________
> >>> elephant-devel site list
> >>> elephant-devel at common-lisp.net
> >>> http://common-lisp.net/mailman/listinfo/elephant-devel
> >>>
> >>
> >> _______________________________________________
> >> elephant-devel site list
> >> elephant-devel at common-lisp.net
> >> http://common-lisp.net/mailman/listinfo/elephant-devel
> >
> >
> > _______________________________________________
> > elephant-devel site list
> > elephant-devel at common-lisp.net
> > http://common-lisp.net/mailman/listinfo/elephant-devel
> >
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
>
>
>
> --
> Elliott Slaughter
>
> "Don't worry about what anybody else is going to do. The best way to predict the future is to invent it." - Alan Kay
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20091208/e433421b/attachment.html>
More information about the elephant-devel
mailing list