Discussion:
[Larceny-users] r6rs and err5rs libraries in custom location (larceny-5896)
Marco Maggi
2009-01-11 07:24:57 UTC
Permalink
On my i686-pc-linux-gnu I am trying to generate
a Slackware package. For this, after building
everything as usual, I install the files from
the top source directory of Larceny 5896 under:

/usr/local/libexec/larceny/0.98

and the libraries under:

/usr/local/lib/larceny/0.98

(let's not care about the version number now).
The main executable is wrapped in a script:

/usr/local/bin/larceny

with contents:

#!/bin/bash
#
# Launcher for Larceny Scheme.

DIR=${0%/*}
LIBDIR=${DIR}/../lib/larceny/0.98
LIBEXECDIR=${DIR}/../libexec/larceny/0.98
export LARCENY_ROOT=${LIBEXECDIR}
export LARCENY_LIBPATH=${LIBDIR}:${LARCENY_LIBPATH}

exec "${LIBEXECDIR}/larceny" "$@"

### end of file

Now just running:

$ larceny

enters R5RS mode and I can evaluate forms.
But running:

$ larceny -err5rs

immediately prints:

Error: Could not locate library: r6rsmode

and enters the debugger. The same happens
when I try to run an R6RS program. If I put
the whole traditional installation under
"/opt/larceny/last" and set the PATH correctly
I can run the ERR5RS REPL as usual.

Trying:

/usr/local/libexec/larceny/0.98/larceny \
-path /usr/local/lib/larceny/0.98 -err5rs

I get the same error about "r6rsmode"
missing. But I can see the library in:

/usr/local/lib/larceny/0.98/lib/R6RS/r6rsmode.sch

and the FASL file is there, too.

?

TIA
--
Marco Maggi

"Now feel the funk blast!"
Rage Against the Machine - "Calm like a bomb"
William D Clinger
2009-01-11 19:40:57 UTC
Permalink
Post by Marco Maggi
$ larceny -err5rs
Error: Could not locate library: r6rsmode
That means the require procedure could not find the
R5RS library named r6rsmode.
Post by Marco Maggi
If I put
the whole traditional installation under
"/opt/larceny/last" and set the PATH correctly
I can run the ERR5RS REPL as usual.
That's because the traditional installation sets
the require path correctly.
Post by Marco Maggi
/usr/local/libexec/larceny/0.98/larceny \
-path /usr/local/lib/larceny/0.98 -err5rs
I get the same error about "r6rsmode"
/usr/local/lib/larceny/0.98/lib/R6RS/r6rsmode.sch
and the FASL file is there, too.
True, but r6rsmode is not an ERR5RS/R6RS library,
so neither the LARCENY_LIBPATH nor -path option
are relevant. Because r6rsmode is an R5RS library
and is loaded using require rather than import, the
require path must be set up so require can find the
r6rsmode library (and the libraries that it requires)
using Larceny's R5RS-mode require path.

If you change the relationship between Larceny's root
directory and its lib/R6RS directory, then you will
have to make a corresponding change to the startup.sch
file in Larceny's root directory. By the way, omitting
startup.sch from Larceny's root directory is another
possible cause of the symptoms you have described.

Will
William D Clinger
2009-01-11 22:25:47 UTC
Permalink
Post by William D Clinger
True, but r6rsmode is not an ERR5RS/R6RS library,
so neither the LARCENY_LIBPATH nor -path option
are relevant.
That's not true; the paths taken from the -path
option or the LARCENY_LIBPATH environment variable
are used for both R5RS and ERR5RS/R6RS libraries,
and are set up before the call to require with
'r6rsmode as argument.
Post by William D Clinger
/usr/local/libexec/larceny/0.98/larceny \
-path /usr/local/lib/larceny/0.98 -err5rs
I get the same error about "r6rsmode"
/usr/local/lib/larceny/0.98/lib/R6RS/r6rsmode.sch
and the FASL file is there, too.
The actual problem here is that r6rsmode.sch does
not lie within the /usr/local/lib/larceny/0.98
directory that was specified using the -path option;
it lies within /usr/local/lib/larceny/0.98/lib/R6RS,
which is not part of the require path.

The relative paths specified in startup.sch are
relative to Larceny's root directory, and are
not relative to themselves or to any other paths
specified by the -path or LARCENY_LIBPATH.

What I would recommend is to keep Larceny's
normal directory hierarchy intact, and to put
that directory hierarchy wherever you like.
Then you can copy the larceny shell script to some
other place such as /usr/local/libexec/larceny/0.98/,
and edit that script so LARCENY_ROOT points to
Larceny's root directory.

Will
Marco Maggi
2009-01-12 19:45:07 UTC
Permalink
Post by William D Clinger
The actual problem here is that r6rsmode.sch does
not lie within the /usr/local/lib/larceny/0.98
directory that was specified using the -path option;
it lies within /usr/local/lib/larceny/0.98/lib/R6RS,
which is not part of the require path.
Thanks. For now the following script:

DIR=${0%/*}
LIBDIR=${DIR}/../lib/larceny/0.98
LIBEXECDIR=${DIR}/../libexec/larceny/0.98
export LARCENY_ROOT=${LIBEXECDIR}
export LARCENY_LIBPATH=${LIBDIR}:${LIBDIR}/lib/R6RS:${LARCENY_LIBPATH}

exec "${LARCENY_ROOT}/larceny.bin" \
-heap "${LARCENY_ROOT}/larceny.heap" \
"$@"

seems to work with the layout I described. I am
abusing, but I want to try to have a slim
installation so I will make experiments.
--
Marco Maggi
Loading...