Open mn4367 opened 5 months ago
I have found the reason for this problem. The problem is not the behavior of postject
, but a 'misconfiguration' of the blob generation when used in the context of a Node.js SEA.
The configuration file I used looked like this:
{
"main": "server.js",
"output": "server.js.blob",
"disableExperimentalSEAWarning": true,
"useSnapshot": false,
"useCodeCache": true <= Don't use this!
}
The only problem is that useCodeCache
has been set to true
. This seems to create a blob that is specific to the platform it is created on, which also explains all the stack trace messages related to V8 in my original problem report. When useCodeCache
is set to false
, everything works fine.
Since many people seem to use postject
for creating Node SEAs, it might be worth including this note in the documentation.
So it is indeed possible to create Node.js SEAs on any platform for any platform supported by postject
, which is really nice (thanks for this project!).
For the specific case of injecting resources into a darwin-*
executable on a Windows or Linux platform, the Apple Codesign project is a gem: it provides pre-built signing tools that allow signing darwin-*
executables on win32
and linux
(and also darwin
) platforms. Signing is necessary at least for darwin-arm64
executables, otherwise they will no longer run after injection.
macOS Ventura 13.6.4 (
darwin-arm64
) MacBook Air M1 Node v20.11.1 (darwin-arm64
)Exactly following these docs I tried to inject a 7MB JS blob into a
darwin-x64
node executable on the platform described above. This works without showing any error. But if I start the generated executable it fails withSegmentation fault: 11
. It doesn't matter if I sign the generated executable or not, the error remains the same.Doing the exact same thing but with a
darwin-arm64
node executable works without problems. Below is the full content from the error report dialog which appears afterwards and shows a lot of V8 related error messages (note: the original app name has been replaced with[REDACTED]
). Is it a known problem, that this kind of cross-platform doesn't work?Edit: the same is true vice versa: injecting into a
darwin-arm64
node executable ondarwin-x64
also works but leads to the same error.Full error report: