[Ecls-list] Error reporting to slime for c-inline/redirecting gcc output?
Tobias C. Rittweiler
tcr at freebits.de
Thu Mar 18 15:04:04 UTC 2010
Seth Burleigh <seth at tewebs.com> writes:
> I was wondering if it would be possible to somehow communicate the
> errors that occur while compiling a function with inline c. For example,
> when I compile this in slime:
>
> (defun sin (x)
> (ffi:clines "#include <matha.h>")
> (ffi:c-inline (x) (:double) :double "sin(#0)"
> :one-liner t :side-effects t))
>
> I get the following output:
>
> ;;; Compiling (DEFUN SIN ...).
> ;;; Emitting code for SIN.
> ;;; Note:
> ;;; Invoking external command:
> ;;; gcc "-I/usr/local/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> -g -O2 -fPIC -Dlinux -O -w -c "/tmp/ecl-swank-tmpfile-86RG8R.c" -o
> "/tmp/ecl-swank-tmpfile-86RG8R.o"
> ;;;
> ;;; Note:
> ;;; Invoking external command:
> ;;; gcc -o "/tmp/ecl-swank-tmpfile-86RG8R.fas" -L"/usr/local/lib/"
> "/tmp/ecl-swank-tmpfile-86RG8R.o" '-ldb' -shared -lecl -lgmp -ldl
> -lm
>
>
> So, no description of error. However, when I compile on the command
> prompt, I get this:
>
> ;;;
> ;;; Compiling /home/seth/random/t2.lisp.
> ;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
> ;;;
> ;;; Compiling (DEFUN SIN ...).
> ;;; End of Pass 1.
> ;;; Emitting code for SIN.
> ;;; Note:
> ;;; Invoking external command:
> ;;; gcc "-I/usr/local/include/" -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> -g -O2 -fPIC -Dlinux -O -w -c "/home/seth/random/t2.c" -o
> "/home/seth/random/t2.o"
> In file included from /home/seth/random/t2.c:6:
> /home/seth/random/t2.h:7:19: error: mathd.h: No such file or directory
> ;;;
> ;;; Internal error:
> ;;; ** (SYSTEM "gcc \"-I/usr/local/include/\" -D_GNU_SOURCE
> -D_FILE_OFFSET_BITS=64 -g -O2 -fPIC -Dlinux -O -w -c
> \"/home/seth/random/t2.c\" -o \"/home/seth/random/t2.o\"") returned
> non-zero value 1
> NIL
> NIL
> NIL
>
> If you'll notice, the error: mathd.h output is in purple, so I believe
> it is outputed by the gcc compiler.
>
>
>
> Is there any way to 'capture' this output and send it over to slime
> along with everything else? This would be tremendously helpful for
> debugging.
Put
(setf swank:*globally-redirect-io* t)
into your ~/.swank.lisp
However, that will make show all output from the inferior-lisp buffer to
the slime-repl buffer -- i.e. rendering *inferior-lisp* pretty much
useless. Usually, that's no problem though.
Juanjo: Doess ECL just invoke gcc which then prints to stdout/stderr, or
does ECL actually slurp gcc's output into a Lisp stream?
-T.
More information about the ecl-devel
mailing list