[Ecls-list] compiler flags for external libraries

Robert Lehr bozzio at the-lehrs.com
Fri Nov 21 18:10:04 UTC 2003


A couple questions about compiling against external libraries.

First, has it been done with ECL?  If so, what is the usual method?  I
accomplished this by modifying the exported c:*cc*.

    (eval-when (:compile-toplevel)
      (setq c:*cc*
        (format nil "~A ~A" c:*cc*
		" -I/usr/include/my-lib -Wl,-L/usr/lib/mylib -Wl,-lmylib")))

But this is a hack.  After all, there is a *cc-flags* variable, which is the
variable usually used for this purpose.  This fails...

    (eval-when (:compile-toplevel)
      (setq c:*cc-flags*
        (format nil "~A ~A" c:*cc-flags*
		" -I/usr/include/my-lib -Wl,-L/usr/lib/mylib -Wl,-lmylib")))

...with the following error message.

    > :cf my-lisp-file
    ;;; Compiling my-lisp-file.Cannot find the external symbol *CC-FLAGS* in #<"C" package>.
    Broken at EVAL.

If there currently is no means of specifying header and library paths and
libraries then I want to change the compiler code to avail the *cc-flags* to
enable me to do this.

The second matter concerns current scope during compilation.  These two forms
fail...

(eval-when (:compile-toplevel)
  (in-package :c)
  (setq *cc*
	(format nil "~A ~A" *cc*
		" -I/usr/include/my-lib -Wl,-L/usr/lib/mylib -Wl,-lmylib")))

...with this error message.

    > :cf my-lisp-file
    ;;; Compiling my-lisp-file.
    ;;; Compiling (EVAL-WHEN (:COMPILE-TOPLEVEL) ...).
    The variable COMMON-LISP-USER::*CC* is unbound.
    Broken at EVAL.

That does not seem right to me.  Is that correct?  If so then then why?

Then, there are those  messages that continue on the same lines.  

-- 

Robert Lehr
bozzio at the-lehrs.com




More information about the ecl-devel mailing list