[PATCH] fix build for Clozure CL on Windows

17 views
Skip to first unread message

Qian Yun

unread,
Jan 4, 2024, 9:10:27 AM1/4/24
to fricas-devel
Using the native Clozure CL binary
https://github.com/Clozure/ccl/releases/download/v1.12.2/ccl-1.12.2-windowsx86.zip
to build FriCAS in MSYS2/MingW64, there's an error about permission
denied to write fasl in C:/.

That's because "trim-directory-name" called by "get-current-directory"
called by "relative-to-absolute" called by "fricas_compile_file",
it returns NIL, causing "fricas_compile_file" to write output
to "/xxx.fasl" which is C:/.

The reason is that CCL on windows doesn't have feature :win32,
it has :windows instead.

I see no reason to do such feature testing in "trim-directory-name" and
"pad-directory-name".

- Qian

diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index 82ea63e2..33a0041e 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -740,18 +740,14 @@ with this hack and will try to convince the GCL
crowd to fix this.
)

(defun trim-directory-name (name)
- #+(or :unix :win32)
(if (char= (char name (1- (length name))) #\/)
(subseq name 0 (1- (length name)))
name))

(defun pad-directory-name (name)
- #+(or :unix :win32)
(if (char= (char name (1- (length name))) #\/)
name
(concatenate 'string name "/"))
- #-(or :unix :win32)
- (error "Not Unix and not Windows, what system it is?")
)

;;; Make directory

Waldek Hebisch

unread,
Jan 5, 2024, 4:53:08 PM1/5/24
to fricas...@googlegroups.com
On Thu, Jan 04, 2024 at 10:10:23PM +0800, Qian Yun wrote:
> Using the native Clozure CL binary
> https://github.com/Clozure/ccl/releases/download/v1.12.2/ccl-1.12.2-windowsx86.zip
> to build FriCAS in MSYS2/MingW64, there's an error about permission
> denied to write fasl in C:/.
>
> That's because "trim-directory-name" called by "get-current-directory"
> called by "relative-to-absolute" called by "fricas_compile_file",
> it returns NIL, causing "fricas_compile_file" to write output
> to "/xxx.fasl" which is C:/.
>
> The reason is that CCL on windows doesn't have feature :win32,
> it has :windows instead.
>
> I see no reason to do such feature testing in "trim-directory-name" and
> "pad-directory-name".

Well, not having ':win32' is likely to cause trouble in other places.
Quick fix is to add ':win32' to featurs (we do similar thing on one
of BSD-s). Or maybe update all tests for more varied features
(but I would prefer to use small feature set if possible).

Concerning 'trim-directory-name' and 'pad-directory-name': there
is system dependency here and IMO it makes sense to guard it
with feature test. In such case 'trim-directory-name' should
have error clause in case of not satisfied feature test.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages