Skip to content
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

Add arm64 Linux version of client #2342

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Add arm64 Linux version of client #2342

wants to merge 4 commits into from

Conversation

q4a
Copy link

@q4a q4a commented Jan 22, 2025

I'm not sure that it's best solution, but it's working example.
It was based on my previous build instruction: #816 (comment)
But improved + added arm64 Linux CI with GitHub-hosted runner:
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#standard-github-hosted-runners-for-public-repositories

@q4a q4a requested review from a team as code owners January 22, 2025 22:10
Copy link

google-cla bot commented Jan 22, 2025

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Contributor

@jyyi1 jyyi1 left a comment

Choose a reason for hiding this comment

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

Thanks for the update! We're currently rewriting the routing on Linux (see issue #2312). This might conflict with your changes.

In future versions, we'll be removing AppImage and some related components, includingOutlineProxyController. Please make your updates to the .deb target instead. And make sure to test it on a Ubuntu machine.

Also, it's important that we can build the Linux version from macOS, as that's what we use for development. Please make sure the cross-compilation also works.

client/electron/electron-builder.json Outdated Show resolved Hide resolved
client/build/get_build_parameters.mjs Outdated Show resolved Hide resolved
@@ -65,6 +65,10 @@ tasks:
desc: "Build the tun2socks binary and library for Linux"
cmds: [{task: electron, vars: {TARGET_OS: "linux", TARGET_ARCH: "amd64"}}]

linux_arm64:
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you tried to build it from macOS, will this work?

Copy link
Author

Choose a reason for hiding this comment

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

I don't have any macOS hw, so I can't check this

.github/workflows/build_and_test_debug_client.yml Outdated Show resolved Hide resolved
.github/workflows/build_and_test_debug_client.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@jyyi1 jyyi1 left a comment

Choose a reason for hiding this comment

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

Thanks for the update, please see the comments. Please also fix the linting errors.

.github/workflows/build_and_test_debug_client.yml Outdated Show resolved Hide resolved
run: |
sudo apt install ruby
sudo gem install fpm
export USE_SYSTEM_FPM=true && export GEM_HOME="$(ruby -e 'puts Gem.user_dir')" && export PATH="$PATH:$GEM_HOME/bin"
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar as above, please remove these scripts from the CI job, and add instructions/build scripts to the actual action (e.g. ./client/electron/build.action.mjs).

Please also illustrate why these steps are required.

client/electron/electron-builder.json Show resolved Hide resolved
client/build/get_build_parameters.mjs Outdated Show resolved Hide resolved
@q4a
Copy link
Author

q4a commented Jan 25, 2025

@jyyi1 I can fix minor issues, but I'm not sure if it makes sense for now. There is critical problems that I can't solve:
Building the deb version uses many dependencies, including fpm, but there is no arm64 version:
https://github.com/electron-userland/electron-builder-binaries/releases?q=fpm&expanded=true
Here is my build log:

q@rock-5b:/media/q/arm/git/outline-apps$ npm run action client/electron/build linux -- --arch arm64

> action
> node ./infrastructure/build/run_action.mjs client/electron/build linux --arch arm64


       / __ \| |  | |__   __| |    |_   _| \ | |  ____|    
      | |  | | |  | |  | |  | |      | | |  \| | |__       
      | |  | | |  | |  | |  | |      | | | . ` |  __|      
      | |__| | |__| |  | |  | |____ _| |_| |\  | |____     
       \____/ \____/   |_|  |______|_____|_| \_|______|    

  =========================================================
               © The Outline Authors, 2023
  =========================================================
  
▶ action(client/electron/build):
  Running [node '--trace-uncaught' '/media/q/arm/git/outline-apps/client/electron/build.action.mjs' 'linux' '--arch' 'arm64']...
  WARNING: building "linux" in [DEBUG] mode. Do not publish this build!!
  ▶ action(client/src/www/build):
    Running [node '--trace-uncaught' '/media/q/arm/git/outline-apps/client/src/www/build.action.mjs' 'linux' '--arch' 'arm64']...
    (node:9214) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
    BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
        Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
        Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
    (Use `node --trace-deprecation ...` to show where the warning was created)
  ▶ action(client/src/www/build): 🎉 Success! (15702ms)
  ▶ action(client/go/build):
    Running [node '--trace-uncaught' '/media/q/arm/git/outline-apps/client/go/build.action.mjs' 'linux' '--arch' 'arm64']...
    Running [go 'run' 'github.com/go-task/task/v3/cmd/task' '-v' 'client:tun2socks:linux_arm64']...
    task: [/media/q/arm/git/outline-apps] Not found - Using alternative (Taskfile.yml)
    task: "client:tun2socks:linux_arm64" started                                                                                                                                             
    task: "client:tun2socks:electron" started                                                                                                                                                
    task: [client:tun2socks:electron] rm -rf "/media/q/arm/git/outline-apps/client/output/build/linux" && mkdir -p "/media/q/arm/git/outline-apps/client/output/build/linux"                 
    task: [client:tun2socks:electron]  \                                                                                                                                                     
    go build -trimpath -ldflags="-s -w -X=main.version=v1.16.11" -o '/media/q/arm/git/outline-apps/client/output/build/linux/tun2socks' '/media/q/arm/git/outline-apps/client/go/outline/electron'                                                                                                                                                                                        
                                                                                                                                                                                             
    task: [client:tun2socks:electron]  \                                                                                                                                                     
    go build -trimpath -buildmode=c-shared -ldflags="-s -w -X=main.version=v1.16.11" -o '/media/q/arm/git/outline-apps/client/output/build/linux/libbackend.so' '/media/q/arm/git/outline-apps/client/go/outline/electron'                                                                                                                                                                
                                                                                                                                                                                             
    task: "client:tun2socks:electron" finished                                                                                                                                               
    task: "client:tun2socks:linux_arm64" finished                                                                                                                                            
                                                                                                                                                                                             
    
  ▶ action(client/go/build): 🎉 Success! (5285ms)
  ▶ action(client/electron/build_main):
    Running [node '--trace-uncaught' '/media/q/arm/git/outline-apps/client/electron/build_main.action.mjs' 'linux' '--arch' 'arm64']...
    ▶ action(client/src/www/build):
      Running [node '--trace-uncaught' '/media/q/arm/git/outline-apps/client/src/www/build.action.mjs' 'linux' '--arch' 'arm64']...
      (node:9836) [DEP_WEBPACK_COMPILATION_ASSETS] DeprecationWarning: Compilation.assets will be frozen in future, all modifications are deprecated.
      BREAKING CHANGE: No more changes should happen to Compilation.assets after sealing the Compilation.
        Do changes to assets earlier, e. g. in Compilation.hooks.processAssets.
        Make sure to select an appropriate stage from Compilation.PROCESS_ASSETS_STAGE_*.
      (Use `node --trace-deprecation ...` to show where the warning was created)
    ▶ action(client/src/www/build): 🎉 Success! (15725ms)
  ▶ action(client/electron/build_main): 🎉 Success! (34852ms)
    • electron-builder  version=23.6.0 os=6.1.84-vendor-rk35xx
    • description is missed in the package.json  appPackageFile=/media/q/arm/git/outline-apps/package.json
    • author is missed in the package.json  appPackageFile=/media/q/arm/git/outline-apps/package.json
    • packaging       platform=linux arch=arm64 electron=19.1.9 appOutDir=output/client/electron/build/linux-arm64-unpacked
    • building        target=deb arch=arm64 file=output/client/electron/build/Outline-Client-arm64.deb
    ⨯ cannot execute  cause=exit status 1
                      errorOut=/home/q/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/q/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: cannot execute binary file: Exec format error
      /home/q/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/q/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success
      
                      command=/home/q/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libnotify4 -d libxtst6 -d libnss3 -d libcap2-bin -d patchelf --deb-recommends libappindicator3-1 --deb-compression xz --architecture arm64 --after-install /tmp/t-ME4LRO/0-after_install.sh --after-remove /tmp/t-ME4LRO/1-after-remove --description '
       ' --version 0.0.0-debug --package /media/q/arm/git/outline-apps/output/client/electron/build/Outline-Client-arm64.deb --name outline-client --maintainer 'Jigsaw LLC' --url https://github.com/q4a/outline-apps --vendor 'Jigsaw LLC' --deb-priority optional /media/q/arm/git/outline-apps/output/client/electron/build/linux-arm64-unpacked/=/opt/Outline /media/q/arm/git/outline-apps/client/electron/icons/png/16x16.png=/usr/share/icons/hicolor/16x16/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/24x24.png=/usr/share/icons/hicolor/24x24/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/32x32.png=/usr/share/icons/hicolor/32x32/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/48x48.png=/usr/share/icons/hicolor/48x48/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/64x64.png=/usr/share/icons/hicolor/64x64/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/128x128.png=/usr/share/icons/hicolor/128x128/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/256x256.png=/usr/share/icons/hicolor/256x256/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/512x512.png=/usr/share/icons/hicolor/512x512/apps/Outline.png /media/q/arm/git/outline-apps/client/electron/icons/png/1024x1024.png=/usr/share/icons/hicolor/1024x1024/apps/Outline.png /tmp/t-ME4LRO/2-Outline.desktop=/usr/share/applications/Outline.desktop
                      workingDir=
  
  /media/q/arm/git/outline-apps/node_modules/builder-util/src/util.ts:250
        reject(new ExecError(command, code, out, errorOut))
               ^
  Error: /media/q/arm/git/outline-apps/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
  Exit code:
  2
      at ChildProcess.<anonymous> (/media/q/arm/git/outline-apps/node_modules/builder-util/src/util.ts:250:14)
      at Object.onceWrapper (node:events:632:26)
      at ChildProcess.emit (node:events:517:28)
      at maybeClose (node:internal/child_process:1098:16)
      at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)
  ERROR(spawn_stream): node --trace-uncaught /media/q/arm/git/outline-apps/client/electron/build.action.mjs linux --arch arm64 failed with exit code 1.}
  No error output was given... Please fix this so it gives an error output :(
▶ action(client/electron/build): ❌ Failed.
q@rock-5b:/media/q/arm/git/outline-apps$ uname -a
Linux rock-5b 6.1.84-vendor-rk35xx #1 SMP Thu Jan  9 02:09:01 UTC 2025 aarch64 aarch64 aarch64 GNU/Linux

There is options/workarounds:

  1. Try to fix/update upstream versions. Here is some steps requited:
    Build failure on aarch64 (M1 Macbook) signalapp/Signal-Desktop#6063 (comment)
  2. Try to update version of packages/dependencies or somehow avoid fpm dependency.
  3. Some people suggested switching from electron-builder to electron-forge:
    What happened to the arm64 deb & rpm files in version 2.2.0? Automattic/simplenote-electron#2503 (comment)
  4. Try to build fpm from source:
    Build failure on aarch64 (M1 Macbook) signalapp/Signal-Desktop#6063 (comment)
  5. Just grub prebuild arm64 fpm from https://github.com/jgresham/fpm-arm-binary but it uses specific GLIBC:
$ ldd fpm-arm64-binary 
./fpm-arm64-binary: /lib/aarch64-linux-gnu/libpthread.so.0: version `GLIBC_PRIVATE' not found (required by ./fpm-arm64-binary)
  1. Install and use system fpm - that's what I did in last version.

It's my 1st attempt to build/improve electron app - so:
1-3 options looks fine, but it's very complex or I can break something.
4-6 options looks more like workarounds and I'm not sure that it's impossible to move that distro-specific commands to the actual action (*.mjs)

@q4a q4a requested a review from jyyi1 January 25, 2025 11:57
@fortuna fortuna requested a review from sbruens January 28, 2025 15:37
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.

2 participants