cisco / ChezScheme

Chez Scheme
Apache License 2.0
6.98k stars 986 forks source link

Static binary #243

Open Eilie opened 6 years ago

Eilie commented 6 years ago

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

gwatt commented 6 years ago

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.

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.

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.

Eilie commented 6 years ago

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

gwatt commented 6 years ago

I would personally like to see something like these included in Chez Scheme proper. However I think neither are ready to be incorporated yet.

tizoc commented 6 years ago

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

gwatt commented 6 years ago

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

EmmanuelOga commented 4 years ago

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!

larrasket commented 11 months ago

After 6 years, any updaes?

gwatt commented 11 months ago

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

amirouche commented 11 months ago

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