[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gcl-devel] gcl compiler problem

From: Peter Wood
Subject: Re: [Gcl-devel] gcl compiler problem
Date: Wed, 5 Feb 2003 13:34:53 +0100
User-agent: Mutt/1.4i

On Tue, Feb 04, 2003 at 11:52:39PM +0100, Jean-baptiste Couturier wrote:
> Hello,
> Firtly, you must know that i'm newbie with gcl. (& I wish it's the good 
> place to ask my question)
> I try to make a platform dependant executable file using my lisp program 
> but i've compilation error. Using "gcl -compile myprog" i obtain 
> myprog.o (an elf32-i386 according to objdump) but i can't run it (bash: 
> ./myprog.o: cannot execute binary file).
> example:
> test.lsp:
> ----------
> (print 'hello)
> (jb)prog >gcl -compile test   
> Compiling test.lsp.
> End of Pass 1. 
> End of Pass 2. 
> OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
> Finished compiling test.
> (jb)prog >chmod u+x test.o && ./test.o
> bash: ./test.o: cannot execute binary file
> (jb)prog >objdump -d test.o
> test.o:     format de fichier elf32-i386
> Déassemblage de la section .text:
> 00000000 <init_code>:
>   0:   55                      push   %ebp
>   1:   89 e5                   mov    %esp,%ebp
>   3:   83 ec 08                sub    $0x8,%esp
>   6:   83 c4 f4                add    $0xfffffff4,%esp
>   9:   68 00 00 00 00          push   $0x0
>   e:   e8 fc ff ff ff          call   f <init_code+0xf>
>  13:   c9                      leave 
>  14:   c3                      ret   
>  15:   8d 76 00                lea    0x0(%esi),%esi
> Any help appreciated.
> Cheers!


GCL does not compile 'standalone' executables.  Your program will need
the lisp environment to work.  This means you could do the following:

(progn 'compile (print 'hello) (si::quit))
;      ^^^^^^^^

compile it:

gcl -compile test.lsp

and run it:

gcl -batch -load test.o

This works! :-)

In the form above, the symbol 'compile (marked) causes the compiler to
compile everything to machine code (otherwise normally GCL only
compiles defuns and defmacros to machine code to save space -- in the
disassembly output from your program, only the initialization code is
appearing.  I guess the rest is in the 'data' section -- compare it to
mine which I attach).  The '-batch ' argument on the command line
causes GCL to not print any startup message.

In the html/info documentation which is supplied with GCL, there is a
section entitled 'Operating system' which explains other ways to run
your program (eg as a shell-style script) and provides info on other
useful stuff like accessing command line args etc.

Hope this helps.


Attachment: mydump.txt
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]