Re: [Feature Request/Postmortem] Adding a way to compile GNU Guile scripts to a standalone executable

Srayan Jana <[email protected]> Wed, 13 Aug 2025 04:33:08 +0000
Newsgroups gmane.lisp.guile.devel
Message-ID <CH3PR14MB7560D1A86646AFAE94EAF632E02AA@CH3PR14MB7560.namprd14.prod.outlook.com>
  1.
I sure wish that Guix pack appimage was in the documentation online lol. The only reference I could find was a random issue closing the PR for it.
  2.
i can’t find any good tutorials on how to create a guix package using guile. Most stuff I find is using Makefiles/Autoconf and C.
  3.
Something I’m thinking about using Guile for is for stuff like ios/android stuff (and, massive pipe dream, game consoles like the Nintendo Switch). Is that compatible with LGPL?

Get Outlook for iOS<https://aka.ms/o0ukef>
________________________________
From: Matt Wette <[email protected]>
Sent: Tuesday, August 12, 2025 10:49:48 AM
To: Noé Lopez <[email protected]>; [email protected] <[email protected]>; Srayan Jana <[email protected]>
Subject: Re: [Feature Request/Postmortem] Adding a way to compile GNU Guile scripts to a standalone executable

Just FYI, I have played with generating standalone executables.
See experimential code at https://github.com/mwette/guile-freezer
This code now will bind non-system modules into an executable:
it converts your .go module files into .o files (containing binary data)
that are loaded during startup.

Two issues:
1) Guile is LPGL so I don't see how one can distribute standalone
executables w/o distributing
     all the means to re-build.  For example, including
ice-9/boot-9.go.   Do people want to do this?
2) Guile-freezer does not work with loading in ice-9/boot-9 and friends:
there are some incompatibilities
     with the startup code (e.g. how scm_ice_9_already_loaded is set).

Matt

On 8/12/25 2:33 AM, Noé Lopez wrote:
>> That didn't turn out well since Guile relies so much on Guix. And Guix dumps the binaries it compiles into /gnu/store and not inside of my CMake project, which is not good.
>>
>> Besides, I also feel like using CMake is a losing battle anyways, since it would tie it to a C++ build system. Instead, what I'd probably want to do is have a guile script that runs and builds everything together. Fortunately, there is prior art: https://git.dthompson.us/chickadee/tree/chickadee/cli/bundle.scm, which was used for davexunit.itch.io/bonnie-bee<https://davexunit.itch.io/bonnie-bee>
>> https://davexunit.itch.io/super-bloom
>>
>> The big problem I can think of when it comes to making a more generalized guile build system is that guile relies heavily on the Guix ecosystem, and everything in Guix is installed globally in /gnu/store. (Unless you do guix pack -RR of course). I don't know Guix SUPER well, but I think you could probably have your guile script inside a guix pack, and then run the script once you unzip it. However, I don't think that would work on windows, and also isn't the one-click executable I want.
>>
> guix pack -f appimage would do the one-click executable for linux.
>
>> So I guess after all of this, I really want to hear your thoughts on this effort. Should I keep trying to make this work? I'd love to submit a Pull Request at some point making this all work, but I want to know where I should put my attention into.
>>
> It sounds like a cool idea! I haven’t looked at what you have in detail
> but consider that making it as an AppImage would work well for Linux, I
> don’t know much about windows but I suppose there exists similar
> container formats in which you can put your guile binary and scripts and
> have it execute seemlessly.
>
> The advantage of AppImage instead of having to code your own bootstrap.c
> is that it will be able to load dynamic libraries as well as guile
> scripts from a SquashFS archive that is contained in the binary.
>
> I think a good way forward would be to extend chickadee’s bundle to
> generate AppImages instead of tarballs.
>
> Good day!
> Noé