From: Noemat
Subject: Makeing binaries (?)
Date: 
Message-ID: <bdamdv$q74$1@inews.gazeta.pl>
Helo all!

I am new in lisp. I use gcl. How to make binaries from lisp code?

Thank you for answering.



-- 
Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/

From: John M. Adams
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <oqa7k7aubja.fsf@RAKTABIJA.stsci.edu>
"Noemat" <······@wp.pl> writes:

> Helo all!
> 
> I am new in lisp. I use gcl. How to make binaries from lisp code?

There is no standard way.  To run a Lisp program, in the sense of
running a C program, usually, one builds Lisp images rather than
binaries.  Then, one runs Lisp on the image in a manner similar to the
following:

lisp -i my.image -e my-entry-point args ...

Lisp doesn't define a standard entry point like C's main.  Some Lisp's
let you build a system binary image.  For Lisps that don't, one wraps
something like the above invocation in a script.

In a language like C, one tends to think of a program (binary) as
something that can be directly loaded by the operating system, like
hello.exe or a.out.  In Lisp, a program usually means a function.
Normally, at least when programming, one would run the program by
typing a function invocation at the Lisp prompt.

Unless you have to use gcl for some reason, I would recommend using
CLISP, which is better documented and more actively maintained than
gcl.

There is an entry in the Lisp FAQ that is related to your question,
but it seems ambiguous and incomplete to me.

-- 
John M. Adams
From: M. K.
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <3EF91CC4.1DE81E23@ozemail.com.au>
From your unix shell: gcl -compile filename.lsp

From within the gcl interpreter: (compile-file "filename.lsp")

Unlike C binaries, these binaries are not self sufficient. They still
need gcl to run.

To run:

From your unix shell: gcl -load filename.o

From within the gcl interpreter: (load "filename.o")

P.S. - I have not been able to find a "man" page with all the command
line options for gcl. Have you found one?

Regards, M.K. (newbie as well)

---

Noemat wrote:

> Helo all!
>
> I am new in lisp. I use gcl. How to make binaries from lisp code?
>
> Thank you for answering.
>
> --
> Serwis Usenet w portalu Gazeta.pl -> http://www.gazeta.pl/usenet/
From: Joe Marshall
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <k7ba9tmr.fsf@ccs.neu.edu>
"M. K." <····@ozemail.com.au> writes:

> From your unix shell: gcl -compile filename.lsp
> 
> From within the gcl interpreter: (compile-file "filename.lsp")
> 
> Unlike C binaries, these binaries are not self sufficient. They still
> need gcl to run.

Like Java binaries, you still need the VM to run.

(Just putting some spin on it.)


> To run:
> 
> From your unix shell: gcl -load filename.o
> 
> From within the gcl interpreter: (load "filename.o")
> 
> P.S. - I have not been able to find a "man" page with all the command
> line options for gcl. Have you found one?
From: M. K.
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <3EFA75D9.1712242A@ozemail.com.au>
Yes.
Hey Joe, wouldn't it be nice if web browsers came with a lisp plug in?
I think it might put some of Bill Gates' big friends out of business.

(Wishfull thinking)

Joe Marshall wrote:

> "M. K." <····@ozemail.com.au> writes:
>
> > From your unix shell: gcl -compile filename.lsp
> >
> > From within the gcl interpreter: (compile-file "filename.lsp")
> >
> > Unlike C binaries, these binaries are not self sufficient. They still
> > need gcl to run.
>
> Like Java binaries, you still need the VM to run.
>
> (Just putting some spin on it.)
>
> > To run:
> >
> > From your unix shell: gcl -load filename.o
> >
> > From within the gcl interpreter: (load "filename.o")
> >
> > P.S. - I have not been able to find a "man" page with all the command
> > line options for gcl. Have you found one?
From: Joe Marshall
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <r85h7yid.fsf@ccs.neu.edu>
"M. K." <····@ozemail.com.au> writes:

