[Ecls-list] ecldev.info hello.lsp example

T. Kurt Bond tkb at tkb.mpl.com
Thu Jul 29 21:21:04 UTC 2004


Running FreeBSD 5.2.1, I checked ecls out of cvs earlier this evening
and (not using the FreeBSD port) configured, compiled, and installed
it, and ran into a couple of odd things.


First, I've got the boehm gc port installed, but the ecls configure
went ahead and built it's local copy.  I had specified
--prefix=/sw/test/ecls-0.9d but the library files got installed during
the build in /sw/src/ecls/build, which was the build directory, but
they were *not* installed in /sw/test/ecls-0.9d/lib/ecl.  (The gmp
library was, however).  This means that when I tried to build the
following program stand-alone

fact.lsp:

	(defun fact (n)
	  (if (<= n 1)
	      1
	    (* n (fact (1- n)))))

	(format t "~a~%" (fact 10))
	(quit)

it failed without being able to find -lgc during the link step.
Here's a transcript:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: build-fact.txt
Type: application/octet-stream
Size: 2157 bytes
Desc: transcript of building fact standalone
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20040729/9acb454f/attachment.obj>
-------------- next part --------------

(Is the C source supposed to get dumped to the terminal like that?)

So I looked at the hello.lsp example in ecldev.info and tried that to
make sure I was doing things right, and that failed.  More on that in
a bit.

So I just manually copied the gc library to the
/sw/test/ecls-0.9d/lib/ecl directory and tried compiling it again and
this time it worked.

Ok, now about problem with the hello.lsp example from ecldev.info.

Here's  hello.lsp:

    (princ "Hello world!")
    (terpri)
    (quit)

I tried to compile it following the directiosn in ecldev.info, and it
failed during the C compilation, complaining about compitler_data_text
and compilter_data_text size being undeclared.  Here's a transcript:

-------------- next part --------------
A non-text attachment was scrubbed...
Name: build-hello.txt
Type: application/octet-stream
Size: 1343 bytes
Desc: transcript of building hello.lsp
URL: <https://mailman.common-lisp.net/pipermail/ecl-devel/attachments/20040729/9acb454f/attachment-0001.obj>
-------------- next part --------------

There's not much difference between my fact.lsp and hello.lsp, just
the fact that one defines a function and the other doesn't, so I added
the line

    (defun try () "try")

at the beginning of hello.lsp and tried compiling it again.  This time
it compiled fine.  I took the line with the function out and this time
it compiled fine.  Investigating further, without the defun the
hello.data file was empty, but with the defun it contained

    static const char compiler_data_text[] = 
    "\"try\" common-lisp-user::try) ";
    #define compiler_data_text_size 29

Another minor oddity that I ran across is that 

    (c:build-program "myecl" :lisp-files '("hello.o")

would fail if I hadn't already called compile-file during the current
ecl session, even if the necessary .o file existed from a previous
session, because cmp.fas hadn't been loaded yet.  This should probably
be documented in the description of c:build-program.

BTW, ecl looks very promising to me; I like it's ability produce
standalone executables and libraries, and its relatively econimical
footprint (diskspace, memory usage, and cpu usage) for small
executables.
-- 
T. Kurt Bond, tkb at tkb.mpl.com


More information about the ecl-devel mailing list