ChezScheme
ChezScheme copied to clipboard
Static binary
Hello, how can I compile my program to static binary?
There is no official way to do that, but there are a few community projects. Ovenpasta has a method that involves a modified Chez Scheme and zlib.
- https://github.com/ovenpasta/zlib/commit/c1cfc3a5d921b1f263786d920453919ac08601d7
- https://github.com/ovenpasta/ChezScheme/commit/2c49b192f0100df470c24c11bbb9bd7fb31b787d
Ovenpasta's project should be portable across any system that Chez Scheme supports.
I also have a project that doesn't require modifications to Chez or zlib, but does require that the system be unix-like.
- https://github.com/gwatt/chez-exe
Neither of these produce static binaries in the traditional sense (i.e. they will dynamically link against system libraries), but they do create executables that can be distributed without including the full Chez Scheme system.
Note that both of these projects involve embedding the boot files and use other code from Chez so the proper license notifications will need to be distributed with any binaries created from these projects.
@gwatt Chez-exe is really nice, thank you for making it! I wounder will there ever be an official way to do this?
I would personally like to see something like these included in Chez Scheme proper. However I think neither are ready to be incorporated yet.
@gwatt why doesn't chez-exe support Windows? is it just that you have not tried or is there some extra complication that I'm not considering? (other than the hardcoded paths to the temp files)
@tizoc The hardcoded paths are definitely a problem. However, the biggest reason is that I haven't taken the time to setup my windows computer with dev tools and actually figure out what I need to do to support windows. I suspect the build process will need to change; windows doesn't have great support for makefiles. I also think I would change the way I embed the scheme program and boot files. Windows provides a mechanism for embedding arbitrary resources into the executables and I would like to see if that's a good option for chez-exe. Finally, I don't know what libraries (if any) I need to link against on the windows side.
Hi, any updates about this? Is chez-exe still the best way to produce a self contained executable? Any chance Chez will include an official way to produces binaries? Thx!
After 6 years, any updaes?
@EmmanuelOga I've not seen a bunch else that lets produce a self contained exe, so I assume chez-exe is still the best way.
I've also not seen any talk about mainlining such a feature, but I wouldn't be surprised if it happens. I know that racket has its own way of producing executables and with the recent merging back in of racket's chezscheme fork I half expect to see that functionality put in mainline chez scheme.
However, I'm not a maintainer of either Chez Scheme or Racket, so they'd need to chime in on that last point.
There is my project letloop/letloop it produce binaries, and even include the necessary files for recompilation, and any shared library.