[Ecls-list] Cannot set compiler flags for compile-file

szergling senatorzergling at gmail.com
Fri Jan 15 02:16:42 UTC 2010

Hi folks,

Firstly, I understand that I am messing with unpublished API, and
deserve all the trouble I got :) But if anyone has any tips on going
forward in the direction I'm stumbled into, please provide some

I am having trouble on my (slightly funny and older) ECL trying to get
compile-file (fiddling with the compiler flags) to work.

Here's an example file:

(print "Hello")
;; (quit)

Here's me trying to compile the example file. I've kept the
intermediate .c, .h and data files just to confirm that they exist.

CL-USER> (trace compile-file)
CL-USER> (compile-file "/arpa/tz/t/tyc20/lisp/ecl-hello/hello.lisp"
:c-file t :h-file t :data-file t)
1> (COMPILE-FILE "/arpa/tz/t/tyc20/lisp/ecl-hello/hello.lisp" :C-FILE
;;; Compiling /arpa/tz/t/tyc20/lisp/ecl-hello/hello.lisp.
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=3
;;; End of Pass 1.
;;; Note: Invoking external command:
;;;   cc -I/usr/pkg/include -O2 -mieee -I/usr/pkg/include -mieee -fPIC
 -Dnetbsd -O "-I/arpa/tz/t/tyc20/lisp/imp/ecl/include/" -w -c
"/arpa/tz/t/tyc20/lisp/ecl-hello/hello.c" -o
;;; Note: Invoking external command:
;;;   cc -o "/arpa/tz/t/tyc20/lisp/ecl-hello/hello.fas"
"/arpa/tz/t/tyc20/lisp/ecl-hello/hello.o"  -shared -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib  -lecl   -lm
-lgc -lgmp
;;; (SYSTEM "cc -o \"/arpa/tz/t/tyc20/lisp/ecl-hello/hello.fas\"
\"/arpa/tz/t/tyc20/lisp/ecl-hello/hello.o\"  -shared -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib  -lecl   -lm
-lgc -lgmp") returned non-zero value 1

What seems to be going wrong, is that some compiler flags/options
don't seem to reflect what I needed, even though I think I have them
set to the right values. Here's how I've set them up:

(setf c::*ecl-include-directory* #P"/arpa/tz/t/tyc20/lisp/imp/ecl/include/")
(setf c::*ecl-library-directory* #P"/arpa/tz/t/tyc20/lisp/imp/ecl/lib")
(setf c::*ld-flags* "-L/arpa/tz/t/tyc20/lisp/imp/ecl/lib
-Wl,-R/arpa/tz/t/tyc20/lisp/imp/ecl/lib -lecl -lm -lgc -lgmp")
(setf c::*ld-shared-flags* "-shared
-Wl,-R/arpa/tz/t/tyc20/lisp/imp/ecl/lib -lecl -lm -lgc -lgmp")

It feels to me like some of those flags cannot be changed (hard coded
in some way). I also think some functions have been inlined because I
couldn't trace them (eg C::SHARED-CC, C::BUNDLE-EXTRA-FLAGS, or
C::BUNDLE-CC), with the exception of COMPILE-FILE as seen above.

Not sure what other information I can provide to help, but here's how
I run ECL. I initially got my the ECL binary from


I don't know the configure options. The binary has not been installed
using pkgsrc or what not, and sits as is in my ~/lisp/imp/ecl
directory. I don't know how all that packaging stuff works, and
probably don't have the right permissions anyway. For completeness, I
have tried to show as much as possible below, but I'm not sure what is
useful, so if there is any other information I can help with, do ask.

How I run ECL:

export ECL_PATH=/arpa/tz/t/tyc20/lisp/imp/ecl

$ECL_PATH/lib/ecl-8.12.0/ -eval '(progn (load
"/arpa/tz/t/tyc20/lisp/libs/slime/swank-loader.lisp") (funcall (intern
"INIT" :swank-loader)))'

Directory structure:

~/lisp/imp/ecl $ pwd
~/lisp/imp/ecl $ ls
+BUILD_INFO    +CONTENTS      +INSTALL       bin            lib
+BUILD_VERSION +DEINSTALL     +SIZE_ALL      ecl-8.12.0.tgz
+COMMENT       +DESC          +SIZE_PKG      include
~/lisp/imp/ecl $ ls -l bin
total 20
-r-xr-xr-x  1 tyc20  arpa  7528 Apr 22  2009 ecl
-r-xr-xr-x  1 tyc20  arpa   646 Apr 22  2009 ecl-config
~/lisp/imp/ecl $ ls -l lib/ecl-8.12.0/
total 4740
-r--r--r--  1 tyc20  arpa     511 Apr 22  2009 BUILD-STAMP
-r-xr-xr-x  1 tyc20  arpa  156056 Apr 22  2009 asdf.fas
-r-xr-xr-x  1 tyc20  arpa  812640 Apr 22  2009 cmp.fas
-r-xr-xr-x  1 tyc20  arpa  170840 Apr 22  2009 defsystem.fas
-r--r--r--  1 tyc20  arpa   89903 Apr 22  2009 dpp
-r--r--r--  1 tyc20  arpa  698173 Apr 22  2009 ecl_min
-r--r--r--  1 tyc20  arpa  186542 Apr 22  2009 help.doc
-r-xr-xr-x  1 tyc20  arpa   40496 Apr 22  2009 profile.fas
-r-xr-xr-x  1 tyc20  arpa   30560 Apr 22  2009 rt.fas
-r-xr-xr-x  1 tyc20  arpa   22800 Apr 22  2009 serve-event.fas
-r-xr-xr-x  1 tyc20  arpa   97096 Apr 22  2009 sockets.fas
-r--r--r--  1 tyc20  arpa   64460 Apr 22  2009 sysfun.lsp
~/lisp/imp/ecl $ ls -l lib
total 3716
drwx------  2 tyc20  arpa      512 Dec  2 21:50 ecl-8.12.0
lrwx------  1 tyc20  arpa       16 Apr 22  2009 libecl.so -> libecl.so.8.12.0
lrwx------  1 tyc20  arpa       16 Apr 22  2009 libecl.so.8 -> libecl.so.8.12.0
lrwx------  1 tyc20  arpa       16 Apr 22  2009 libecl.so.8.12 ->
-r-xr-xr-x  1 tyc20  arpa  1875048 Apr 22  2009 libecl.so.8.12.0
lrwx------  1 tyc20  arpa       26 Jan  6 22:22 libgc.so ->
lrwx------  1 tyc20  arpa       28 Jan  6 22:24 libgmp.so ->
lrwx------  1 tyc20  arpa       16 Jan  6 22:28 libm.so -> /usr/lib/libm.so

The libgc.so, libgmp.so, and libm.so links were added by me, and point
to libraries I downloaded manually. Yes, this is all very painful :)

Additional info on my OS, etc:

~/lisp/imp/ecl $ uname -a
NetBSD otaku 4.0.1_PATCH NetBSD 4.0.1_PATCH (sdf) #0: Sun Dec 27
18:44:24 UTC 2009
root at iceland:/var/netbsd/src/sys/arch/alpha/compile/sdf alpha

CL-USER> *features*
CL-USER> (lisp-implementation-version)
"8.12.0 (CVS 2008-07-12 18:54)"
CL-USER> (list c::*cc-flags* c::*ld-flags* c::*ld-shared-flags*
               c::*ecl-include-directory* c::*ecl-library-directory*)
("-I/usr/pkg/include -O2 -mieee -I/usr/pkg/include -mieee -fPIC  -Dnetbsd"
-Wl,-R/arpa/tz/t/tyc20/lisp/imp/ecl/lib -lecl -lm -lgc -lgmp"
 "-shared -L/arpa/tz/t/tyc20/lisp/imp/ecl/lib
-Wl,-R/arpa/tz/t/tyc20/lisp/imp/ecl/lib -lecl -lm -lgc -lgmp"

Here's another funny thing I just noticed:

After the appropriate setf to *ecl-library-directory*:

CL-USER> c::*ecl-library-directory*
CL-USER> (compile-file "/arpa/tz/t/tyc20/lisp/ecl-hello/hello.lisp"
:c-file t :h-file t :\
data-file t)


;;;   cc -o "/arpa/tz/t/tyc20/lisp/ecl-hello/hello.fas"
"/arpa/tz/t/tyc20/lisp/ecl-hello/hello.o"  -shared -L/usr/pkg/lib
-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -Wl,-R/usr/pkg/lib  -lecl   -lm
-lgc -lgmp


CL-USER> c::*ecl-library-directory*

The library directory is only initialisable at startup time with the -dir from
the looks of it.

It looks like my problems might be related to the issue faced by Andy
Hefner in his 2010-01-07 email. Any help would be appreciated, thanks!

Theam Yong Chew.

More information about the ecl-devel mailing list