An Experimental Port of FriCAS to WebAssembly

36 views
Skip to first unread message

Yanshu Wang

unread,
Jan 18, 2026, 3:47:25 AM (10 days ago) Jan 18
to FriCAS - computer algebra system
Hello.

I succeeded in porting FriCAS to WebAssembly so that it can run in browser in client side.

See more details in the github repo: https://github.com/wangyenshu/FriCAS-in-Browser

It takes about one minute to load FriCAS in my Browser.

This port use cheerpx, which is a WebAssembly based runtime to execute x86 binaries on browser. Briefing speaking, it runs a container with ecl installed and load Qian Yun's pure common-lisp build of FriCAS by in browser.

Yanshu Wang

screenshot:

Kurt Pagani

unread,
Jan 18, 2026, 5:55:00 AM (9 days ago) Jan 18
to fricas...@googlegroups.com
Congrats! Awesome, indeed.
I hoped someone will do this sooner or later :)


On 18/01/2026 09:07, Yanshu Wang wrote:
> Hello.
>
> I succeeded in porting FriCAS to WebAssembly so that it can run in
> browser in client side.
>
> Try it here: https://wangyenshu.github.io/FriCAS-in-Browser/ <https://
> wangyenshu.github.io/FriCAS-in-Browser/>
> See more details in the github repo: https://github.com/wangyenshu/
> FriCAS-in-Browser <https://github.com/wangyenshu/FriCAS-in-Browser>
>
> It takes about one minute to load FriCAS in my Browser.
>
> This port use cheerpx, which is a WebAssembly based runtime to execute
> x86 binaries on browser. Briefing speaking, it runs a container with ecl
> installed and load Qian Yun's pure common-lisp build of FriCAS by in
> browser.
>
> Yanshu Wang
>
> screenshot:
>
> --
> 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 <mailto:fricas-
> devel+un...@googlegroups.com>.
> To view this discussion visit https://groups.google.com/d/msgid/fricas-
> devel/11dfc458-c601-4c44-a48d-9d7c0fadd90fn%40googlegroups.com <https://
> groups.google.com/d/msgid/fricas-devel/11dfc458-c601-4c44-
> a48d-9d7c0fadd90fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

Old K

unread,
Jan 18, 2026, 6:10:03 AM (9 days ago) Jan 18
to fricas...@googlegroups.com
Thanks for sharing.

I wonder if you know about that ECL can be cross compiled to WebAssembly directly,
and someone on the Maxima maillist did it that way. I believe that similar thing can be
done to FriCAS, although I haven’t tried yet. Maybe you are interested in that information.

BTW, I get errors when doing integration, fails at loading files:
  pthread_kill failed at suspend: errcode= 38

- Best,
- Qian

On Jan 18, 2026, at 4:47 PM, Yanshu Wang <wangyen...@gmail.com> wrote:


Hello.

I succeeded in porting FriCAS to WebAssembly so that it can run in browser in client side.

See more details in the github repo: https://github.com/wangyenshu/FriCAS-in-Browser

It takes about one minute to load FriCAS in my Browser.

This port use cheerpx, which is a WebAssembly based runtime to execute x86 binaries on browser. Briefing speaking, it runs a container with ecl installed and load Qian Yun's pure common-lisp build of FriCAS by in browser.

Yanshu Wang

screenshot:

--
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/11dfc458-c601-4c44-a48d-9d7c0fadd90fn%40googlegroups.com.

Kurt Pagani

unread,
Jan 18, 2026, 6:28:15 AM (9 days ago) Jan 18
to fricas...@googlegroups.com


On 18/01/2026 12:09, Old K wrote:
> Thanks for sharing.
>
> I wonder if you know about that ECL can be cross compiled to WebAssembly
> directly,
> and someone on the Maxima maillist did it that way. I believe that
> similar thing can be
> done to FriCAS, although I haven’t tried yet. Maybe you are interested
> in that information.

Yes, e.g. Maxima runs in the browser this way (ECL).
https://maxima-on-wasm.pages.dev/

However, the Maxima pure Lisp build is "smoother" (IMO), in the sense
that it has less external dependencies. But of course, it should also be
possible for Fricas when we improved the lisp build ...
>
> BTW, I get errors when doing integration, fails at loading files:
>   pthread_kill failed at suspend: errcode= 38