> Yes.
> Hey Joe, wouldn't it be nice if web browsers came with a lisp plug in?
> I think it might put some of Bill Gates' big friends out of business.

Doesn't W3 come with one?
From: Matthew Danish
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <20030625181253.GJ17568@lain.mapcar.org>
On Wed, Jun 25, 2003 at 01:53:40PM +1000, M. K. wrote:
> Unlike C binaries, these binaries are not self sufficient.

Since when are C binaries self-sufficient?

$ ldd /bin/cat
libc.so.6 => /lib/libc.so.6 (0x4001a000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."
From: M. K.
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <3EFA73E6.A38D15C@ozemail.com.au>
Good point.

I better reword that to "these binaries must be run through the interpretter".

Actually, I have a feeling that I'm not supposed to call them binaries as well.

M.K.

-----

Matthew Danish wrote:

> On Wed, Jun 25, 2003 at 01:53:40PM +1000, M. K. wrote:
> > Unlike C binaries, these binaries are not self sufficient.
>
> Since when are C binaries self-sufficient?
>
> $ ldd /bin/cat
> libc.so.6 => /lib/libc.so.6 (0x4001a000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
>
> --
> ; Matthew Danish <·······@andrew.cmu.edu>
> ; OpenPGP public key: C24B6010 on keyring.debian.org
> ; Signed or encrypted mail welcome.
> ; "There is no dark side of the moon really; matter of fact, it's all dark."
From: Matthew Danish
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <20030626095356.GK17568@lain.mapcar.org>
On Thu, Jun 26, 2003 at 02:17:43PM +1000, M. K. wrote:
> Good point.
> I better reword that to "these binaries must be run through the interpretter".

Better not, in fact, since the files are very likely compiled machine
code which simply needs to be loaded into the proper place and provided
with the appropriate runtime support.  

(Unless you mean the hardware-accelerated interpretation supported by the
main system processor.  I understand that this is a popular feature on
many computers these days;)

> Actually, I have a feeling that I'm not supposed to call them binaries as well.

``Binaries'' is o.k. but I think the typical term in Lisp circles is ``FASL
files''.  Implementation-dependent of course.

-- 
; Matthew Danish <·······@andrew.cmu.edu>
; OpenPGP public key: C24B6010 on keyring.debian.org
; Signed or encrypted mail welcome.
; "There is no dark side of the moon really; matter of fact, it's all dark."
From: Ivan Boldyrev
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <cobusxrrr.ln2@elaleph.borges.cgitftp.uiggm.nsc.ru>
On 8421 day of my life Matthew Danish wrote:
> On Wed, Jun 25, 2003 at 01:53:40PM +1000, M. K. wrote:
>> Unlike C binaries, these binaries are not self sufficient.
>
> Since when are C binaries self-sufficient?
>
> $ ldd /bin/cat
> libc.so.6 => /lib/libc.so.6 (0x4001a000)
> /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)

[··@ ~]$ ldd /sbin/ldconfig
        not a dynamic executable
[··@ ~]$ file /sbin/ldconfig
/sbin/ldconfig: ELF 32-bit LSB executable, Intel 80386, version 1
(SYSV), for GNU/Linux 2.2.5, statically linked, stripped 
                             ^^^^^^^^^^^^^^^^^

AFAIR, Netscape 4.x is distributed as statically linked executable.

So, I have a choice.  But can I choose when I create lisp executables?
Not yet...

BTW, another example of runtime-dependent language is Perl (and other
scripting languages).

-- 
Ivan Boldyrev

                                       XML -- new language of ML family.
From: Duane Rettig
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <4d6gztfm9.fsf@beta.franz.com>
Ivan Boldyrev <···············@cgitftp.uiggm.nsc.ru> writes:

> On 8421 day of my life Matthew Danish wrote:
> > On Wed, Jun 25, 2003 at 01:53:40PM +1000, M. K. wrote:
> >> Unlike C binaries, these binaries are not self sufficient.
> >
> > Since when are C binaries self-sufficient?
> >
> > $ ldd /bin/cat
> > libc.so.6 => /lib/libc.so.6 (0x4001a000)
> > /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
> 
> [··@ ~]$ ldd /sbin/ldconfig
>         not a dynamic executable
> [··@ ~]$ file /sbin/ldconfig
> /sbin/ldconfig: ELF 32-bit LSB executable, Intel 80386, version 1
> (SYSV), for GNU/Linux 2.2.5, statically linked, stripped 
>                              ^^^^^^^^^^^^^^^^^

Since you've chosen to play the "static" card, let me trump that
with my "driver" card (puns intended, somewhat):

The program you hold up as an example is not self-sufficient.  Not
because it is part of the operating system and makes assumptions
about it (because I could easily create a do-little program which
is static but makes no assumptions about and does not manipulate
the operating system), but instead because it in fact makes system
calls to the operating system for services.  You wouldn't be able to
run that program on, say, an NT system, which, even if it did recognize
ELF format, would not provide os and filesystem services in the same
way as Linux does.  And you wouldn't be able to run it on, say, a
robot, even if it had precisely the same hardware configuration as
your Linux box, because the drivers might not exist on that robot.

Contrast this, in fact, with a robot program, or some other fully
embeded device like a cell-phone - one can create such a fully
self-contained program which only needs to be started (let's say,
by a monitor).  If the hardware is the same, you could move such a
binary to your linux, load it into memory, and jump to it, and it
would work (to the extent that it has been programmed to deal with
the possibly virtual environment it is now in).

Now of course, this example is ludicrous, but I want to bring
it up to make a point; Nobody _really_ wants _full_ self-containment
anymore; even embedded programs make assumptions as to their
environment, and are not really self-contained anymore.  Unix and
unix-like systems haven't had static linking as their default
linking mode for about 10 years, now, and so the question I would have
for you is "Why would you want self-contained programs?"  If you
just want it for the sake of transporting the program without having to
install anything, then I say "wake up and smell the java - the world
continues to move toward _more_ interdependence between programs and
libraries, not less".

-- 
Duane Rettig    ·····@franz.com    Franz Inc.  http://www.franz.com/
555 12th St., Suite 1450               http://www.555citycenter.com/
Oakland, Ca. 94607        Phone: (510) 452-2000; Fax: (510) 452-0182   
From: Mike Thomas
Subject: Re: Makeing binaries (?)
Date: 
Message-ID: <3efa6fe9$0$59957$c30e37c6@lon-reader.news.telstra.net>
Hi there.

"M. K." <····@ozemail.com.au> wrote in message
······················@ozemail.com.au...
>
> From your unix shell: gcl -compile filename.lsp
>
> From within the gcl interpreter: (compile-file "filename.lsp")
>
> Unlike C binaries, these binaries are not self sufficient. They still
> need gcl to run.
>
> To run:
>
> From your unix shell: gcl -load filename.o
> From within the gcl interpreter: (load "filename.o")
>

If you load some stuff into your system and want a self contained executable
at the end of it:

  (si:save-system "my-program")

For example, the Maxima executable is built like this with GCL:

gcl -batch -eval (let ((argv '())) (declare (ignorable argv)) (progn (load
"../lisp-utils/defsystem.lisp")(funcall (intern "OPERATE-ON-SYSTEM" :mk)
"maxima" :load :verbose t) (si:save-system "binary-gcl/maxima")) (values))

It is possible to define your own startup function so that you never see a
Lisp prompt (as happens with Maxima), but I don't know the details offhand.

> P.S. - I have not been able to find a "man" page with all the command
> line options for gcl. Have you found one?

I'm not sure about the Unix distributions, but on Windows just open the HTML
system manual from the Windows GCL start menu and look at Section 9.1.  The
same section number applies to the Unix info files which come with GCL I
believe.

Cheers

Mike Thomas