Subject: [clisp-list] Trying to build with syscalls support

From: "Thomas F. Burdick" <[email-masked]>
Date: Mon Oct 27 17:21:14 2003

I'm trying to compile a clisp with the syscalls module, so I can use
posix:stream-lock instead of the gross hack I currently use, but
compiling 2.31 on Linux/x86 dies.  I must be doing something wrong,
because I'd imagine this would be the most tested platform.

It dies here:

  myclient@work-machine:/tmp/build/clisp-2.31 > uname -a
  Linux work-machine 2.4.4-64GB-SMP #1 SMP Fri May 18 14:54:08 GMT 2001 i686 unknown
  myclient@work-machine:/tmp/build/clisp-2.31 > gcc --version
  2.95.3
  myclient@work-machine:/tmp/build/clisp-2.31 > ./configure --prefix="/home/myclient/clisp-2.31" --with-module=syscalls --with-export-syscalls --build build-myclient

...

  calls.c: In function `C_subr_posix_file_stat':
  calls.c:553: parse error before `file'
  calls.c:556: `file' undeclared (first use in this function)
  calls.c:556: (Each undeclared identifier is reported only once
  calls.c:556: for each function it appears in.)
  calls.c:557: warning: left-hand operand of comma expression has no effect
  calls.c:561: `buf' undeclared (first use in this function)
  calls.c:578: warning: left-hand operand of comma expression has no effect
  make[1]: *** [calls.o] Error 1
  make[1]: Leaving directory `/tmp/build/clisp-2.31/build-myclient/syscalls'
  make: *** [syscalls] Error 2

-- 
           /|_     .-----------------------.                        
         ,'  .\  / | No to Imperialist war |                        
     ,--'    _,'   | Wage class war!       |                        
    /       /      `-----------------------'                        
   (   -.  |                               
   |     ) |                               
  (`-.  '--.)                              
   `. )----'

---

From: Sam Steingold <[email-masked]>
Date: Tue Oct 28 04:58:26 2003

> * Thomas F. Burdick <[email-masked]> [2003-10-27 17:19:25 -0800]:
>

indeed...

>   make: *** [syscalls] Error 2

I bet your GCC is not 3 (i.e., not C99).
Sorry.
Please try the appended patch.

-- 
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.honestreporting.com>
Only a fool has no doubts.

--- calls.c.~1.12.~	2003-10-02 10:40:04.050878700 -0400
+++ calls.c	2003-10-28 07:54:28.967264600 -0500
@@ -549,8 +549,8 @@
 { /* Lisp interface to stat(2), lstat(2) and fstat(2)
  the first arg can be: file stream, pathname, string, symbol, number.
  the return value is the FILE-STAT structure */
-  bool link_p = missingp(STACK_0); skipSTACK(1);
-  object file = popSTACK();
+  bool link_p = missingp(STACK_0);
+  object file = (skipSTACK(1), popSTACK());
   struct stat buf;
 
   if (builtin_stream_p(file)) {

---

From: "Thomas F. Burdick" <[email-masked]>
Date: Tue Oct 28 15:29:27 2003

Thomas F. Burdick writes:
 > posix:stream-lock instead of the gross hack I currently use,

Hmm, when I built clisp with the following command line:

  ./configure --prefix="/home/myclient/clisp-2.31" --with-module=syscalls --with-export-syscalls --build build-myclient

and I load the resulting CLISP, I don't see the syscalls module, nor a
POSIX package.

---

From: "Thomas F. Burdick" <[email-masked]>
Date: Tue Oct 28 15:29:31 2003

> I bet your GCC is not 3 (i.e., not C99).

Nope, it's 2.95

 > Please try the appended patch.

Thanks, that almost does it.  After applying that patch, the compiler
complained that clisp.h was declaring a global variable after a
function definition, when it was included from calls.c.  With the
appended patch, it compiles all the way, and the produced clisp seems
to kind-of work.

Actually, it dies in "make testsuite" with a segfault on this test:
(LET ((H (MAKE-HASH-TABLE :TEST `(,(LAMBDA (A B) (LIST (LIST '= A B)) (= A B)) . ,(LAMBDA (X) (LET ((Z (SXHASH (COERCE X 'DOUBLE-FLOAT)))) (LIST `((HASH ,X) => ,Z)) Z)))))) (LOOP :FOR I :FROM 0 :TO 1000 :DO (SETF (GETHASH I H) (FORMAT NIL "~r" I))) (LOOP :FOR I :FROM 0 :TO 1000 :UNLESS (STRING= (GETHASH (FLOAT I 1.0d0) H) (GETHASH (FLOAT I 1.0s0) H)) :COLLECT I)) make[1]: *** [tests] Segmentation fault

