chrisknepper / android-messages-desktop

Android Messages as a Cross-platform Desktop App
MIT License
1.01k stars 117 forks source link

segmentation fault on Arch #80

Open jjgalvez opened 6 years ago

jjgalvez commented 6 years ago

updated arch this morning and now I'm getting a Segmentation fault when I try to start android-messens-desktop. I'm not getting anything else other then that.

jjgalvez commented 6 years ago

may be related to glibc 2.28

jacob-swenson commented 6 years ago

I get this same thing right now. I reported it over on #30 and haven't been able to get to the bottom of it. Only workaround I've found is backdating to 8/5/2018 archives.

jacob-swenson commented 6 years ago

Can confirm. I only updated lib32-glibc and glibc to 2.28-1 and it broke Android Messages.

jacob-swenson commented 6 years ago

https://github.com/electron/electron/issues/13972 this seems to be the issue. There is a commit referenced at the end of the chain that they say solved the problem. Haven't had time to look more at that.

eli-schwartz commented 6 years ago

The other solution is to use our system electron package, which 1) works fine, 2) is the superior solution due to not vendoring dozens of copies of electron all over the system...

jjgalvez commented 6 years ago

how would we go about linking to the installed electron rather then the prebuilt one?

eli-schwartz commented 6 years ago

In many cases you can simply copy what would've been installed to resources/app/ or resources/app.asar, into its own installation directory/fil, then launch that directory with /usr/bin/electron.

e.g. if it is installed to /opt/android-messages-desktop/, then just cp -a /opt/android-messages-desktop/resources/app/ /usr/share/android-messages-desktop/ then create a launcher script for /usr/bin/android-messages-desktop:

#!/bin/sh

electron /usr/share/android-messages-desktop/ "$@"

It's a bit more complex if you have any binary node modules built against a specific version of electron.

jjgalvez commented 6 years ago

This worked perfectly! or at least it started without issue. I will edit the desktop file and go with this fr the time being

eli-schwartz commented 6 years ago

It is also about 120MB less of an install footprint for every additional electron-using package you have installed, and probably about 30 MB less of a download footprint. :)

jjgalvez commented 6 years ago

on arch electron should be added as a requirement and the pkgbuild file should be changed. I may take a stab at it and submit it to the folks maintaining it

eli-schwartz commented 6 years ago

Depending on how the build is set up, it should probably be possible to circumvent electron-packager or electron-builder when compiling from source, to spare the useless download, see for example https://git.archlinux.org/svntogit/community.git/tree/trunk/0001-Don-t-use-electron-to-build.patch?h=packages/keybase

Making this easier via special targets for distribution packagers would probably be nice. :)

jacob-swenson commented 6 years ago

I did get mine to work following these instructions as well. I've been trying to figure out the best way to incorporate this into the PKGBUILD but am not super experienced and can't quite figure out the best way to do it. @yochananmarqos any thoughts on how to have the AUR reflect this so it works?

eli-schwartz commented 6 years ago

Speaking with my Trusted User hat on, the package should not download a precompiled release asset but should instead use https://github.com/chrisknepper/android-messages-desktop/archive/v0.7.0.tar.gz using npm to build from source. (This package is not named "android-messages-desktop-bin".) Not sure how to get resources/app containing only the right files without invoking electron-builder and downloading a huge electron binary which will just be thrown out...

yochananmarqos commented 6 years ago

@jacob-swenson That's only a temporary workaround. As @eli-schwartz mentioned, it would be better to build from source. I'm not sure how to do it without invoking electron-builder, either.

eli-schwartz commented 6 years ago

https://github.com/chrisknepper/android-messages-desktop/blob/936f674334fba08c17adf0b9bf951f8d5c22fdcd/package.json#L17-L27

It's sufficient to create the app/ directory by deleting the postinstall hook and electron/electron-builder dependencies in the package.json, and removing && electron-builder --publish never from the build command (maybe webpack could be run as build, and "package" would run build && electron-builder ... )

The problem is that copying over the right files is implemented entirely in electron-builder which isn't exactly modular...

jjgalvez commented 6 years ago

I took a wack as rewriting the PKGBUILD file using the native electron and putting the resourses file in lib. Here is my edited PKGBUILD file

pkgname=android-messages-desktop pkgver=0.7.0 pkgrel=1 pkgdesc="Android Messages as a cross-platform desktop app" arch=('x86_64') url="https://github.com/chrisknepper/android-messages-desktop" license=('MIT') depends=('electron' 'c-ares' 'ffmpeg' 'gtk3' 'http-parser' 'libevent' 'libvpx' 'libxslt' 'libxss' 'minizip' 'nss' 're2' 'snappy' 'libnotify' 'libappindicator-gtk2' 'libappindicator-gtk3' 'libappindicator-sharp') provides=(android-messages-desktop) source=("${url}/releases/download/v${pkgver}/${pkgname}-${pkgver}.pacman") md5sums=('d61810468879d8da2fa543448b84e251')

package() { install -D -m644 "${srcdir}/opt/Android Messages/resources/app.asar" \ "${pkgdir}/usr/lib/${pkgname}/resources/app.asar" install -D -m644 "${srcdir}/opt/Android Messages/resources/electron.asar" \ "${pkgdir}/usr/lib/${pkgname}/resources/electron.asar"

sed -i "s|\"/opt/Android Messages/android-messages-desktop\"|/usr/bin/electron /usr/lib/${pkgname}/resources/app.asar|" "${srcdir}/usr/share/applications/${pkgname}.desktop"

install -D -m644 "${srcdir}/usr/share/applications/${pkgname}.desktop" "${pkgdir}/usr/share/applications/${pkgname}.desktop" for icon_size in 16 24 32 48 64 128 256 512 1024; do icons_dir="/usr/share/icons/hicolor/${icon_size}x${icon_size}/apps" install -d "${pkgdir}/${icons_dir}" install -m644 "${srcdir}${icons_dir}/${pkgname}.png" \ "${pkgdir}${icons_dir}/${pkgname}.png" done }

yochananmarqos commented 6 years ago

I updated the PKGBUILD, see #30.

eli-schwartz commented 6 years ago

In many cases you can simply copy what would've been installed to resources/app/ or resources/app.asar, into its own installation directory/file, then launch that directory with /usr/bin/electron.

e.g. if it is installed to /opt/android-messages-desktop/, then just cp -a /opt/android-messages-desktop/resources/app/ /usr/share/android-messages-desktop/ then create a launcher script for /usr/bin/android-messages-desktop:

#!/bin/sh

electron /usr/share/android-messages-desktop/ "$@"

electron.asar is useless, adding an extra resources/ directory is useless, code which contains no ELF binaries should go to /usr/share not /usr/lib

install -D -m644 "${srcdir}/opt/Android Messages/resources/app.asar" \
    "${pkgdir}/usr/share/${pkgname}.asar"
sed -i "s|/opt/Android Messages/android-messages-desktop|electron /usr/share/${pkgname}.asar|" \
    "${srcdir}/usr/share/applications/${pkgname}.desktop"
andersvos commented 6 years ago

On the last update from AUR I noticed that it installs from this new PKGBUILD. It works now, no segfault. But hovering on the tray icon displays the name "electron". Maybe there's no way to get the real name there?

yochananmarqos commented 6 years ago

@andersvos It shows Android Messages when I hover over it. ¯\_(ツ)_/¯