-
Notifications
You must be signed in to change notification settings - Fork 3
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
Fix missing native modules for mac and windows build #152
Comments
Right now I'm not sure why the proper platform specific optional dependencies are not being included. I'm still digging into that aspect. |
I checked out a commit from before the flakes change and it has the same issue. So It's not a flake related issue. |
Ok, so here is the core of the problem and what I've found out. Some facts:
So given these facts, from what I can tell. No matter what target platform we're building for. Only the optional dependencies that work on the The solution is obvious, we need to make sure that the target platform native modules are available in the build environment to be included in the packaged executable. This is where I'm running into some stumbling blocks. Here is a general summary.
Right now I think there just isn't good support for having optional dependencies that only support a specific platform. I can't find a clean work around to force include them in the build process. The only solution I can find that comes close is to include all of them and then prune the ones we don't need after installing. But that means removing the os and cpu limitation on the packages. Right now what works is to add all of the optional native modules to the |
So In my mind right now, the preliminary solution is to
|
Yes I was aware of this in the beginning when the native packaging was changed from js-db to the new style. The new style was intended to be more optimal and the current behaviour is the correct behaviour. It reduces the bloat. However the question is about building targetting different platforms and thus requiring the installation of additional optional dependencies. The solution is simple. In the ci, just directly run npm install for those specific dependencies. The problem is because while nix understands the difference between build platform and host platform and target platform, npm does not understand this. So we just need to do a little trick in the CI job to force install those dependencies at that point of building the Mac or Windows binary. On the other hand - a long term solution might be to use the Mac and windows vms builder to build the PKG. In fact this is how the actual native objects/libraries are done, and so one can argue the same should be done in Mac and windows ci jobs. This is further supported by the need of doing code signing which may require keeping the entire build pipeline platform specific. |
For now just npm install the optional package directly as an unsaved npm dependency (probably don't need saving, but if you do, you will need to do it before the npmDepsHash calculation). |
I'm trying to go down the And we can't do anything a modifies the This means we'll need to remove the platform and cpu restrictions for the native sub-packages. |
So we know what the problem is in detail now, and we know how to fix it. But doing so is going to involve a general revamp of the CI build process to make use of platform specific runners to do the The following changes need to be made to the CI jobs
|
For the final stage packaging we won't be using nix anymore. So it won't technically be a deterministic output. The main difference is the name of the final output will change. |
I got the macos build and test working but there's an oddity. When building we have the We may have to explore setting up our own runners on the office mac and windows machines. The windows job is still failing for now. There seems to be a problem with running the build script in windows. I need to explore the problem more. |
Long term I expect native integration into nix on the macos platform too with only Windows as the outlier. |
Given we only have an
|
I've gotten both the windows and mac build to work. The mac build still needs some polish. It's only building for On reflection, It may still be possible to do cross compiling if we build and bundle with node20 and pkg with node21 targeting node20. I'll look into that after clean up. |
I'm able to override the If that doesn't work or we decide not to go with that then we still need to solve how to build both version of |
Did gitlab entirely deprecate the x64 runner? Anyway the arm64 runner is capable of doing anything the x64 was doing. |
Not sure, That would explain why it was But I have good news, I found a way to get it working in nix again. So we can build all the executables in nix again. Turns out it was possible to override the node version |
On review, It may be possible to do this all in node20 just using the workspaces. I'll explore this further. |
The nix building method that I fixed up works nominally. But the man and win runner fails to run their respective builds. The mac job is killing it so I'm assuming that's a code signing problem. The windows has a completely inscrutable error |
I think for now I won't worry about getting the The leaves the windows build to fix. It seems to be failing to load
Looking into it. |
Yes I believe gitlab completely removed the x64 runner. However the arm64 runner is capable of doing both. In that case I think you can build a "fat binary" which means the executable supports both. |
The fd-lock issue is known. We had plans to create our own js-file-lock native library - we can do it like js-exec. You can search the issues and do it. |
When I include fd-lock in the pkg assets in |
Windows job is passing now. |
I'm looking into getting As an alternative I'm just going to remove the cpu restriction from the generated prebuild packages. While not combining both architectures it will ensure that all architectures for a platform are included. |
No we deliberately chose not to do that. They build independent binaries. You can always compose them afterwards.
Look at the fat binary spec. It's not that complicated - it's mostly concatenation.
13 Mar 2024 20:30:29 Brian Botha ***@***.***>:
…
I'm looking into getting *js-quic* and *js-exec* to build a dwarwin module for *x64+arm64* but I'm not sure it's possible? I can't seem to find a way to do it.
As an alternative I'm just going to remove the cpu restriction from the generated prebuild packages. While not combining both architectures it will ensure that all architectures for a platform are included.
—
Reply to this email directly, view it on GitHub[#152 (comment)], or unsubscribe[https://github.com/notifications/unsubscribe-auth/AAE4OHJOA2VV3ESPGGYTDJDYYD4THAVCNFSM6AAAAABEGJ4CMSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJWGIZDSOBYHE].
You are receiving this because you commented.
[Tracking image][https://github.com/notifications/beacon/AAE4OHND2U4UZU355EPGVZ3YYD4THA5CNFSM6AAAAABEGJ4CMSWGG33NNVSW45C7OR4XAZNMJFZXG5LFINXW23LFNZ2KUY3PNVWWK3TUL5UWJTTW7QGQC.gif]
|
I did a little research and it seems simple enough to do with lipo (https://ss64.com/mac/lipo.html) when creating the darwin binaries in the mac runner. That said, what I have is a workable solution that's creating an |
Pretty much done for this stage. I'll make a PR for review. |
Fixed up the macos native dependencies. We now have a universal |
ETA on the release page for the working mac binary - non-codesigned of course so that @CryptoTotalWar can try it, he's working on the docs now. |
Specification
Right now the mac and windows build outputs are missing the proper native modules. So far as I can tell, all of the required modules are configured to be included by
pkg
. However they are unavailable to be included during the build process.This needs to be fixed before the windows and mac builds can be used.
The main problem is that the build process only has the Linux specific optional dependencies available when we are packaging. I'm still exploring the exact reason for this.
Tasks
The text was updated successfully, but these errors were encountered: