-
Notifications
You must be signed in to change notification settings - Fork 164
Add a cosmopolitan build #438
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
Comments
I think it should be easy to add to the CI and to the release job. Would you be willing to send a PR?
What do you mean by this? |
I'm not really all that experienced with this, I just suggested this because upstream has a cosmo build.
Meaning, instead of |
Got it, it was on my mental list too. Our |
Ah okay, so a user would just take that c file and compile it with Cosmo, great! |
|
It's not portable at all (perhaps except with cosmo) since it assumes a given compiler and platform, and it calls exec and other Unix-only functions. The way Deno does it would be nice perhaps: take the |
The resulting executable is not portable across architectures or portable only to a limited set of targets (with cosmo), but on many architectures (linux, BSD, macOS) it can be run on a variety of versions of said targets, which is still useful. |
I respectfully disagree :-) My proposal above would accomplish the same, I reckon, without even having to call the compiler. Deno has been using it succesfully roo, FWIW. |
One does not preclude the other. There are multiple options to create standalone executable files:
Creating an executable from the |
I think 1 and 2 would be similar unless we strip the source when byte-compiling, right? Assuming we don't, they'd be equivalent, from the prespective of stack traces and such. I'll give that idea a try when I find some time. Still have some pending reviews 😅 |
An additional benefit from appending the data to the |
Implementing this inside Loading the bytecode from an external source such as an executable for a different platform solves the portability issue (for a given byte code version). |
I already do this now by bootstrapping with a small C file that runs an appended zipaligned script with qjs, similarly to how llamafile works. The result is a single cross-platform binary that runs a script which I can pass arguments to. Happy to share code if this would be useful to anyone. I would definitely prefer just running bytecode directly though, and without having to create a temporary file as I do now, since that can be insecure (though attack vectors are limited since the file is immediately read into memory and then ignored) |
@soulofmischief We now support standalone binaries like so: #739 |
https://github.com/jart/cosmopolitan
The cosmo version of
qjsc
would build to.com
cosmopolitan binariesThe text was updated successfully, but these errors were encountered: