unknownskl / greenlight

Greenlight is an open-source client for xCloud and Xbox home streaming made in Typescript.
MIT License
2.26k stars 125 forks source link

[FEATURE] arm64 build instructions (or even binary release) #1135

Closed georgev93 closed 9 months ago

georgev93 commented 9 months ago

Describe the feature

I'm trying to build greenlight for my Raspberry Pi 4B (which is arm64). I'm having trouble getting the package to build/install. Any insight would be much appreciated!

Describe the use case

No response

Additional information

I've tried to yarn build the v2.1.1 release of greenlight-beta and it seems to get pretty far in the process. However, when I get to packaging I get this:

  • electron-builder  version=24.9.1 os=6.1.0-rpi8-rpi-v8
  • loaded configuration  file=/home/pi/greenlight/electron-builder.yml
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=arm64 electron=27.1.3 appOutDir=dist/linux-arm64-unpacked
  • building        target=AppImage arch=arm64 file=dist/Greenlight-2.1.1-arm64.AppImage
  ⨯ exec: "opj_decompress": executable file not found in $PATH
github.com/develar/app-builder/pkg/icons.ConvertIcnsToPngUsingOpenJpeg
        /Volumes/data/Documents/app-builder/pkg/icons/icnsToPngUsingOpenJpeg.go:158
github.com/develar/app-builder/pkg/icons.ConvertIcnsToPng
        /Volumes/data/Documents/app-builder/pkg/icons/icns-to-png.go:47
github.com/develar/app-builder/pkg/icons.doConvertIcon
        /Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:226
github.com/develar/app-builder/pkg/icons.ConvertIcon
        /Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:56
github.com/develar/app-builder/pkg/icons.ConfigureCommand.func1
        /Volumes/data/Documents/app-builder/pkg/icons/icon-converter.go:33
github.com/alecthomas/kingpin.(*actionMixin).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/actions.go:28
github.com/alecthomas/kingpin.(*Application).applyActions
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:557
github.com/alecthomas/kingpin.(*Application).execute
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:390
github.com/alecthomas/kingpin.(*Application).Parse
        /Volumes/data/go/pkg/mod/github.com/alecthomas/kingpin@v2.2.6+incompatible/app.go:222
main.main
        /Volumes/data/Documents/app-builder/main.go:90
runtime.main
        /usr/local/Cellar/go/1.17/libexec/src/runtime/proc.go:255
runtime.goexit
        /usr/local/Cellar/go/1.17/libexec/src/runtime/asm_arm64.s:1133  
  ⨯ /home/pi/greenlight/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1  failedTask=build stackTrace=Error: /home/pi/greenlight/node_modules/app-builder-bin/linux/arm64/app-builder process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
Exit code:
1
    at ChildProcess.<anonymous> (/home/pi/greenlight/node_modules/builder-util/src/util.ts:251: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)

Cannot build electron packages:
Error: Command failed with exit code 1: electron-builder

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Any ideas? I'm very comfortable with a handful of programming and scripting languages, but JavaScrypt and TypeScript are not on that list! As soon as we start yarning I have no idea what we're actually doing...

unknownskl commented 9 months ago

It looks like you are missing the dependency opj_decompress on your system which makes the build fail. Can you try to install that? (More info here: https://manpages.ubuntu.com/manpages/focal/man1/opj_decompress.1.html)

Yarn is the package manager for node. It's a replacement of npm. The yarn command installs all dependencies and puts the files in the node_modules/ folder. yarn build command does execute the election builder and compiles the app for you. You can also run yarn dev to run the application in debug mode. (Exact command are defines in packages.json.)

The binary should also be available on flathub, although I don't have a raspberry pi myself to test the install with, so I'm not sure if it runs 100% correctly or if it is even findable via the discovery app (but happy to help out if it doesn't :))

georgev93 commented 9 months ago
  1. You are correct about the dependency of obj_decompress missing! I installed libopenjp2-tools and that seemed to fix it.
  2. I appreciate your patience and explanations!
  3. I completely missed the aarch64 package on flathub! That should get me fully squared away! However, I've already started down this path of building, so I continued trying to build from source as a somewhat academic exercise (perhaps useful to anyone else that finds this issue?). I had to solve one more snag:
[nextron] Packaging - please wait a moment
  • electron-builder  version=24.9.1 os=6.1.0-rpi8-rpi-v8
  • loaded configuration  file=/home/pi/greenlight/electron-builder.yml
  • writing effective config  file=dist/builder-effective-config.yaml
  • packaging       platform=linux arch=arm64 electron=27.1.3 appOutDir=dist/linux-arm64-unpacked
  • building        target=AppImage arch=arm64 file=dist/Greenlight-2.1.1-arm64.AppImage
  • building        target=deb arch=arm64 file=dist/greenlight_2.1.1_arm64.deb
  • adding autoupdate files for: deb. (Beta feature)  resourceDir=/home/pi/greenlight/dist/linux-arm64-unpacked/resources
  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86/fpm-1.9.3-2.3.1-linux-x86.7z size=4.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86/fpm-1.9.3-2.3.1-linux-x86.7z duration=793ms
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.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/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

                    command=/home/pi/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d libgtk-3-0 -d libnotify4 -d libnss3 -d libxss1 -d libxtst6 -d xdg-utils -d libatspi2.0-0 -d libuuid1 -d libsecret-1-0 --deb-recommends libappindicator3-1 --deb-compression xz --architecture arm64 --after-install /tmp/t-yBgLDd/0-after-install --after-remove /tmp/t-yBgLDd/1-after-remove --description '
     Greenlight is a streaming application for Xbox and xCloud' --version 2.1.1 --package /home/pi/greenlight/dist/greenlight_2.1.1_arm64.deb --name greenlight --maintainer 'UnknownSKL <info+github@jimkroon.nl>' --url 'https://github.com/unknownskl/greenlight#readme' --vendor 'UnknownSKL <info+github@jimkroon.nl>' --deb-priority optional /home/pi/greenlight/dist/linux-arm64-unpacked/=/opt/Greenlight /home/pi/greenlight/dist/.icon-set/icon_16x16.png=/usr/share/icons/hicolor/16x16/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_32x32.png=/usr/share/icons/hicolor/32x32/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_48x48.png=/usr/share/icons/hicolor/48x48/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_64x64.png=/usr/share/icons/hicolor/64x64/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_128x128.png=/usr/share/icons/hicolor/128x128/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_256x256.png=/usr/share/icons/hicolor/256x256/apps/greenlight.png /home/pi/greenlight/dist/.icon-set/icon_512.png=/usr/share/icons/hicolor/512x512/apps/greenlight.png /tmp/t-yBgLDd/2-Greenlight.desktop=/usr/share/applications/greenlight.desktop
                    workingDir=

electron-builder wanted to download/use a particular fpm binary, which was x86. I had to install fpm separately by installing ruby, doing sudo gem install fpm, then set USE_SYSTEM_FPM to true with export USE_SYSTEM_FPM="true" before I did yarn build. I followed the workflow described in this github issue from electron-builder.

And then everything went fine! I got my .deb package and installed that with apt. Thanks again for your help!