[Openmcl-devel] Can't access Interface Database files from application bundle

Gary Byers gb at clozure.com
Sat Jan 29 12:59:47 PST 2005



On Fri, 28 Jan 2005, David Steuber wrote:

> I've been trying to get OpenMCL to access the CDB files when launched
> from an application bundle in Finder.  I've had no joy.  I have used a
> symlink that was found by CCL::CCL-DIRECTORY.  I've also used
> CCL::SETENV to set "CCL_DEFAULT_DIRECTORY".  I can access the CDB files
> just fine if I run openmcl from Terminal or M-x slime.  The problem
> only exists when running from an application bundle.
>
> When it works:
>
> $ openmcl
> Welcome to OpenMCL Version (Beta: Darwin) 0.14.2-p1!
> ? (ccl::ccl-directory)
> #P"/Users/david/usr/src/ccl/"
> ? (describe 'ccl::setenv)
> Symbol: CCL::SETENV
> Function
> INTERNAL in package: #<Package "CCL">
> Print name: "SETENV"
> Value: #<Unbound>
> Function: #<Compiled-function CCL::SETENV #x60E254E>
> Arglist: (CCL::KEY CCL::VALUE &OPTIONAL CCL::OVERWRITE)
> Plist: NIL
> ?
>
> When it doesn't:
>
> CL-USER> (ccl::ccl-directory)
> #P"/Users/david/usr/src/ccl/"
> CL-USER> (describe 'ccl::setenv)
> Symbol: CCL::SETENV
> ; Warning: Interface file #4P"ccl:darwin-headers;carbon;records.cdb"
> does not exist.
> ; While executing: CCL::CDB-OPEN
> ; Warning: Interface file #4P"ccl:darwin-headers;libc;records.cdb" does
> not exist.
> ; While executing: CCL::CDB-OPEN
> ; Warning: Interface file #4P"ccl:darwin-headers;carbon;types.cdb" does
> not exist.
> ; While executing: CCL::CDB-OPEN
> ; Warning: Interface file #4P"ccl:darwin-headers;libc;types.cdb" does
> not exist.
> ; While executing: CCL::CDB-OPEN
> Function
> INTERNAL in package: #<Package "CCL">
> Print name: "SETENV"
> Value: #<Unbound>
> Function: #<Compiled-function CCL::SETENV #x60E1E46>
> Arglist: (CCL::KEY CCL::VALUE &OPTIONAL CCL::OVERWRITE)
> Plist: NIL
> ; No value
> CL-USER>
>
> In the second example, I'm using M-x slime-connect to connect to a
> running instance that has SWANK compiled in.
>
> This almost smells like a file permission issue except that
> (ccl::getenv "USER") => "david".

Sorry; I should have mentioned/remembered that applications launched
in the finder don't inherit environment variables from the shell
(so setting CCL_DEFAULT_DIRECTORY doesn't help.)  There's a somewhat
awkward way of setting environment variables so that they'll be seen
by GUI applications that's described in an Apple TN or QA. (It's
awkward in that you have to make the programe that launches the
Finder when you log in read the environment variables, so you have
to log out and log back in for those changes to take effect.)

The interface files are supposed to be in subdirectories of
"ccl:darwin-headers;" on OSX.  If you do:


? (pprint (logical-pathname-translations "CCL"))
((#4P"ccl:lib;**;*.fasl" #4P"ccl:bin;*.fasl")
 (#4P"ccl:l1;**;*.fasl" #4P"ccl:l1f;*.fasl")
 (#4P"ccl:l1;**;*.pfsl" #4P"ccl:l1pf;*.pfsl")
 (#4P"ccl:l1;**;*.sfsl" #4P"ccl:l1sf;*.sfsl")
 (#4P"ccl:l1;**;*.dfsl" #4P"ccl:l1df;*.dfsl")
 (#4P"ccl:l1;**;*.*" #4P"ccl:level-1;**;*.*")
 (#4P"ccl:l1f;**;*.pfsl" #4P"ccl:l1pf;**;*.pfsl")
 (#4P"ccl:l1f;**;*.sfsl" #4P"ccl:l1sf;**;*.sfsl")
 (#4P"ccl:l1f;**;*.dfsl" #4P"ccl:l1df;**;*.dfsl")
 (#4P"ccl:bin;**;*.pfsl" #4P"ccl:binppc;**;*.pfsl")
 (#4P"ccl:bin;**;*.sfsl" #4P"ccl:binsparc;**;*.sfsl")
 (#4P"ccl:bin;**;*.dfsl" #4P"ccl:bindarwin;**.*.dfsl")
 (#4P"ccl:l1pf;**;*.*" #4P"ccl:l1-pfsls;**;*.*")
 (#4P"ccl:l1sf;**;*.*" #4P"ccl:l1-sfsls;**;*.*")
 (#4P"ccl:l1df;**;*.*" #4P"ccl:l1-dfsls;**;*.*")
 (#4P"ccl:l1f;**;*.*" #4P"ccl:l1-fasls;**;*.*")
 (#4P"ccl:ccl;*.*" #P"/usr/local/src/ccl/*.*")
 (#4P"ccl:**;*.*" #P"/usr/local/src/ccl/**/*.*"))

you'll see that a lot of the translation rules are oriented toward
cross-compilation.  The last couple of rules map logical pathnames to
physical pathnames, and the non-wildcard directory component of those
physical pathnames is set up to be the result of CCL::CCL-DIRECTORY.

This setup ordinarily happens when a saved image starts up; you can
do it later by doing something like:

(ccl::setenv "CCL_DEFAULT_DIRECTORY" "/what/it/should/be/" t)
(ccl::init-logical-directories)

("ccl:examples;cocoa-aplication.lisp" tries to use a key in the
application bundle's Info.plist to set up these translations.)




More information about the Openmcl-devel mailing list