GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||
GeezerVison is showing github.com — src: add initial support for single executable applications by RaisinTen · Pull Request #45038 · nodejs/node Conversation
|
|
Review requested:
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Refs: nodejs/node#45038 Signed-off-by: Darshan Sen <[email protected]>
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
@RaisinTen Don't forget to list this PR in https://github.com/nodejs/single-executable's README, for the record :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Question: does the executable require node to be installed? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Adding |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Please make it print the experimental warning if that isn’t happening already. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Fixes the following error I came across while integrating Postject in
Node.js:
```console
../deps/postject/src/dist/postject-api.h:30:13: error: unused function 'postject_options_init' [-Werror,-Wunused-function]
static void postject_options_init(struct postject_options* options) {
^
1 error generated.
```
Refs: nodejs/node#45038
Signed-off-by: Darshan Sen <[email protected]>
There was an error while loading. Please reload this page.
|
Is it just me or the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Off-topic: Having the source of |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Super cool stuff! Super mega hyper excited for this!
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
@kapv89 no it does not. That's one of the main use cases for the single executables applications - so that it is possible to distribute a Node.js application to a user who does not already have Node.js installed on their system. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
This change has been extracted from the single executable application PR - nodejs#45038. I'm doing this in a separate PR because as James said in nodejs#45038 (comment), it is a rather sizeable addition on its own, so it should be easier to review and address related changes in this PR. This dependency takes care of the resource injection part of the single executable application work. Refs: https://github.com/nodejs/single-executable/blob/34b6765a871222e142f9dbac2bcde5b4e79ebfb2/blog/2022-08-05-an-overview-of-the-current-state.md#resource-injection Signed-off-by: Darshan Sen <[email protected]>
@jasnell sure, moved it to its own PR - #45066. And yes, it is needed for the resource injection part. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
@ovflowd it is the compiled version :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Do we need the compiled version? As |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ovflowd as mentioned in #45066 (comment), that is the webassembly code which is precompiled in postject. It's built using the emsdk, not node-gyp. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
* fix: make sure that postject-api.h compiles without warnings
Fixes the following error I came across while integrating Postject in
Node.js:
```console
../deps/postject/src/dist/postject-api.h:30:13: error: unused function 'postject_options_init' [-Werror,-Wunused-function]
static void postject_options_init(struct postject_options* options) {
^
1 error generated.
```
Refs: nodejs/node#45038
Signed-off-by: Darshan Sen <[email protected]>
* fix: resolve another compiler warning
```console
In file included from /root/project/test/test.c:4:
/root/project/test/../dist/postject-api.h: In function 'postject_find_resource':
/root/project/test/../dist/postject-api.h:96:9: error: unused variable 'ptr' [-Werror=unused-variable]
96 | void* ptr = NULL;
| ^~~
cc1: all warnings being treated as errors
```
Refs: https://app.circleci.com/pipelines/github/postmanlabs/postject/180/workflows/d0eb47c0-5482-4c85-9c63-aa854ddb0221/jobs/1398?invite=true#step-110-678
Signed-off-by: Darshan Sen <[email protected]>
* fix: use -Wall -WX on Windows
Signed-off-by: Darshan Sen <[email protected]>
* chore: use -W4 instead of -Wall
-Wall produces too many warnings.
Refs: https://app.circleci.com/pipelines/github/postmanlabs/postject/185/workflows/48b0f126-8000-41d9-b39e-cb8b9e4bc9d6/jobs/1441?invite=true#step-107-693
Signed-off-by: Darshan Sen <[email protected]>
* fix: another compilation warning on Windows
```console
C:\Users\circleci\project\test\../dist/postject-api.h(153,5): error C2220: the following warning is treated as an error [C:\Users\circleci\project\build\test\c_test.vcxproj]
C:\Users\circleci\project\test\../dist/postject-api.h(153,5): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\circleci\project\build\test\c_test.vcxproj]
C:\Users\circleci\project\test\test.c(13,5): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\circleci\project\build\test\c_test.vcxproj]
```
Refs: https://app.circleci.com/pipelines/github/postmanlabs/postject/186/workflows/f1389b9f-c958-4a24-9d6e-28af856ff776/jobs/1455?invite=true#step-107-694
Signed-off-by: Darshan Sen <[email protected]>
* fix: compiler warning on Windows
```console
C:\Users\circleci\project\test\test.c(13,5): error C2220: the following warning is treated as an error [C:\Users\circleci\project\build\test\c_test.vcxproj]
C:\Users\circleci\project\test\test.c(13,5): warning C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. [C:\Users\circleci\project\build\test\c_test.vcxproj]
```
Refs: https://app.circleci.com/pipelines/github/postmanlabs/postject/187/workflows/8bcdcb96-646d-4008-93bf-294e92469b3d/jobs/1464?invite=true#step-107-694
Signed-off-by: Darshan Sen <[email protected]>
* fix: use -EHsc for test.cpp
```console
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\ostream(743,1): error C2220: the following warning is treated as an error [C:\Users\circleci\project\build\test\cpp_test.vcxproj]
C:\Users\circleci\project\test\test.cpp(13): message : see reference to function template instantiation 'std::basic_ostream<char,std::char_traits<char>> &std::operator <<<std::char_traits<char>>(std::basic_ostream<char,std::char_traits<char>> &,const char *)' being compiled [C:\Users\circleci\project\build\test\cpp_test.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30133\include\ostream(743,1): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc [C:\Users\circleci\project\build\test\cpp_test.vcxproj]
```
Refs: https://app.circleci.com/pipelines/github/postmanlabs/postject/188/workflows/9107adc5-61a3-41ad-bd60-dd3eb0996765/jobs/1470?invite=true#step-107-696
Signed-off-by: Darshan Sen <[email protected]>
* fix: use / instead of - for Windows compiler options
Signed-off-by: Darshan Sen <[email protected]>
* chore: use target_compile_options instead of set
Signed-off-by: Darshan Sen <[email protected]>
Signed-off-by: Darshan Sen <[email protected]>
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
still lgtm
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Landed in 9bbde3d |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
This is great, thanks to everyone involved! 🙌 Which release lines will this get released in? (eg. v14, v16, v18, v19)? Or will it require a new breaking change and only be available in Node.js v20+? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
This PR is labelled
semver-minor
|
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is it original Javascript included in the SEA, or is it a v8 snapshot version? I think it should be the last one, not only it would be smaller in size but also more cryptic, and being targeted to that specific version of Node.js, that wouldn't be incompatibilities issues... Where can I address this questions? Is that info included in the docs? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
It is the original JavaScript file. The doc - https://nodejs.org/api/single-executable-applications.html already instructs users to inject the JS file contents into the binary and doesn't mention anything about the V8 snapshot. What do you think about creating a discussion in https://github.com/nodejs/single-executable? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Done at nodejs/single-executable#57 :-) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen Do you mind opening a backport for this for Node v18.x? Thank you |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@danielleadams done - #47495! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen If you have some time, would you mind putting together a small summary for the v18.16.0 release notes? Thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@danielleadams sure! Does this work? Add initial support for single executable applications Compile a JavaScript file into a single executable application: $ echo 'console.log(`Hello, ${process.argv[2]}!`);' > hello.js $ cp $(command -v node) hello # On systems other than macOS: $ npx postject hello NODE_JS_CODE hello.js \ --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2 # On macOS: $ npx postject hello NODE_JS_CODE hello.js \ --sentinel-fuse NODE_JS_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \ --macho-segment-name NODE_JS $ ./hello world Hello, world! Contributed by Darshan Sen in #45038 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RaisinTen perfect - thanks! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
something wrong? CentOS 8 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@waitingsong which version of Node.js are you using? Does running |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
issue: nodejs/postject#83 EDIT: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
it give me error |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@RezaErfani67 could you create an issue in https://github.com/nodejs/single-executable/issues? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.