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

REQUEST: Support for cross-platform SEA generation #94

Open
HayDegha0917 opened this issue Apr 23, 2024 Discussed in #89 · 5 comments
Open

REQUEST: Support for cross-platform SEA generation #94

HayDegha0917 opened this issue Apr 23, 2024 Discussed in #89 · 5 comments

Comments

@HayDegha0917
Copy link

Discussed in #89

Originally posted by HayDegha0917 April 3, 2024
We have been using pkg for crating SEAs. One of the great features of pkg is its support for generating SEAs for a variety of target OSes (for example, create a Linux executable from a Windows workstation). It does not seem that NodeJS's SEA capability supports this. Is it possible to add as a feature?

@GabenGar
Copy link

Wouldn't it bloat the main NodeJS codebase and the distribution binary file? It will basically have to include O(n^2) instructions for all supported platform pairs.

@HayDegha0917
Copy link
Author

@GabenGar I don't know how pkg does it, but they seem to manage. I assume they bring in the binary at runtime.

@GabenGar
Copy link

They did it by creating their own binaries which had to be constantly patched to keep up with upstream nodejs binary. Hence why it was unsustainable and therefore archived now.
Basically if there is no equivalent lib to libuv but for cross-platform compilation, then it's not going to become a part of nodejs.

@joyeecheung
Copy link
Member

joyeecheung commented May 21, 2024

Currently, cross-platform SEA generation is possible (as in, if you download executables for different platforms from the official source, generate one blob using an executable of your current platform, and inject the same blob into executables of different platforms, it still works and there's not much preventing it from working) unless you use the code cache or snapshot options (as those are platform-specific). It's more or less an undocumented feature at this point. It has been reported that it works nodejs/node#52420 (comment) - the injection would be based on executable format which can be done on even a platform that don't typically run that format, and the preparation blob layout is mostly the same across platform (again, unless you use code cache or snapshot) modulo endianness differences.

@HayDegha0917
Copy link
Author

HayDegha0917 commented May 21, 2024

So it's possible to use this feature but it's more or less an undocumented feature and has significant limitations.

This part is understood.

The request I filed is to make it user friendly and, at the minimum, better documented. It would also be nice to remove the requirement to have all the code in one file which, again, increases the barrier to usage.

It's the difference between a feature that sort of works and only for 10% of the user base and one that is extremely useful and adds value to your product. Beyond that comment, I can't pretend to know your priorities, deadlines, and resource contentions. But it's a bit disturbing that you will not even acknowledge the difficulty, to a semi-experienced user, of creating a single-executable application without a lot of effort.

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