This project aims to build a version of Electron that supports the Loong64 architecture.
Note: The Electron binaries require glibc >= 2.38.
- Check releases for available versions.
- Install the
electronnpm package with corresponding version and specify the download mirror like this:
ELECTRON_MIRROR="https://github.com/darkyzhou/electron-loong64/releases/download/" electron_use_remote_checksums=1 npm install electron@THE_VERSION
You may also refer to darkyzhou/electron-builder-loong64 for insturctions on how to build your Electron project with electron-builder.
dev: The development branch, containing the latest patches and build scripts.X.Y.Z: The release branches, corresponding to the release versions of Electron.
See darkyzhou/electron.
Special thanks to @jiegec and AOSC team for their invaluable Chromium patches in AOSC-Dev/chromium-loongarch64, which make this project possible.
- Linux host machine with Loong64 architecture
- Docker with docker-buildx installed
- LATX version 1.4.4 (required for running
ghcr.io/darkyzhou/electron-buildtoolsimage) - System resources: minimum 32GiB RAM and 200GiB free disk space
ghcr.io/darkyzhou/electron-builder:deepin-25-llvm-20-rustc-188: for37.x.xghcr.io/darkyzhou/electron-builder:deepin-25-llvm-21-rustc-192: for39.x.x
- Launch a
ghcr.io/darkyzhou/electron-buildtoolscontainer. All subsequent steps should be executed inside this container. - Change the variables inside
./scripts/env.shaccording to your environment and needs. - Run following scripts in sequence.
# Clone or update the local electron repository
./scripts/update.sh
# Apply patches from electron-loong64
./scripts/patch.sh
# Fetch or update the dependencies of electron
# Note: This could take a really long time, grab your coffee or take a sleep!
./scripts/sync.sh-
Launch a container with the corresponding builder image listed above. All subsequent steps should be executed inside this container.
-
Run following scripts in sequence.
# Replace binaries with native ones
./scripts/binaries.sh
./scripts/rollup.sh
# Build the electron
# Note: This could also take a long time, better get some sleep.
./scripts/build.sh
# Package the electron
./scripts/package.sh-
Launch a
ghcr.io/darkyzhou/electron-buildtoolscontainer. All subsequent steps should be executed inside this container -
Update versions and sync sources:
- Edit
ELECTRON_VERSIONto point to the new version to build inenv.sh - Run
scripts/update.sh
- Edit
-
Update dependencies:
- Run
scripts/sync.shto install dependencies
- Run
-
Update Chromium patches:
- Prepare the consolidated Chromium patch file (e.g.,
chromium-131.0.6778.85.diff) from AOSC-Dev/chromium-loongarch64 - Run
scripts/apply.sh chromium-131.0.6778.85.diffto apply the patches - Resolve any conflicts if any
- Run
scripts/export.shto export patches for Chromium and submodule commits
- Prepare the consolidated Chromium patch file (e.g.,
Common compilation errors:
relocation R_LARCH_B26 out of range: 172745664 is not in [-134217728, 134217727]- Root cause: The library was compiled without the
-mcmodel=mediumflag. For more details, see laelf.adoc. - Resolution: Recompile the library with the
-mcmodel=mediumflag. SeeDockerfile.libffifor implementation examples.
- Root cause: The library was compiled without the