The non-syscalls build fails here, cleanly:
(IF *NO-ICONV-P* "AZ" (CONVERT-STRING-FROM-BYTES '#(255 254 65 0 13) (MAKE-ENCODING :CHARSET "utf-16" :INPUT-ERROR-ACTION #\Z))) 
ERROR!! "
*** - Character #\uFEFF cannot be represented in the character set CHARSET:ISO-8859-1

I'm a little uncomfortable with the resulting build, but I'll try
testing the actual application with it.

--- syscalls/calls-orig.c       Tue Oct 28 09:42:18 2003
+++ syscalls/calls.c    Tue Oct 28 09:42:46 2003
@@ -5,6 +5,7 @@
  */
 
 #include "config.h"
+#include "clisp.h"
 
 #if defined(TIME_WITH_SYS_TIME)
 # include <sys/time.h>
@@ -39,8 +40,6 @@
 # define UNIX_CYGWIN32
 # undef UNICODE
 #endif
-
-#include "clisp.h"
 
 /* #define DEBUG */
 #if defined(DEBUG)

---

From: "Thomas F. Burdick" <[email-masked]>
Date: Tue Oct 28 16:25:26 2003

Nope, it's 2.95

 
 #include "config.h"
+#include "clisp.h"

 /* #define DEBUG */
 #if defined(DEBUG)

---

From: Sam Steingold <[email-masked]>
Date: Wed Oct 29 06:01:07 2003

> * Thomas F. Burdick <[email-masked]> [2003-10-28 10:43:46 -0800]:
>

--with-export-syscalls is obsolete and ignored.

to use syscalls, you need to run the "full" linking set:

clisp -K full

-- 
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.honestreporting.com>
usually: can't pay ==> don't buy. software: can't buy ==> don't pay

---

From: Sam Steingold <[email-masked]>
Date: Wed Oct 29 06:07:02 2003

> * Thomas F. Burdick <[email-masked]> [2003-10-28 16:23:55 -0800]:
>

what is the function?
what is the variable?

> (LET ((H (MAKE-HASH-TABLE :TEST `(,(LAMBDA (A B) (LIST (LIST '= A B)) (= A B)) . ,(LAMBDA (X) (LET ((Z (SXHASH (COERCE X 'DOUBLE-FLOAT)))) (LIST `((HASH ,X) => ,Z)) Z)))))) (LOOP :FOR I :FROM 0 :TO…

ignore.

> *** - Character #\uFEFF cannot be represented in the character set CHARSET:ISO-8859-1

please try the appended patch for tests/Makefile

> +++ syscalls/calls.c    Tue Oct 28 09:42:46 2003

"clisp.h" has to be included after UNIX_CYGWIN32 has been defined and
UNICODE undefined.

-- 
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.honestreporting.com>
Lottery is a tax on statistics ignorants.  MS is a tax on computer-idiots.

--- Makefile.~1.12.~	2003-10-09 18:17:30.116326800 -0400
+++ Makefile	2003-10-29 09:02:34.735080300 -0500
@@ -6,7 +6,7 @@
 # executable extension (.exe on win32, .run everywhere else)
 LEXE=.run
 
-LISP=$(BD)/lisp$(LEXE) -norc -B $(BD) -M $(BD)/lispinit.mem
+LISP=$(BD)/lisp$(LEXE) -E utf-8 -norc -B $(BD) -M $(BD)/lispinit.mem
 # LISP=../clisp -norc
 # LISP=clisp -norc