[Ecls-list] ecl include and library directories

Nils Bruin nbruin at cecm.sfu.ca
Sun May 22 08:28:35 UTC 2011


I am having some trouble with figuring out the default choices of the 
values of some of the paths used by the ECL compiler.

I have a fairly vanilla install of ecl, where I think that at least the 
relative positions of the installed files concerning ecl are typical. I 
find:

> (translate-logical-pathname "SYS:")
#P"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/ecl/"
> (require 'cmp)
;;; Loading #P"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/ecl/cmp.fas"
("CMP")
> c::*ecl-library-directory*
"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/"
> (c::ecl-library-directory)
"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/"

This indicates that the value of c::*ecl-library-directory* was vetted and 
found correct. This was done by the test:

   (probe-file (merge-pathnames (compile-file-pathname "ecl" :type
                                             #+dlopen :shared-library
                                             #-dlopen :static-library)
                                            c::*ecl-library-directory*))

which succeeds with

#P"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/libecl.so.11.1.1"

However, if I do

> (setf c::*ecl-library-directory* nil)
> (c::ecl-library-directory)
"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/ecl/"
> c::*ecl-library-directory*
"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/ecl/"

I see the system has cooked up another default, namely the directory for 
which (probe-file "SYS:BUILD-STAMP") succeeds. However, the file libecl.so 
does not reside there!

This means that c::ecl-library-directory, when presented with a value of 
c::*ecl-library-directory* it thinks is invalid, overwrites it with a 
value that is also invalid by its earlier criterion! That's probably not 
as intended.

Shouldn't the value be initialized to the following ?

(namestring (make-pathname :directory (butlast (pathname-directory
                               (translate-logical-pathname "SYS:")))))

A similar story applies to cc:ecl-include-directory:
> (c::ecl-include-directory)
"/mnt/usb1/scratch/nbruin/4.6.2/local/include/"

which was approved because the following succeeds:

> (probe-file (merge-pathnames "ecl/config.h" c::*ecl-include-directory*))
#P"/mnt/usb1/scratch/nbruin/4.6.2/local/include/ecl/config.h"

Should that fail, then the routine tries if "SYS:" would be a reasonable 
candidate via

> (probe-file "SYS:ecl;config.h")
NIL

I don't think that will succeed in any sane installation. The value that 
would probably be OK is "SYS:..;..;include", given that:

> (probe-file "SYS:..;..;include;ecl;config.h")
#P"/mnt/usb1/scratch/nbruin/4.6.2/local/lib/ecl-11.1.1/../../include/ecl/config.h"

so probably the thing to try would be:

(namestring (make-pathname :directory (append (butlast (pathname-directory 
(translate-logical-pathname "SYS:")) 2) '("include"))))

Most of this doesn't normally matter because ECL captures reasonable 
default values for *ecl-library-directory* and *ecl-include-directory* at 
build-time.

However, would you be interested in using reasonable defaults derived from 
runtime information (being "SYS:") instead? It would mean that ECL 
continues to work if its installation is moved after build, as long as the 
relative position of headers and libraries is as usual.

Best wishes,

Nils




More information about the ecl-devel mailing list