This document outlines the steps taken to convert the Windows version of the "雅思哥机考软件" (yasige) Electron application to run natively on a Linux aarch64 (ARM64) host.
Ensure you have Node.js and npm installed on your Linux aarch64 system:
node -v
npm -vElectron applications bundle their source code into an app.asar archive, typically found in the resources directory of the application bundle. We first need to extract this archive to access the package.json and source files.
Navigate to the resources directory and extract the archive:
cd /home/elliot/Downloads/yasige/resources
npx --yes asar extract app.asar app-sourceThis creates a new folder called app-source containing the application's code.
The original application was built for Windows, meaning any native Node.js modules were compiled for win32. We need to reinstall the dependencies directly on the Linux aarch64 host so that native modules (like node-machine-id or crypto) are recompiled for the target architecture.
cd app-source
npm installOnce the dependencies are correctly installed for Linux ARM64, we use @electron/packager to bundle the application with the Linux-specific Electron binaries.
By inspecting the package.json, we determined the app uses Electron version 21.4.4. We pass this version to the packager:
npx --yes @electron/packager . yasige --platform=linux --arch=arm64 --electron-version=21.4.4 --out=../linux-build --overwriteThis command:
- Targets the current directory (
.) - Names the executable
yasige - Builds for
linuxonarm64architecture - Uses the exact Electron version specified in the project
- Outputs the final build to a new directory
../linux-build
You can verify that the resulting executable is a native 64-bit ARM Linux binary:
file ../linux-build/yasige-linux-arm64/yasigeExpected output should indicate: ELF 64-bit LSB pie executable, ARM aarch64...
You can also check that all shared library dependencies are satisfied on your host:
ldd ../linux-build/yasige-linux-arm64/yasige | grep "not found"(If this outputs nothing, all shared libraries are successfully linked.)
Navigate to the build output directory and run the newly compiled native Linux binary:
cd ../linux-build/yasige-linux-arm64
./yasige --no-sandbox(Note: The --no-sandbox flag is often required for Electron apps running on certain Linux configurations, especially within containers or specialized environments. If it runs fine without it, you may omit it.)