Re: https://github.com/Clozure/ccl/releases

"R. Matthew Emerson" <[email protected]> Mon, 6 May 2024 10:11:39 -0700
Newsgroups gmane.lisp.openmcl.devel
Message-ID <[email protected]>

> On May 5, 2024, at 8:49=E2=80=AFPM, Gr=C3=A9gory Vanuxem =
<[email protected]> wrote:
>=20
> The first time I wanted to try out Clozure CL I postponed its use
> because I was lacking concrete information to build and/or install
> CCL.
> I just rebuilt a new image with code cloned from GitHub, and looking
> at the documentation of how to build CCL I remembered what I was
> asking myself at that time. Even if I did what I will say I was
> unsure. I had absolutely knowledge about Clozure CL, just that it was
> a Common Lisp implementation that conforms to ANSI standards.
>=20
> So if you don't know like me at that time, the name of the Clozure CL
> executable, I think it could be handy to replace in the file mentioned
> in object:
>=20
> -- After unpacking the binaries, you can rebuild CCL by evaluating
> (rebuild-ccl :full t) as usual.
> ++ After unpacking the binaries, you can rebuild CCL by evaluating
> (rebuild-ccl :full t) with the usual lx${arch} executable.
>=20
> Or something like that. It is really not a common name for an
> executable, I guess some history is involved here, but even a shell
> script, imagine CCL is installed in /usr/bin for example, you have to
> use 'uname' or something else to evaluate CL code by CCL. This is not
> very UNIX-likish.

Thank you for the feedback.

I=E2=80=99m so used to CCL=E2=80=99s quirks that I sometimes don=E2=80=99t=
 notice potentially-confusing issues like this.

The sample ccl script could be handy when your home directory is shared =
via NFS (or something like it) to machines with different CPU =
architectures (hence the call to uname).

If you keep CCL (binaries, interface databases, source code) all in one =
directory, you can put a little script like this into a directory on =
your path:

#!/bin/sh
exec /path/to/ccl/lx86cl64 =E2=80=9C$*=E2=80=9D

If you call that script =E2=80=9Cccl=E2=80=9D, then that can work fine.

If you save your own heap images outside of the ccl directory, this =
won=E2=80=99t be sufficient, because CCL, by default, uses the directory =
that contains the heap image as the ccl directory. In that case, you =
need to set CCL_DEFAULT_DIRECTORY to the directory containing the CCL =
sources and interface databases.

For example, when everything is in one directory, and =E2=80=9Cccl=E2=80=9D=
 is the little shell script I mentioned above:

% ccl
Clozure Common Lisp Version 1.12.2 (v1.12.2-33-g124a7548) DarwinX8664
? (probe-file "ccl:")
#P"/Users/rme/ccl/ccl/"
? (#_getpid)
94502
? (require 'asdf)
ASDF
("uiop" "UIOP" "asdf" "ASDF")
? (quit)
%=20
Now, suppose I save a heap image in my home directory, and start up with =
that:

% ccl
Clozure Common Lisp Version 1.12.2 (v1.12.2-33-g124a7548) DarwinX8664
? (save-application "rme.image")
% ccl -I rme.image
Clozure Common Lisp Version 1.12.2 (v1.12.2-33-g124a7548) DarwinX8664
? (probe-file "ccl:")
#P"/Users/rme/"
? (#_getpid)

; Warning: Interface file =
#P"/Users/rme/darwin-x86-headers64/libc/functions.cdb" does not exist, =
and the containing directory does not exist.
;          This may mean that that the "ccl:" logical-pathname host has =
not been properly initialized.  ; While executing: CCL::CDB-OPEN, in =
process listener(1).
> Error: Foreign function not found: X86-DARWIN64::|getpid|
> While executing: CCL::LOAD-EXTERNAL-FUNCTION, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :pop

? (require 'asdf)
> Error: Module ASDF was not provided by any function on =
*MODULE-PROVIDER-FUNCTIONS*.
> While executing: REQUIRE, in process listener(1).
> Type :POP to abort, :R for a list of available restarts.
> Type :? for other options.
1 > :pop

?=20
If I set CCL_DEFAULT_DIRECTORY then things work.

% export CCL_DEFAULT_DIRECTORY=3D~/ccl/ccl
% ccl -I rme.image
Clozure Common Lisp Version 1.12.2 (v1.12.2-33-g124a7548) DarwinX8664
? (probe-file "ccl:")
#P"/Users/rme/ccl/ccl/"
? (#_getpid)
94517
?=20

But, if CCL_DEFAULT_DIRECTORY ends up in the =E2=80=9Cglobal=E2=80=9D =
environment (like I unwisely did above), it can get in the way. =
https://github.com/Clozure/ccl/issues/479 is about that: "Sometimes it =
happens that CCL_DEFAULT_DIRECTORY ends up being set in the environment, =
and points to sources in an unexpected location."