Subject: [clisp-list] help with compiling clisp cvs on cygwin

From: "Yadin Y. Goldschmidt" <[email-masked]>
Date: Wed Mar 19 08:29:09 2003

I tried to built clisp on cygwin (Win XP) from the recent cvs. The 
executable builds, but it fails to build the memory image. In particular it 
chokes when loading "type.lisp" with an error message "unix error 2 file 
not found". Is it possible to build clisp on cygwin? There is a compiled 
version of 2.30 on sourceforge but it is from october 1 and it has floating 
point problems that prevent is to be used to compile maxima. The previous 
clisp 2.29 cygwin version has tty problems.
Any hints or help? (BTW I did not instal libsigsegv since it does not work 
on cygwin).

---

From: Sam Steingold <[email-masked]>
Date: Wed Mar 19 10:44:43 2003

> * In message <[email-masked]>
> * On the subject of "[clisp-list] help with compiling clisp cvs on cygwin"
> * Sent on Wed, 19 Mar 2003 11:28:21 -0500
> * Honorable "Yadin Y. Goldschmidt" <[email-masked]> writes:
>
> executable builds, but it fails to build the memory image. In
> particular it chokes when loading "type.lisp" with an error message
> "unix error 2 file not found".

this is probably because of some encoding not being supported on cygwin.
Please try the appended patch and report your experiences here.
Thanks!

> Is it possible to build clisp on cygwin?
Yes!

you could also try building with mingw, i.e.,

$ ./configure --with-mingw --with-export-syscalls --build build-mingw

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
There are 3 kinds of people: those who can count and those who cannot.

--- type.lisp.~1.43.~	2003-03-12 11:37:04.000000000 -0500
+++ type.lisp	2003-03-19 12:59:48.000000000 -0500
@@ -1380,12 +1380,18 @@
   ; Return the definition range of a character set. If necessary, compute it
   ; and store it in the cache.
   (defun get-charset-range (charset &optional maxintervals)
-    (or (gethash charset table)
-        (setf (gethash charset table)
-              (charset-range (make-encoding :charset charset)
-                             (code-char 0) (code-char (1- char-code-limit))
-                             maxintervals
-  ) )   )     )
+    (let ((name (if (encodingp charset) (encoding-charset charset) charset)))
+      (or (gethash name table)
+          (let ((enc (if (encodingp charset) charset
+                         (make-encoding :charset charset
+                                        :if-does-not-exist nil))))
+            (unless enc         ; SHOULD BE AN ERROR!!!
+              (warn "~S: invalid charset ~S" 'get-charset-range charset)
+              (return nil))
+            (setf (gethash name table)
+                  (charset-range enc (code-char 0)
+                                 (code-char (1- char-code-limit))
+                                 maxintervals))))))
   ; Fill the cache, but cache only the results with small lists of intervals.
   ; Some iconv based encodings have large lists of intervals (up to 5844
   ; intervals for ISO-2022-JP-2) which are rarely used and not worth caching.

---

From: "Yadin Y. Goldschmidt" <[email-masked]>
Date: Wed Mar 19 12:39:04 2003

Thank you for your response.
No this patch does not help. However I found that commenting lines 1392-1397
in type.lisp (without the patch ) that read
  ; Fill the cache, but cache only the results with small lists of 
intervals.
  ; Some iconv based encodings have large lists of intervals (up to 5844
  ; intervals for ISO-2022-JP-2) which are rarely used and not worth 
caching.
;;  (do-external-symbols (sym (find-package "CHARSET"))
;;    (let* ((charset (encoding-charset (symbol-value sym)))
;;           (computed-range (get-charset-range charset 100))
;;           (intervals (/ (length computed-range) 2)))
;;      (when (>= intervals 100) (remhash charset table))
;;  ) )

