squalou / google-chat-linux

source of a fork of google-chat-linux unofficial client from robyf
47 stars 10 forks source link

x86 ruby is downloaded and called on an ARM64 computer, when doing npm run dist:deb #88

Closed SmartLayer closed 5 months ago

SmartLayer commented 5 months ago

The error below is caused by attempting to execute ruby (x86) on an arm64 computer. Note that this laptop already have ruby (arm64) installed, the npm code here simply doesn't run the locally installed ruby and insists on running it from fpm.

$ npm run dist:deb

> google-chat-linux@5.27.23-6 dist:deb
> electron-builder --linux=deb

  • electron-builder  version=24.4.0 os=6.5.0-1008-laptop
  • loaded configuration  file=package.json ("build" field)
  • writing effective config  file=dist/builder-effective-config.yaml
  • executing @electron/rebuild  arch=arm64 version=27.0.3 appDir=/usr/local/src/google-chat-linux
  • packaging       platform=linux arch=arm64 electron=27.0.3 appOutDir=dist/linux-arm64-unpacked
  • downloading     url=https://github.com/electron/electron/releases/download/v27.0.3/electron-v27.0.3-linux-arm64.zip size=101 MB parts=8
  • downloaded      url=https://github.com/electron/electron/releases/download/v27.0.3/electron-v27.0.3-linux-arm64.zip duration=8.721s
  • building        target=deb arch=arm64 file=dist/google-chat-linux_5.27.23-6_arm64.deb
  • 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=1.483s
  ⨯ cannot execute  cause=exit status 1
                    errorOut=/home/weiwu/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/weiwu/.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/weiwu/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin/ruby: line 6: /home/weiwu/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/lib/ruby/bin.real/ruby: Success

                    command=/home/weiwu/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86/fpm -s dir --force -t deb -d xdg-desktop-portal --deb-recommends libappindicator3-1 --deb-compression xz --architecture arm64 --after-install /tmp/t-w0FjGz/0-after-install --after-remove /tmp/t-w0FjGz/1-after-remove --description '
     Unofficial alternative Google Chat desktop app' --version 5.27.23-6 --package /usr/local/src/google-chat-linux/dist/google-chat-linux_5.27.23-6_arm64.deb --name google-chat-linux --maintainer 'Roberto Fasciolo <rob@robyf.net>' --url https://github.com/squalou/google-chat-linux --vendor 'Roberto Fasciolo <rob@robyf.net>' --deb-priority optional --license WTFPL /usr/local/src/google-chat-linux/dist/linux-arm64-unpacked/=/opt/google-chat-linux /usr/local/src/google-chat-linux/build/icons/48.png=/usr/share/icons/hicolor/48x48/apps/google-chat-linux.png /usr/local/src/google-chat-linux/build/icons/64.png=/usr/share/icons/hicolor/64x64/apps/google-chat-linux.png /usr/local/src/google-chat-linux/build/icons/256.png=/usr/share/icons/hicolor/256x256/apps/google-chat-linux.png /tmp/t-w0FjGz/2-google-chat-linux.desktop=/usr/share/applications/google-chat-linux.desktop
                    workingDir=
squalou commented 5 months ago

Hi,

Thanks for reporting this, I've never tried ARM build yet, I'm glad someone does !

Looks like it's an issue with electron builder, and if you already have ruby and fpm installed on your system you may try this workaround :

export USE_SYSTEM_FPM="true" && npm run dist:deb

Let me know if it works.

(read it here: https://github.com/electron-userland/electron-builder/issues/3901)

I'll read further if there's a better way / another packager plugin better suited for this.

regards,

SmartLayer commented 5 months ago

It works and I am using the deb generated right now. I hope there is a way to remove such a need, hence #68