Skip to content

Conversation

KaMeHb-UA
Copy link
Contributor

@KaMeHb-UA KaMeHb-UA commented Mar 30, 2024

This PR intoduces long-awaited linux-arm64 builds!

A few notes on the PR:

  1. Dugite was updated from 2.5.0 to 2.5.1. There should be no incompatibilities (see UPD2 below) between this versions but 2.5.1 has linux-arm64 support. Please kindly check if everything works as expected before merging this upgrade to upstream.
  2. Since AppImage builder has hardcoded x64 architecture specified in build settings, I have commented-out moving AppImage to builds directory. After (if?) it will be fixed it's possible to just uncomment related line and everything should work just fine. Currently x64 AppImage may work on arm64 machine with help of something like Box64 to initially unpack the image and start native binaries after unpacking.
  3. Yarn doesn't have options like --os and --architecture (which npm has) to specify which architecture to select when installing optional dependencies. Instead it has --ignore-platform option. But when using it on the whole package, it will also tell Yarn to (try to) install ALL the optional packages, for all the architectures and it will have significant impact on the resulting archive size and dependency installation time. That's why I'm using a little bit hacky approach - creating a temporary dir and installing the only required package for the only architecture we need and then moving it to original project's node_modules dir.

Binaries was tested on ThinkPad X13s laptop with Manjaro-ARM on board (Snapdragon 8cx Gen 3, 16GB RAM) but should work fine on any other ARM64 device.

Resolves #6623

UPD: Here's also a release created so you can see that everything works as expected.

UPD2: Looks like there is no changes in dugite API between v2.5.0 and v2.5.1 so everything is expected to work fine.

@CLAassistant
Copy link

CLAassistant commented Mar 30, 2024

CLA assistant check
All committers have signed the CLA.

@andelf andelf self-requested a review April 1, 2024 09:25
Copy link
Collaborator

@andelf andelf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

@andelf andelf merged commit 87dbf5c into logseq:master Apr 2, 2024
@theofficialgman
Copy link

  1. Yarn doesn't have options like --os and --architecture (which npm has) to specify which architecture to select when installing optional dependencies. Instead it has --ignore-platform option. But when using it on the whole package, it will also tell Yarn to (try to) install ALL the optional packages, for all the architectures and it will have significant impact on the resulting archive size and dependency installation time. That's why I'm using a little bit hacky approach - creating a temporary dir and installing the only required package for the only architecture we need and then moving it to original project's node_modules dir.

@KaMeHb-UA yarn doesn't need such options. you need to install and then specify that the cross compilers and proper npm_config_arch get used
see https://github.com/shiftkey/desktop/blob/e315c497a1c813ead6dfaed6071d07843d6a4281/.github/workflows/ci.yml#L60-L195 for a working example of using ARMhf/ARM64 with cross compilation on github actions with yarn

@KaMeHb-UA
Copy link
Contributor Author

@KaMeHb-UA yarn doesn't need such options. you need to install and then specify that the cross compilers and proper npm_config_arch get used see https://github.com/shiftkey/desktop/blob/e315c497a1c813ead6dfaed6071d07843d6a4281/.github/workflows/ci.yml#L60-L195 for a working example of using ARMhf/ARM64 with cross compilation on github actions with yarn

@theofficialgman npm_config_arch has different purpose. Please read my description carefully and check the PR code: I already use this env to support cross-platform binary downloads. Please also note that the env might be ignored by some packages at all.
Also there is another approach to provide binary dependencies - via set of optionalDependencies like, for example, esbuild or @logseq/rsapi does. And this is where --os and --architecture npm flags comes into play. If you don't use such packages, you might just stick with npm_config_arch but Logseq does (at least @logseq/rsapi). Please check the PR code for details. You can also fork the repo and try to just use npm_config_arch only, removing the step with temporary installation of required binary package and you will see what I'm talking about — you will get rsapi binaries for x64 instead of arm64 (everything is fine with dugite binaries though - they're installed via postinstall script and the postinstall script respects npm_config_arch). Feel free to try it by yourself 😊

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

Successfully merging this pull request may close these issues.

Linux arm64 support // Unable to start Logseq 0.8.4 (logs)
4 participants