hyper icon indicating copy to clipboard operation
hyper copied to clipboard

Linux arm64 not working

Open Jai-JAP opened this issue 3 years ago • 16 comments

  • [x] I am on the latest Hyper.app version
  • [x] I have searched the issues of this repo and believe that this is not a duplicate
  • OS version and name: Raspbian-64bit Bullseye
  • Hyper.app version: 3.2.0
  • Link of a Gist with the contents of your .hyper.js: https://gist.github.com/Jai-JAP/d52964cf0977bcd2f7087cd929aec9e8
  • Relevant information from devtools (CMD+ALT+I on macOS, CTRL+SHIFT+I elsewhere): N/A
  • The issue is reproducible in vanilla Hyper.app: yes

Issue

Hyper Linux arm64 not working giving the errors

    at Module._resolveFilename (node:internal/modules/cjs/loader:940:15)
    at Function.n._resolveFilename (node:electron/js2c/browser_init:249:1105)
    at Module._load (node:internal/modules/cjs/loader:785:27)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Function._load (/tmp/.mount_Hyper-rUBHOP/resources/app.asar/plugins.js:99:37)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/tmp/.mount_Hyper-rUBHOP/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js:30:15)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/tmp/.mount_Hyper-rUBHOP/resources/app.asar/node_modules/node-pty/lib/unixTerminal.js',
    '/tmp/.mount_Hyper-rUBHOP/resources/app.asar/node_modules/node-pty/lib/index.js',
    '/tmp/.mount_Hyper-rUBHOP/resources/app.asar/session.js',
    '/tmp/.mount_Hyper-rUBHOP/resources/app.asar/ui/window.js',
    '/tmp/.mount_Hyper-rUBHOP/resources/app.asar/index.js',
    undefined
  ]
}
A JavaScript error occurred in the main process
Uncaught Exception:
Error: `node-pty` failed to load. Typically this means that it was built incorrectly. Please check the `readme.md` to more info.
    at createNodePtyError (/tmp/.mount_Hyper-rUBHOP/resources/app.asar/session.js:35:34)
    at Object.<anonymous> (/tmp/.mount_Hyper-rUBHOP/resources/app.asar/session.js:42:11)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at Function._load (/tmp/.mount_Hyper-rUBHOP/resources/app.asar/plugins.js:99:37)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:102:18)

node-pty.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=5e9f50a0d8eb59de2c535c68623728922193c815, not stripped

This is the output of file app.asar/node_modules/node-pty/bin/node-pty-node from arm64 deb from the above artifacts app.asar is the folder where app.asar ( grabbed from opt/Hyper/resources ) is extracted using npx asar extract app.asar destfolder npx asar extract opt/Hyper/resources/app.asar app.asar The output should actually be something like ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=xxxxxxx....., not stripped i.e; it should state ARM aarch64 instead of x86_64

Jai-JAP avatar Mar 14 '22 11:03 Jai-JAP

Can you try the builds from https://app.circleci.com/pipelines/github/LabhanshAgrawal/hyper/930/workflows/9ac0a1c6-87c7-49fc-baa1-c169459953c4/jobs/934/artifacts there's both arm64 and armv7l builds (deb and rpm) Let me know if it's working and I can look into adding these to our ci flow

LabhanshAgrawal avatar Apr 23 '22 12:04 LabhanshAgrawal

I will try these build on Monday as i am away from my RPi

Jai-JAP avatar Apr 23 '22 15:04 Jai-JAP

@LabhanshAgrawal Arm64 works fine but armhf app.asar still has node_modules/node-pty/bin/linux-arm64-103/node-pty.node: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=53454e3c43cfd481bd6e2a9607ed80db98b8583e, not stripped which has to be something like node_modules/node-pty/bin/linux-arm64-103/node-pty.node: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, BuildID[sha1]=xxx...xxx...xxx, not stripped

Jai-JAP avatar Apr 25 '22 07:04 Jai-JAP

@LabhanshAgrawal i have made workflow for building arm64 /armv7l on amd64 hosts it can be seen here. This is tested working.

Also hyper needs to accept arch as a variable or an argument instead of an array as in electron-builder.json since this at present builds for all architectures listed in the array instead fro anly a single architecture resulting in broken builds not built for the architecture same as the host.

Jai-JAP avatar May 05 '22 11:05 Jai-JAP

Also debian buster has to be used for linux arm64 builds as playwright which is a dependency of hyper doesn't support firefox on ubuntu 18.04 arm64.

And ubuntu-bionic for armv7l as debian-buster has libc6 2.28 which has ssl certificate registration issues when emulated 32 bit on 64 bit using qemu-user

Jai-JAP avatar May 05 '22 11:05 Jai-JAP

Awesome!! Great work on the workflow. Will refer to it for the build pipeline. Thanks

LabhanshAgrawal avatar May 05 '22 13:05 LabhanshAgrawal

Also hyper needs to accept arch as a variable or an argument instead of an array as in electron-builder.json since this at present builds for all architectures listed in the array instead fro anly a single architecture resulting in broken builds not built for the architecture same as the host.

@LabhanshAgrawal What are your thoughts on this?? This also makes my workflow unnecessarily complex by necessarily editing electron-builder.json using sed

Jai-JAP avatar May 05 '22 14:05 Jai-JAP

I'll use electron builder cli preferably and add the commands to package json

LabhanshAgrawal avatar May 05 '22 14:05 LabhanshAgrawal

Main issue I had was getting an arm environment Tried few actions from the GitHub actions marketplace to set up qemu etc to no luck, and ended up with the circleci build as its on actual Arm hardware.

LabhanshAgrawal avatar May 05 '22 14:05 LabhanshAgrawal

@LabhanshAgrawal I think replacing https://github.com/vercel/hyper/blob/canary/electron-builder.json#L22-L50 with

"target": [ "deb", "AppImage", "rpm", "snap" ]

Will do the thing

We may have to add --x64 , --arm64 or --armv7l to yarn run dist though, if electron builder doesnot automatically detect platform arch

Also can you add "pacman" target for linux in electron-builder.json

Jai-JAP avatar May 05 '22 14:05 Jai-JAP

the target thing sounds good for the pacman target, what would it output exactly? wouldn't pacman require publishing to AUR?

LabhanshAgrawal avatar May 05 '22 20:05 LabhanshAgrawal

the target thing sounds good for the pacman target, what would it output exactly? wouldn't pacman require publishing to AUR?

No. It will build a .pacman app installer for archlinux and you can just install them by pacman -U <path to *.pacman>

Jai-JAP avatar May 06 '22 04:05 Jai-JAP

Also can you add armv7l linux builds to workflows and releases

Jai-JAP avatar May 06 '22 11:05 Jai-JAP

Also can you add armv7l linux builds to workflows and releases

sure

LabhanshAgrawal avatar May 06 '22 11:05 LabhanshAgrawal

@LabhanshAgrawal how's the progress going???

Jai-JAP avatar Jun 22 '22 04:06 Jai-JAP

@LabhanshAgrawal how's the progress going???

Not much really, caught up with new job, will pick this up again soon.

LabhanshAgrawal avatar Jun 22 '22 04:06 LabhanshAgrawal

I've opened https://github.com/vercel/hyper/pull/7227 for this Please try the build from that PR and check if it works for you. (you can find it from the checks section or from the latest comment by github actions bot.)

LabhanshAgrawal avatar Jun 11 '23 09:06 LabhanshAgrawal

@LabhanshAgrawal It's still not working and gives the same error. I tried many different solutions to cross-compile, but none works. The only thing that works is building in a chroot. This is what I currently do here

Jai-JAP avatar Jun 12 '23 08:06 Jai-JAP

