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

Noé Lopez <[email protected]> Wed, 13 Aug 2025 13:09:56 +0200
Newsgroups gmane.lisp.guile.devel
Message-ID <[email protected]>
Srayan Jana <[email protected]> writes:

>   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.
>

Make sure you’re looking at the devel version of the manual: <https://guix.gnu.org/manual/devel/en/html_node/Invoking-guix-pack.html#index-AppImage_002c-create-an-AppImage-file-with-guix-pack-1>.

>   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.
>

Look into the guile-xyz.scm file in the guix source for examples with guile-build-system.

>   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é
signature.asc (application/pgp-signature, 682 B)
-----BEGIN PGP SIGNATURE-----

iQHFBAEBCAAvFiEEXVTPJVeyOOiNwYCiLSIyQQq3QEMFAmiccoQRHG5vZWxvcGV6
QGZyZWUuZnIACgkQLSIyQQq3QEOYVgwAvmfeDB68xQ2FXv/wyTIvsfPOY8zq+bHS
kfgjNGKGR1HRuyL/H8zi3vYbscyQXgCmUfXAE+l5WOvEvLhg4v9V4Xb/6bVjGaen
LmS9WvMBL3AVr5Al8AJvPHomAz/Qy2GTXr1O8WFCsNAwmUUa+zlSXGq7aBDLQOWN
BwcazyV+ANuHJHni8zfLXfBcIRi3UoHT/617GaMD41utKDCFq5dzUGAbcUY9D55J
rqHrqu6nztKDey7EqXY1c0oDEZtau/U7G58m6DlcsH6i5QbaAQpTI+GvsIj11cwa
WYS7XtGTLW3st+DOElpkAh0qrD4IMiv5sZnohwV81lVJ8gXtdONiQpJm4OuVgU8Z
N9oxlyWUx9xXQ3LDDHY89z5uV6IoMv6OwwSmbn0IXbH1Ig6liWoRTZ5NzNO+Q3KE
uhLIkM5BUhcVQjhQa5h2PQ8mmzovQw5fC8bwQrJ9a4lDZ3jmV2iJrqzQe3Js+xQ2
TTYjBvFAkX/Erb5Ek8mhhIUjIpSivekF
=XgEE
-----END PGP SIGNATURE-----