[PATCH] build fricas on windows on ecl

2 views
Skip to first unread message

Qian Yun

unread,
Apr 27, 2026, 8:06:52 PM (4 days ago) Apr 27
to fricas-devel
I've finally built fricas on windows on ecl, both
native (msys2/mingw64) and with cygwin.

First I have to say, it is painful. The build time for mingw64
is 70 minutes, the build time for cygwin is 190 minutes.
(The stat is based on github runners, 4 cores.
For comparison, sbcl takes 5 minutes.)

Now this should fill the last missing piece of Lisp-OS
combination that FriCAS can run on.

See bellow for patch and explanation.

- Qian

diff --git a/config.lisp b/config.lisp
index f405c710..6a469f7b 100644
--- a/config.lisp
+++ b/config.lisp
@@ -12,6 +12,7 @@
:direction :output
:if-does-not-exist :create
:if-exists :supersede)
+ #+:ecl (require :cmp)
(format out "fricas_fasl_type=~a~&"
(pathname-type (compile-file-pathname "foo.lisp")))


This is needed by ecl on mingw64. On Linux, "CMP" is
automatically loaded, but on Windows, it is not, resulting
the "fasc" bytecode suffix, causing trouble much later with
expose.lsp.


diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in
index 7cc5a40f..c9788bfc 100644
--- a/src/lisp/Makefile.in
+++ b/src/lisp/Makefile.in
@@ -47,9 +47,9 @@
## and image.
## Use $(BASE) because Lisp (gcl) is native on Windows
lisp_c_objects = \
- $(BASE)$(build_libdir)/bsdsignal.o \
- $(BASE)$(build_libdir)/cfuns-c.o \
- $(BASE)$(build_libdir)/sockio-c.o
+ ../lib/bsdsignal.o \
+ ../lib/cfuns-c.o \
+ ../lib/sockio-c.o

$(OUT)/lisp$(EXEEXT): do_it.$(lisp_flavor)


This is needed by ecl on mingw64. ECL is extremely strict
about windows path names. It only accepts "c:/dir/file",
while other lisps accepts "/c/dir/file". So using relative
path is a good choice here.

About the gcl note: gcl used to have mingw binary, but we don't
support old gcl, and latest gcl does not support mingw64 yet.
I feel that gcl on windows support is not that important.


@@ -112,7 +112,7 @@
$(patsubst %, "\"%\"", $(lisp_c_objects)) \
")))" >> fricas-ecl.lisp
echo "(defvar *fricas-initial-lisp-objects* (quote (" \
- $(patsubst %, "\"$(BASE)$(abs_builddir)/%\"", \
+ $(patsubst %, "\"../lisp/%\"", \
fricas-package.o fricas-config.o fricas-ecl.o \
fricas-lisp.o primitives.o) ")))" \
>> fricas-ecl.lisp


Same as above, use relative path.


diff --git a/src/lisp/fricas-lisp.lisp b/src/lisp/fricas-lisp.lisp
index 9d2835ac..7d239ad7 100644
--- a/src/lisp/fricas-lisp.lisp
+++ b/src/lisp/fricas-lisp.lisp
@@ -903,7 +903,7 @@
(if exit-code exit-code 0))
#+:cmu
(ext:process-exit-code (ext:run-program command arguments :output t))
- #+:ecl
+ #+(and :ecl (not :cygwin))
(cadr (multiple-value-list (ext:run-program command arguments :output
t)))
;; #+:gcl ;; run-process is asynchronous
;; (si:run-process command arguments)
@@ -918,14 +918,16 @@
#+:sbcl
(sb-ext:process-exit-code
(sb-ext:run-program command arguments :search t :output
*standard-output*))
- #+:gcl
+ #+(or :gcl (and :ecl :cygwin))
+ ;; ecl on cygwin has forking issues, see
+ ;; https://gitlab.com/embeddable-common-lisp/ecl/-/merge_requests/216
(si:system (format nil "~{~a~^ ~}" (cons command arguments)))
)

(defun |run_shell_command| (s)
- #+:gcl
+ #+(or :gcl :ecl)
(si:system s)
- #-:gcl
+ #-(or :gcl :ecl)
(|run_program| "sh" (list "-c" s)))

(defmacro DEFCONST (name value)


As the comment said, this is for ecl on cygwin, where the forking
emulation doesn't work well with ecl.
ecl-on-windows.patch

Waldek Hebisch

unread,
Apr 27, 2026, 9:11:29 PM (4 days ago) Apr 27
to fricas...@googlegroups.com
On Tue, Apr 28, 2026 at 08:06:48AM +0800, Qian Yun wrote:
> I've finally built fricas on windows on ecl, both
> native (msys2/mingw64) and with cygwin.
>
> First I have to say, it is painful. The build time for mingw64
> is 70 minutes, the build time for cygwin is 190 minutes.
> (The stat is based on github runners, 4 cores.
> For comparison, sbcl takes 5 minutes.)
>
> Now this should fill the last missing piece of Lisp-OS
> combination that FriCAS can run on.

OK.
> --
> You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to fricas-devel...@googlegroups.com.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-devel/0942cc02-ca03-48e9-b7b7-4cd7c4293d3b%40gmail.com.

> diff --git a/config.lisp b/config.lisp
> index f405c710..6a469f7b 100644
> --- a/config.lisp
> +++ b/config.lisp
> @@ -12,6 +12,7 @@
> :direction :output
> :if-does-not-exist :create
> :if-exists :supersede)
> + #+:ecl (require :cmp)
> (format out "fricas_fasl_type=~a~&"
> (pathname-type (compile-file-pathname "foo.lisp")))
>
> diff --git a/src/lisp/Makefile.in b/src/lisp/Makefile.in
> index 7cc5a40f..c9788bfc 100644
> --- a/src/lisp/Makefile.in
> +++ b/src/lisp/Makefile.in
> @@ -47,9 +47,9 @@
> ## and image.
> ## Use $(BASE) because Lisp (gcl) is native on Windows
> lisp_c_objects = \
> - $(BASE)$(build_libdir)/bsdsignal.o \
> - $(BASE)$(build_libdir)/cfuns-c.o \
> - $(BASE)$(build_libdir)/sockio-c.o
> + ../lib/bsdsignal.o \
> + ../lib/cfuns-c.o \
> + ../lib/sockio-c.o
>
> $(OUT)/lisp$(EXEEXT): do_it.$(lisp_flavor)
>
> @@ -112,7 +112,7 @@
> $(patsubst %, "\"%\"", $(lisp_c_objects)) \
> ")))" >> fricas-ecl.lisp
> echo "(defvar *fricas-initial-lisp-objects* (quote (" \
> - $(patsubst %, "\"$(BASE)$(abs_builddir)/%\"", \
> + $(patsubst %, "\"../lisp/%\"", \
> fricas-package.o fricas-config.o fricas-ecl.o \
> fricas-lisp.o primitives.o) ")))" \
> >> fricas-ecl.lisp
--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages