Subject: [clisp-list] catch 22 compiling clisp for maxima

From: Sam Halliday <[email-masked]>
Date: Fri Jul 4 16:38:09 2003

hello there,

i have found myself in a bit of a catch 22 with regards installing
clisp.

i have gcc-3.2.3 on GNU/Linux and wish to compile clisp so that i can
use the maxima symbolic math package; they recommend (from
http://glue.umd.edu/~milgram/maxima/faq.html#Lisp0)

  There are currently unresolved problems with floating
  point numbers in Maxima with clisp 2.30. 2.29 is recommended.

so i got 2.29 and tried to compile it... lots of compile errors, so i
thought "bugger it, ill just get 2.30 and hope all is well with mild
compile flags..."

i compiled clisp-2.30 with

 ./configure --with-readline --with-dynamic-ffi \
             --with-dynamic-modules --with-export-syscalls \
             --with-module=regexp --without-debug \
             --build mysrc

and sure enough, the make check failed on several floating point related
tests:

  cat mysrc/suite/*.erg
########################
Form: (TEST-POS-EPSILON DOUBLE-FLOAT-EPSILON)
CORRECT: T
CLISP: NIL

Form: (TEST-NEG-EPSILON DOUBLE-FLOAT-NEGATIVE-EPSILON)
CORRECT: T
CLISP: NIL

Form: (CHECK-EPS DOUBLE-FLOAT-EPSILON #'TEST-POS-EPSILON)
CORRECT: T
CLISP: NIL

Form: (CHECK-EPS DOUBLE-FLOAT-NEGATIVE-EPSILON #'TEST-NEG-EPSILON)
CORRECT: T
CLISP: NIL
########################

so i seen bug 726433 and realised i already was trying the workaround
(not using debugging), so no help there then. thinking this might be a
gcc bug, i tried passing "CC="/path/to/my/old/gcc" ./configure ...", but
the configure script is not able to handle that and thinks my older
gcc-2.95.3 cannot make executables (i know it can). i also tried the
build without any of those configure options.

i then downloaded the CVS version from today, and got THIS
########################
0 errors, 0 warnings
cmp -s init.fas stage/init.fas  || (echo "Test failed." ; exit 1)
cmp -s defseq.fas stage/defseq.fas  || (echo "Test failed." ; exit 1)
cmp -s backquote.fas stage/backquote.fas  || (echo "Test failed." ; exit
1)
cmp -s defmacro.fas stage/defmacro.fas  || (echo "Test failed." ; exit
1)
cmp -s macros1.fas stage/macros1.fas  || (echo "Test failed." ; exit 1)
cmp -s macros2.fas stage/macros2.fas  || (echo "Test failed." ; exit 1)
cmp -s defs1.fas stage/defs1.fas  || (echo "Test failed." ; exit 1)
cmp -s timezone.fas stage/timezone.fas  || (echo "Test failed." ; exit
1)
cmp -s places.fas stage/places.fas  || (echo "Test failed." ; exit 1)
cmp -s floatprint.fas stage/floatprint.fas  || (echo "Test failed." ;
exit 1)
cmp -s type.fas stage/type.fas  || (echo "Test failed." ; exit 1)
cmp -s defstruct.fas stage/defstruct.fas  || (echo "Test failed." ; exit
1)
cmp -s format.fas stage/format.fas  || (echo "Test failed." ; exit 1)
Test failed.
make: *** [test] Error 1
########################

and since the alternative lisp compiler (gcl) has the most immense
dependency list ever (which i am not willing to satisfy), i am stuck
with several source tarballs of clisp which are either not able to
compile, or run maxima. does anyone have a patch (against clisp-2.30 or
gcc-3.2.3) which fixes this floating point business? if there is an easy
fix, can i suggest maybe a bugfix release?

two last compile-related things... i also got a build fail if i wanted
to build the wildcard module, newer glibc versions dont seem to like the
_GLIBC macro being defined. [why should i be building this module if my
c library already has wildcard anyway? same goes for regex]. and the
bindings/linuxlibc6 module build fails as errno.h needs to be included
in some places. i tried hacking a build with CC="$CC -include errno.h"
but that broke some of the rest of the clisp compile.

cheers,
Sam
-- 
ADA:
Something you need only know the name of to be an Expert in Computing. 
Useful in sentences like, "We had better develop an ADA awareness.
-- "Datamation", January 15, 1984

---

From: Sam Steingold <[email-masked]>
Date: Sun Jul 6 17:20:12 2003

> * In message <[email-masked]>
> * On the subject of "[clisp-list] catch 22 compiling clisp for maxima"
> * Sent on Sat, 5 Jul 2003 00:37:58 +0100
> * Honorable Sam Halliday <[email-masked]> writes:
>

this is a known issue - Kaz Kylheku is working on it.
type "make testsuite" and it will work.
you can safely ignore it.

> [why should i be building this module if my c library already has
> wildcard anyway? same goes for regex]

not everyone is running glibc.
it would have been nice if the configuration process for regexp and
wildcard detected that the necessary functionality if available in
libc - patches are welcome.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Small languages require big programs, large languages enable small programs.

---

From: Sam Halliday <[email-masked]>
Date: Mon Jul 7 02:21:18 2003

Sam Steingold wrote:
> > cmp -s format.fas stage/format.fas  || (echo "Test failed." ; exit
> > 1) Test failed.
> > make: *** [test] Error 1
(PROGN (DEF-CALL-OUT C-SELF (:NAME "ffi_identity") (:ARGUMENTS (FIRST
(C-UNION (C1 (C-PTR CHARACTER)) (S (C-ARRAY-PTR CHARACTER)))) (OBJ
(C-PTR (C-UNION (C CHARACTER) (B BOOLEAN) (P C-POINTER))) :IN-OUT))
(:RETURN-TYPE (C-PTR CHARACTER)) (:LANGUAGE :STDC)) (MULTIPLE-VALUE-LIST
(C-SELF #\w #\j)))
make[1]: *** [tests] Segmentation fault (core dumped)
make[1]: Leaving directory `/home/LFS/TODO/maxima/clisp/src/suite'

hmm... seems i am back to that good 'ol catch22

does anyone remember which patch fixed the 2.30 floating point issues?
thats really all i'm after, since i feel a little odd using a math
package which i know is compiled by a lisp with dodgy floating points...
i am putting off installing maxima until i get a stable clisp

cheers,
Sam

---

From: Sam Steingold <[email-masked]>
Date: Mon Jul 7 07:04:12 2003

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] catch 22 compiling clisp for maxima"
> * Sent on Mon, 7 Jul 2003 10:20:28 +0100

This is FFI, it should not concern you either.
Joerg Hoehle is working on this.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Let us remember that ours is a nation of lawyers and order.

---

From: Sam Steingold <[email-masked]>
Date: Tue Jul 8 12:12:22 2003

> cmp -s format.fas stage/format.fas  || (echo "Test failed." ; exit 1)

I think I fixed this in the CVS.
Please try again.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
Our business is run on trust.  We trust you will pay in advance.

---

From: Sam Halliday <[email-masked]>
Date: Tue Jul 8 12:16:48 2003

> I think I fixed this in the CVS.

sorry...

is it just me, or are the sourceforge cvs servers always stressed to
their limits? i got about 10 "end of file from server" messages on login
as anonymous. on savannah, ive never had this; as either anonymous or as
a user.

how stable is cvs compared with clisp-2.30? ive looked through the
archives to try and find a fix for the floating point issues in 2.30 (i
am assuming they have been fixed?), but haven't been able to come across
them.. does anyone have any pointers?

cheers,
Sam

---

From: Sam Steingold <[email-masked]>
Date: Tue Jul 8 12:53:23 2003

> * In message <[email-masked]>
> * On the subject of "Re: catch 22 compiling clisp for maxima"
> * Sent on Tue, 8 Jul 2003 20:06:34 +0100

try within 24 hours:

On 2003-06-13, changes were made to ViewCVS access and pserver CVS access.
pserver-based CVS access from this host (the project shell server) will not
be changed.  pserver-based CVS access from other hosts and ViewCVS access
will now work against data on the backup CVS server (this is a transparent
change and does not require any configuration changes on your part), as to
reduce load on the primary CVS server and improve the performance of
developer CVS access.  Data on the backup CVS server is roughly 24 hours
old, between sync runs.  This change is temporary and is expected to be
reverted in August.  See the Site Status page on SourceForge.net for details.

> their limits? i got about 10 "end of file from server" messages on
> login as anonymous. on savannah, ive never had this; as either
> anonymous or as a user.

see also
<http://sourceforge.net/docman/display_doc.php?docid=2352&group_id=1>

you can also look at <ftp://cvs2.cons.org/pub/lisp/clisp/snapshots>
or try the appended patch.

> how stable is cvs compared with clisp-2.30?

pretty stable.  AFAICT, everything that runs on clisp-2.30 or clisp-2.29
will run on CVS head as well.

the reason it is not released is that some new features have not been
quite polished yet.  see <http://clisp.cons.org/wanted.html>.

the FFI regression crash you observe is due to the new test that
uncovers an old problem - which needs to be fixed, of course.

-- 
Sam Steingold (http://www.podval.org/~sds) running w2k
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
In the race between idiot-proof software and idiots, the idiots are winning.

Index: compiler.lisp
===================================================================
RCS file: /cvsroot/clisp/clisp/src/compiler.lisp,v
retrieving revision 1.125
retrieving revision 1.126
diff -u -w -b -u -b -w -i -B -r1.125 -r1.126
--- compiler.lisp	14 May 2003 19:52:06 -0000	1.125
+++ compiler.lisp	8 Jul 2003 18:39:01 -0000	1.126
@@ -6462,7 +6462,7 @@
   (let ((erg (gensym)) (tail (gensym))
         (blockname (gensym))
         (restvars (gensym-list forms))
-        (tag (gensym)))
+        (tag (gensym)) (tmp (gensym)))
     `(LET ((,erg NIL)
            ,@(case adjoin-fun ((CONS)) ((NCONC APPEND) `((,tail nil)))))
        (BLOCK ,blockname
@@ -6476,20 +6476,17 @@
                                                ,erg))))
                  ((NCONC)
                   #'(lambda (itemvars)
-                      `(if (consp ,erg)
-                           (setf ,tail (last ,tail)
-                                 (cdr ,tail) (FUNCALL ,funform ,@itemvars))
-                           (setq ,erg (FUNCALL ,funform ,@itemvars)
-                                 ,tail ,erg))))
+                      `(let ((,tmp (FUNCALL ,funform ,@itemvars)))
+                         (if (consp ,erg)
+                           (setf ,tail (last ,tail) (cdr ,tail) ,tmp)
+                           (setq ,erg ,tmp ,tail ,erg)))))
                  ((APPEND)
                   #'(lambda (itemvars)
-                      `(if (consp ,erg)
-                           (setf ,tail (last ,tail)
-                                 (cdr ,tail) (copy-list-lax
-                                              (FUNCALL ,funform ,@itemvars)))
-                           (setq ,erg (copy-list-lax
-                                       (FUNCALL ,funform ,@itemvars))
-                                 ,tail ,erg)))))
+                      `(let ((,tmp (copy-list-lax
+                                    (FUNCALL ,funform ,@itemvars))))
+                         (if (consp ,erg)
+                           (setf ,tail (last ,tail) (cdr ,tail) ,tmp)
+                           (setq ,erg ,tmp ,tail ,erg))))))
                blockname
                restvars)
              (SETQ ,@(shift-vars restvars))
@@ -6503,7 +6500,7 @@
   (let ((erg (gensym)) (tail (gensym))
         (blockname (gensym))
         (restvars (gensym-list forms))
-        (tag (gensym)))
+        (tag (gensym)) (tmp (gensym)))
     `(LET ((,erg NIL)
            ,@(case adjoin-fun ((CONS)) ((NCONC APPEND) `((,tail nil)))))
        (BLOCK ,blockname
@@ -6515,18 +6512,15 @@
                ((CONS)
                 `(SETQ ,erg (,adjoin-fun (FUNCALL ,funform ,@restvars) ,erg)))
                ((NCONC)
-                `(if (consp ,erg)
-                     (setf ,tail (last ,tail)
-                           (cdr ,tail) (FUNCALL ,funform ,@restvars))
-                     (setq ,erg (FUNCALL ,funform ,@restvars)
-                           ,tail ,erg)))
+                `(let ((,tmp (FUNCALL ,funform ,@restvars)))
+                   (if (consp ,erg)
+                     (setf ,tail (last ,tail) (cdr ,tail) ,tmp)
+                     (setq ,erg ,tmp ,tail ,erg))))
                ((APPEND)
-                `(if (consp ,erg)
-                     (setf ,tail (last ,tail)
-                           (cdr ,tail) (copy-list-lax
-                                        (FUNCALL ,funform ,@restvars)))
-                     (setq ,erg (copy-list-lax (FUNCALL ,funform ,@restvars))
-                           ,tail ,erg))))
+                `(let ((,tmp (copy-list-lax (FUNCALL ,funform ,@restvars))))
+                   (if (consp ,erg)
+                     (setf ,tail (last ,tail) (cdr ,tail) ,tmp)
+                     (setq ,erg ,tmp ,tail ,erg)))))
              (SETQ ,@(shift-vars restvars))
              (GO ,tag))))
        ,(case adjoin-fun

---

From: Sam Halliday <[email-masked]>
Date: Tue Jul 8 14:04:23 2003

> On 2003-06-13, changes were made to ViewCVS access and pserver CVS
<snip>
thanks for the info! it explains a lot...

> try the appended patch.
thanks! the patch fixed the first test problem, leaving the `make
testsuite` segfault (the FFI issue) to be the end of the compile.

> pretty stable.  AFAICT, everything that runs on clisp-2.30 or
> clisp-2.29 will run on CVS head as well.
> 

thats great! now i can go on to learning maxima, and maybe see about
helping out there. since i started using emacs lisp has really grown on
me...

cheers,
Sam
-- 
The hardest thing is to disguise your feelings when you put a lot of
relatives on the train for home.