I got this to (bit less when using "brave" instead of "firefox". The
current fricas lisp build loads on demand. Preloading might be safer?

>
> - Best,
> - Qian
>
>> On Jan 18, 2026, at 4:47 PM, Yanshu Wang <wangyen...@gmail.com>
>> wrote:
>>
>> 
>> Hello.
>>
>> I succeeded in porting FriCAS to WebAssembly so that it can run in
>> browser in client side.
>>
>> Try it here: https://wangyenshu.github.io/FriCAS-in-Browser/ <https://
>> wangyenshu.github.io/FriCAS-in-Browser/>
>> See more details in the github repo: https://github.com/wangyenshu/
>> FriCAS-in-Browser <https://github.com/wangyenshu/FriCAS-in-Browser>
>>
>> It takes about one minute to load FriCAS in my Browser.
>>
>> This port use cheerpx, which is a WebAssembly based runtime to execute
>> x86 binaries on browser. Briefing speaking, it runs a container with
>> ecl installed and load Qian Yun's pure common-lisp build of FriCAS by
>> in browser.
>>
>> Yanshu Wang
>>
>> screenshot:
>>
>> --
>> 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
>> To view this discussion visit https://groups.google.com/d/msgid/
>> fricas-devel/11dfc458-c601-4c44-a48d-9d7c0fadd90fn%40googlegroups.com
>> <https://groups.google.com/d/msgid/fricas-devel/11dfc458-c601-4c44-
>> a48d-9d7c0fadd90fn%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> 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
> To view this discussion visit https://groups.google.com/d/msgid/fricas-
> devel/67A80AA6-C712-4AD5-A3CB-F8E24227DCFF%40gmail.com <https://
> groups.google.com/d/msgid/fricas-devel/67A80AA6-C712-4AD5-A3CB-
> F8E24227DCFF%40gmail.com?utm_medium=email&utm_source=footer>.

Yanshu Wang

unread,
Jan 20, 2026, 2:26:31 AM (8 days ago) Jan 20
to FriCAS - computer algebra system
Thanks for your feedback.

I increase the initial heap to about 1GB. Now the integration works.

Screenshot of integrate(x*sqrt(x^2+1),x):
integrate1.png
integrate2.png
Complicated integration like integrate((x^20)*sqrt(x^2+1),x) also works.

However, Boehm garbage collector does not work in cheerpx. I guess cheerpx cannot handle some signals used by Boehm garbage collector. So it might be a problem how to clean up memory. The command )clear all works, though. I don't know if it can clear memory that is used in previous computation without Boehm garbage collector.

> Preloading might be safer?

I can try to use preloading when I have time. I hope preloading everything will not take too much memory.

> I wonder if you know about that ECL can be cross compiled to WebAssembly directly

This looks promising. I can try that way when I have time.

Best,
Yanshu Wang

Qian Yun

unread,
Jan 20, 2026, 6:20:59 AM (7 days ago) Jan 20
to fricas...@googlegroups.com
Now I can confirm integration works on my side.

This is an interesting project, so a few more questions:

1. the download seems rather big. Does the cheerpx
approach include an entire OS?

2. have you tried other lisps? Like SBCL?

3. you are using fricas0-1.3.10. I can try to update fricas0
to latest version.

- Best,
- Qian

Yanshu Wang

unread,
Jan 21, 2026, 12:01:07 AM (7 days ago) Jan 21
to FriCAS - computer algebra system
Hello Qian.

> 1. the download seems rather big. Does the cheerpx
approach include an entire OS?

Almost. It downloads the container built using dockerfile https://github.com/wangyenshu/FriCAS-in-Browser/blob/main/Dockerfile. Cheerpx can load ext2 images. Also I have to split that image into pieces so that it can be hosted on github pages. (the split script is in https://github.com/wangyenshu/FriCAS-in-Browser/blob/main/build.sh.) There file index.html has the script to glue them.

> 2. have you tried other lisps? Like SBCL?
No.

> 3. you are using fricas0-1.3.10. I can try to update fricas0
to latest version.

Thanks. You can modify the dockerfile and the cx.run parameter in index.html to do that.

Currently, cheerpx only support x86 binaries. And I heard that most browser has 2GB memory limit for WebAssembly. These are two difficulties for this method. I initially try to port sagemath to WebAssembly using the same manner. But I failed due to the 2GB limit. Maybe there are methods to bypass that, like storing disks in Indexdb rather than in memory. I haven't tried that. Another thing to mention is that several sagemath components are successfully ported to WebAssembly in this manner, like Singular CAS.

Best,
Yanshu Wang
Reply all
Reply to author
Forward
0 new messages