ChezScheme icon indicating copy to clipboard operation
ChezScheme copied to clipboard

Static binary

Open Eilie opened this issue 6 years ago • 9 comments

Hello, how can I compile my program to static binary?

Eilie avatar Dec 17 '17 21:12 Eilie

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 avatar Dec 18 '17 02:12 gwatt

@gwatt Chez-exe is really nice, thank you for making it! I wounder will there ever be an official way to do this?

Eilie avatar Dec 18 '17 08:12 Eilie

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 avatar Dec 20 '17 23:12 gwatt

@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 avatar Dec 28 '17 14:12 tizoc

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

gwatt avatar Dec 28 '17 15:12 gwatt

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!

EmmanuelOga avatar Apr 28 '20 05:04 EmmanuelOga

After 6 years, any updaes?

larrasket avatar Nov 21 '23 12:11 larrasket

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

gwatt avatar Nov 22 '23 19:11 gwatt

There is my project letloop/letloop it produce binaries, and even include the necessary files for recompilation, and any shared library.

amirouche avatar Nov 22 '23 21:11 amirouche