That's strange, I tried it in qemu and it was ok, some people were able to use deb and others AppImage. Can you post the error again, it might be a bit different. also what does the file command say for app.asar/node_modules/node-pty/build/Release/pty.node and app.asar/node_modules/node-pty/bin/*/*.node

LabhanshAgrawal avatar Jun 12 '23 10:06 LabhanshAgrawal

btw, why do you downgrade to electron 17 in your script?

LabhanshAgrawal avatar Jun 12 '23 10:06 LabhanshAgrawal

btw, why do you downgrade to electron 17 in your script?

I was unable to compile hyper and a few other software for armhf with electron > v17

Jai-JAP avatar Jun 12 '23 11:06 Jai-JAP

weird. anyways, can you try the builds from https://github.com/LabhanshAgrawal/hyper/actions/runs/5242933057#artifacts as well, these have node-pty rebuilt in qemu instead of cross compilation

LabhanshAgrawal avatar Jun 12 '23 11:06 LabhanshAgrawal

 $ file ./app.asar.unpacked/node_modules/node-pty/build/Release/pty.node 
./app.asar.unpacked/node_modules/node-pty/build/Release/pty.node: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, BuildID[sha1]=96909d49208e564bacc60831cbb8b9035f4b7cb4, not stripped
 $ file ./app.asar.unpacked/node_modules/node-pty/bin/*/*.node
./app.asar.unpacked/node_modules/node-pty/bin/linux-x64-116/node-pty.node: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=aeb70932fabde9e9912e7217c25c37fd32bbdd1e, not stripped

I guess that arm64 versions are being built indeed but not used as they are not in bin folder

Jai-JAP avatar Jun 12 '23 11:06 Jai-JAP

the files from build/Release are used to run node-pty. The ones in bin are prebuilt ones. Do try the qemu builds as well.

LabhanshAgrawal avatar Jun 12 '23 11:06 LabhanshAgrawal

I don't know what went wrong the last time, but the builds from your PR do work. Thanks a lot for your efforts.

Jai-JAP avatar Jun 12 '23 12:06 Jai-JAP

Oh, great. Which one worked for you? also did you try the other one?

We have 3 approaches cross compile - #7227 compile node-pty on qemu - LabhanshAgrawal/hyper/actions/runs/5242933057#artifacts build everything on qemu - still working on it https://github.com/LabhanshAgrawal/hyper/actions/runs/5243597523 https://github.com/LabhanshAgrawal/hyper/actions/workflows/nodejs.yml?query=branch%3Aarm64_snap

I'm testing everything on qemu, but it'd be great if you can help test it on an actual device. They add different complexities in the build process, so I want to test them all first before deciding. Note: the qemu ones also have armhf builds. So if you can help out with testing these, it'd be a great help, as I'm having issues with setting up armhf vm for testing these.

LabhanshAgrawal avatar Jun 12 '23 12:06 LabhanshAgrawal

My actual RPi is now damaged and I am trying on an ARM chroot and it works. I don't think this will make any difference

Jai-JAP avatar Jun 12 '23 16:06 Jai-JAP

I see, in that case I can just check using my vm.

Can you test the armhf ones from https://github.com/LabhanshAgrawal/hyper/actions/runs/5243597523 on chroot though, I don't have any way to test it currently. It'd most likely fail due v8 snapshots but at least it shouldn't have any issues with the node-pty module.

LabhanshAgrawal avatar Jun 12 '23 17:06 LabhanshAgrawal

@LabhanshAgrawal crossbuilding works just fine in recent electron/node versions. Also can you try cross building hyper armhf with latest electron as native building with latest electron versions still fails for me on qemu. I'll try that armhf build later.

EDIT: Looks like the build failed

Jai-JAP avatar Jun 12 '23 18:06 Jai-JAP

my bad, please try the builds from https://github.com/LabhanshAgrawal/hyper/actions/runs/5258908433#artifacts it has both arm64 and armhf builds

LabhanshAgrawal avatar Jun 13 '23 16:06 LabhanshAgrawal