makes type.lisp load. I don't know what exactly these lines do. Now many 
more lisp files were loaded,
but the compilation failed when loading compiler.lisp with signal 11:
;; Loading file defseq.lisp ...
;; Loaded file defseq.lisp
;; Loading file backquote.lisp ...
;; Loaded file backquote.lisp
;; Loading file defmacro.lisp ...
;; Loaded file defmacro.lisp
;; Loading file macros1.lisp ...
;; Loaded file macros1.lisp
;; Loading file macros2.lisp ...
;; Loaded file macros2.lisp
;; Loading file defs1.lisp ...
;; Loaded file defs1.lisp
;; Loading file places.lisp ...
;; Loaded file places.lisp
;; Loading file floatprint.lisp ...
;; Loaded file floatprint.lisp
;; Loading file type.lisp ...
;; Loaded file type.lisp
;; Loading file defstruct.lisp ...
;; Loaded file defstruct.lisp
;; Loading file format.lisp ...
(WARN "~a: redefining ~a ~s in ~a, was defined in ~a" "DEFUN/DEFMACRO" 
"function
" FORMAT #P"/cygdrive/c/temp/clisp/src/format.lisp" "top-level")
;; Loaded file format.lisp
;; Loading file international.lisp ...
;; Loaded file international.lisp
;; Loading file /cygdrive/c/temp/clisp/src/room.lisp ...
;; Loaded file /cygdrive/c/temp/clisp/src/room.lisp
;; Loading file /cygdrive/c/temp/clisp/src/savemem.lisp ...
;; Loaded file /cygdrive/c/temp/clisp/src/savemem.lisp
;; Loading file /cygdrive/c/temp/clisp/src/trace.lisp ...
;; Loaded file /cygdrive/c/temp/clisp/src/trace.lisp
;; Loading file /cygdrive/c/temp/clisp/src/cmacros.lisp ...
;; Loaded file /cygdrive/c/temp/clisp/src/cmacros.lisp
;; Loading file /cygdrive/c/temp/clisp/src/compiler.lisp ...Signal 11
make: *** [interpreted.mem] Error 139

Any more suggestions? Are the lines that I commented important?
TIA, Yadin.

--On Wednesday, March 19, 2003 1:01 PM -0500 Sam Steingold <[email-masked]> 
wrote:r

>> * On the subject of "[clisp-list] help with compiling clisp cvs on
>> cygwin" * Sent on Wed, 19 Mar 2003 11:28:21 -0500
> <http://www.mideasttruth.com/>
> <http://www.palestine-central.com/links.html> There are 3 kinds of
> people: those who can count and those who cannot.
>
>
>    ; Return the definition range of a character set. If necessary,
> compute it    ; and store it in the cache.
> -                             (code-char 0) (code-char (1-
> char-code-limit)) -                             maxintervals
> -  ) )   )     )
> +    (let ((name (if (encodingp charset) (encoding-charset charset)
> charset))) +      (or (gethash name table)
>    ; Fill the cache, but cache only the results with small lists of
> intervals.    ; Some iconv based encodings have large lists of intervals
> (up to 5844    ; intervals for ISO-2022-JP-2) which are rarely used and
> not worth caching.

---

From: Sam Steingold <[email-masked]>
Date: Wed Mar 19 17:23:12 2003

> * In message <[email-masked]>
> * On the subject of "Re: [clisp-list] help with compiling clisp cvs on cygwin"
> * Sent on Wed, 19 Mar 2003 15:38:27 -0500

yes, this confirms my diagnosis.
please _do_ apply the patch (replacing "return" with "return-from
get-charset-range") and see what warning you get.

> Any more suggestions?

1. always build in a separate build directory.
   clean up:
   $ rm -rf src
   $ cvs up src
   and try again:
   $ ./configure <options> build-directory
   this allows you to have several builds with different options and
   guarantees that your builds are clean.

2. try various combinations of CC=g++, --with-debug and --with-mingw:
   $ ./configure --with-debug --build build-g
   $ CC=g++ ./configure --with-debug --build build-g-gxx
   $ ./configure --with-mingw --with-debug --build build-mingw-g
   $ CC=g++ ./configure --with-mingw --with-debug --build build-mingw-g-gxx

   try "gdb -nw" in the build directory.
   unfortunately, I do not have a w32 machine, so I cannot really help
   here&now (I built under cygwin many times in the past though).
   we do have several w32&cygwin gurus here, I hope they will chime in.

> Are the lines that I commented important?
yes, they create some caches.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat8 GNU/Linux
<http://www.camera.org> <http://www.iris.org.il> <http://www.memri.org/>
<http://www.mideasttruth.com/> <http://www.palestine-central.com/links.html>
You can have it good, soon or cheap.  Pick two...

---

From: Arseny Slobodjuck <[email-masked]>
Date: Thu Mar 20 00:21:03 2003

Hello Sam,

>> Is it possible to build clisp on cygwin?
Sam> Yes!
Alas! No! I haven't found the GC error which leads to
SIGSEGV while loading compiler.lisp.

-- 
Best regards,
 Arseny                            mailto:[email-masked]

---

From: Sam Steingold <[email-masked]>
Date: Thu Mar 20 07:27:02 2003

> * In message <[email-masked]>
> * On the subject of "Re[2]: [clisp-list] help with compiling clisp cvs on cygwin"
> * Sent on Thu, 20 Mar 2003 18:18:48 +1000
> * Honorable Arseny Slobodjuck <[email-masked]> writes:
>

ouch!

1. could you please build CLISP from CVS head and make a binary release
   for Yadin?

2. can you build with g++ and track down the bug? what is the show-stopper?

Garbage In, Gospel Out