[Openmcl-devel] Problems trying to create CDB files for the Addressbook framework

Gary King gwking at metabang.com
Thu May 11 14:02:13 UTC 2006

I'm feeling chagrined.

I have two OpenMCL installations. Guess which one I used when I ran  
FFIGEN? Guess which one I ran when I tried to build the CDBs? If you  
guessed two different ones, you'd be right. The only excuse I have is  
that the _logical_ pathname was the same in both cases!

I've just committed the following patch to CVS. It raises an error if  
the directory does not exist in order to provide a cleaner message  
for tired souls such as myself <smile>.

> Index: lib/db-io.lisp
> ===================================================================
> RCS file: /usr/local/tmpcvs/openmcl-dev/ccl/lib/db-io.lisp,v
> retrieving revision 1.26
> diff -u -w -u -r1.26 db-io.lisp
> --- lib/db-io.lisp      26 Oct 2005 23:43:16 -0000      1.26
> +++ lib/db-io.lisp      11 May 2006 13:58:30 -0000
> @@ -76,6 +76,10 @@
>    ;;; Open the file specified by PATHNAME for output and return a
>    ;;; small integer "file id" (fid).
>    (defun fid-open-output (pathname)
> +    (let ((dir (make-pathname :type nil :name nil :defaults  
> pathname)))
> +      (unless (probe-file dir)
> +       (error "The directory ~S does not exist, cannot open/create  
> ~S"
> +              dir pathname)))
>      (let* ((id (fd-open (cdb-native-namestring pathname)
>                         (logior #$O_WRONLY #$O_CREAT #$O_TRUNC))))
>        (if (< id 0)

Thanks Gary for the clear explanation below.

On May 10, 2006, at 5:57 PM, Gary Byers wrote:

> On Wed, 10 May 2006, Gary King wrote:
>> Hi Gary,
>> Thanks for the input. I did manage to get the ffi files created  
>> but am now having problems with going from them to the CDB (one  
>> step forward... into a wall <smile>). I'm familiar with the work  
>> that you and Ralph Richard Cook did back in late October / early  
>> November 2005. If I manage to understand things well enough, I'm  
>> happy to try and improve on the hoop jumping -- though the time  
>> frame for that would be uncertain.
>> Though I think this will be a duplication, here is the error I get  
>> when trying to parse the ffi files:
>>> ;;; proof that it can work...
>>> ? (parse-standard-ffi-files :webkit)
>>> T
>>> ;;; but no for my address book files
>>> ? (parse-standard-ffi-files :addressbook)
>>> > Error: No such file or directory : #P"ccl:darwin-  
>>> headers;addressbook;new-constants.cdb"
>>> > While executing: CDBM-OPEN, in process listener(1).
>>> > Type :POP to abort.
>>> Type :? for other options.
>>> 1 > :b
>>> (F0135B70) : 0 (CDBM-OPEN #P"ccl:darwin-headers;addressbook;new-  
>>> constants.cdb") 40
> CDB file are written once (in a sort of batch process) and are
> subsequently read-only.  PARSE-STANDARD-FFI-FILES tries to create
> a new set ("new-constants.cdb", etc.) as one of the first things
> that it does; it then parses the FFI files, writes the information
> that it finds to the "new-*.cdb" files, renames any previously-
> existing (non-"new") .cdb files in the directory (to *.cdb-BAK),
> and renames the newly-created files (strippling off the "new-"
> prefix from the name.)
> While it's parsing, it often needs to resolve forward references
> (things like #define FOO BAR, where BAR isn't defined yet.)  It'll
> look in all of the "constants.cdb" files in all active interface-dirs
> for BAR in that case; the directory it's parsing is active and that
> directory's "constants.cdb" file may not exist yet, so you'll get
> a warning the first time that this happens and it'll ignore that
> (not-yet-created) file for the rest of the run.  (Parsing a set of
> .ffi files twice -sometimes- yields better results; if there are
> forward references like the case above, the second pass can sometimes
> resolve them.)
> Anyway, the error that you're getting is while trying to create
> "new-constants.cdb" before anything else really happens.  There
> might be other explanations, but one of the ways in which a
> "no such file or directory" error can happen when creating an
> output file is if some parent directory is missing ...

Gary Warren King
(413) 210 7511
gwking on #lisp (occasionally)

More information about the Openmcl-devel mailing list