Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Actual compile support #191

Closed
Lazerbeak12345 opened this issue Nov 12, 2021 · 4 comments
Closed

Actual compile support #191

Lazerbeak12345 opened this issue Nov 12, 2021 · 4 comments

Comments

@Lazerbeak12345
Copy link

One of my biggest problems I've had with racket is that it doesn't have an option to compile. The benefits would be:

  • ease of distribution of production software built on the racket framework
  • speed
  • perhaps size? (the presence of eval might mean that significant parts of the code pipeline would need to be bundled)

It is worth noting that when using raco exe it does convert to a binary format (as do a few other commands), but if you dig into this exe (in my case a linux binary), it is not standalone, and is actually not even a binary in the usual sense.

@Lazerbeak12345
Copy link
Author

Interesting thoughts about Chez Scheme and compiled binaries: https://stackoverflow.com/questions/48061220/can-chez-scheme-produce-compiled-binaries

@Lazerbeak12345
Copy link
Author

Linked in that article is this tool: https://github.com/gwatt/chez-exe

@spdegabrielle
Copy link
Sponsor Member

Hi @Lazerbeak12345
Racket uses the same incremental native-code compiler as Chez Scheme. The ‘CS’ compiler has been the default compiler since version 8.0. (8.3 was just released )

In interactive mode, this compilation occurs automatically and on-the-fly. Tools like raco make and raco setup marshal compiled bytecode to a file, so that you do not have to compile from source every time that you run a program. See Compilation and Configuration: raco for more information on generating bytecode files.

For the CS implementation of Racket, the main bytecode format is non-portable machine code.

Racket Reference, 19 19 Performance: 19.3 Bytecode, Machine Code, and Just-in-Time (JIT) Compilers

There is a small sample with instructions to create a stand-alone executable at https://github.com/racket-templates/cli-command

I hope this helps
Best wishes
Stephen

@LiberalArtist
Copy link

I think the part you're missing is probably raco distribute: Sharing Stand-Alone Executables. In particular, this advice may be relevant:

The number of needed support files depends in part on the way that executables for a distribution are created. Supplying --embed-dlls or --orig-exe to raco exe reduces the need for support files, but at the expense of making the distribution larger if it contains multiple executables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants