Skip to content

Build your personal knowledge base with Trilium Notes

Fix better-sqlite3 for ARM64 Linux

linull2e510f9dbbbc
diff --git a/.github/actions/build-electron/action.yml b/.github/actions/build-electron/action.yml
index 26d35b79f9..9e4a166202 100644
--- a/.github/actions/build-electron/action.yml
+++ b/.github/actions/build-electron/action.yml
@@ -86,6 +86,7 @@ runs:
APPLE_ID_PASSWORD: ${{ env.APPLE_ID_PASSWORD }}
WINDOWS_SIGN_EXECUTABLE: ${{ env.WINDOWS_SIGN_EXECUTABLE }}
TRILIUM_ARTIFACT_NAME_HINT: TriliumNotes-${{ github.ref_name }}-${{ inputs.os }}-${{ inputs.arch }}
+ TARGET_ARCH: ${{ inputs.arch }}
run: pnpm run --filter desktop electron-forge:make --arch=${{ inputs.arch }} --platform=${{ inputs.forge_platform }}
# Add DMG signing step
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 16dec74928..a930984def 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -30,6 +30,17 @@ jobs:
image: win-signing
shell: cmd
forge_platform: win32
+ exclude:
+ - arch: arm64
+ os:
+ name: linux
+ include:
+ - arch: arm64
+ os:
+ name: linux
+ image: ubuntu-24.04-arm
+ shell: bash
+ forge_platform: linux
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@v5
diff --git a/.github/workflows/test-arm64-fix.yml b/.github/workflows/test-arm64-fix.yml
new file mode 100644
index 0000000000..cf69303a75
--- /dev/null
+++ b/.github/workflows/test-arm64-fix.yml
@@ -0,0 +1,32 @@
+name: Test ARM64 Fix
+on:
+ push:
+ branches: [ fix-arm64-sqlite ]
+ workflow_dispatch:
+
+jobs:
+ test-arm64-rebuild:
+ runs-on: ubuntu-24.04-arm
+ steps:
+ - uses: actions/checkout@v5
+ - uses: pnpm/action-setup@v4
+ - uses: actions/setup-node@v5
+ with:
+ node-version: 22
+ cache: 'pnpm'
+ - name: Install dependencies
+ run: pnpm install --frozen-lockfile
+ - name: Test rebuild with TARGET_ARCH
+ env:
+ TARGET_ARCH: arm64
+ run: |
+ echo "Testing electron-rebuild with TARGET_ARCH=arm64"
+ pnpm postinstall
+ echo "Checking better-sqlite3 architecture:"
+ file apps/desktop/node_modules/better-sqlite3/build/Release/better_sqlite3.node || echo "File not found"
+ - name: Test desktop build
+ env:
+ TARGET_ARCH: arm64
+ run: |
+ echo "Testing desktop build"
+ pnpm run --filter desktop build
\ No newline at end of file
diff --git a/scripts/electron-rebuild.mts b/scripts/electron-rebuild.mts
index 48ede8cdd1..6ed8360e73 100644
--- a/scripts/electron-rebuild.mts
+++ b/scripts/electron-rebuild.mts
@@ -24,13 +24,15 @@ function rebuildNativeDependencies(projectRoot: string) {
process.exit(1);
}
- console.log(`Rebuilding ${projectRoot} with ${electronVersion}...`);
+ const targetArch = process.env.TARGET_ARCH || process.arch;
+ console.log(`Rebuilding ${projectRoot} with ${electronVersion} for ${targetArch}...`);
const resolvedPath = resolve(projectRoot);
rebuild({
projectRootPath: resolvedPath,
buildPath: resolvedPath,
electronVersion,
+ arch: targetArch,
force: true
});
}