tridactyl / native_messenger

Native messenger for Tridactyl, a vim-like web-extension.
BSD 2-Clause "Simplified" License
36 stars 13 forks source link

Add arm64 linux build #69

Closed MaximilianGaedig closed 3 weeks ago

MaximilianGaedig commented 1 year ago

First of all, thank you for your amazing work, it's amazing what Tridactyl does with all the limitations for extensions.

There is currently no binary for arm64/aarch64 on linux, this is important for Asahi Linux users for example, it would be nice if they could be build in the releases.

For this a Nim nightly propably needs to be used.

I have compiled a linux aarch64 executable on my machine build in release mode (nimble -d:release), I advise you to build it yourself but if you want to trust me here it is: native_main.zip

sahinakkaya commented 1 year ago

Having the same problem. It is fixed after manually building myself. Here is my system information just for the records:

OS: Arch Linux ARM aarch64
Host: Apple MacBook Pro (14-inch, M2 Pro, 2023)
Kernel: 6.5.0-asahi-15-1-edge-ARCH
bovine3dom commented 1 year ago

Do you know what we would need to change about this line?

https://github.com/tridactyl/native_messenger/blob/6e0d2cd3bc7dab02e8e87aaaa60b52c20131db42/.github/workflows/compile.yml#L43

I think that makes it work for pinebooks but I'm not certain

sahinakkaya commented 1 year ago

Do you know what we would need to change about this line?

https://github.com/tridactyl/native_messenger/blob/6e0d2cd3bc7dab02e8e87aaaa60b52c20131db42/.github/workflows/compile.yml#L43

I think that makes it work for pinebooks but I'm not certain

I don't know if this is obvious but if I do

nimble build -d:debug -Y --cpu:arm64

I can use the resulting executable in my system without any problem

sahinakkaya commented 1 year ago

ChatGPT came up with this. I don't know a single thing about nim but it looks promising to me:

steps:
      - name: Check CPU architecture
        id: check_arch
        run: |
          if [[ $(arch) == "aarch64" ]]; then
            echo "::set-output name=cpu::arm64"
          else
            echo "::set-output name=cpu::armhf"
          fi

      - name: Install dependencies and build
        run: |
          if [[ "${{ steps.check_arch.outputs.cpu }}" == "arm64" ]]; then
            nimble build -d:debug -Y --cpu:arm64
            mv native_main native_main-arm64
            file native_main-arm64
          else
            sudo apt-get install gcc-arm-linux-gnueabihf
            nimble build -d:debug -Y --cpu:arm
            mv native_main native_main-armhf
            file native_main-armhf
          fi
        if: runner.os == 'Linux'
natebragg commented 2 months ago

Is there any hope for progress on this issue?

bovine3dom commented 2 months ago

@natebragg copy and paste L41-46 here https://github.com/tridactyl/native_messenger/blob/3059abd9fb3f14d598f6c299335c3ebac5bc689a/.github/workflows/compile.yml#L41 , change arm to arm64 and the build name to armhf64, make a PR, ping me to make it run and test the build to see if it works :)

natebragg commented 2 months ago

@bovine3dom Sorry, I'm not sure how to do that on my platform. I'm using Termux, and it does not appear to have that gnueabihf package.

bovine3dom commented 2 months ago

You don't have to run any of it, just write the code, make a PR and then test the build GitHub makes

If you're unfamiliar with git etc that might prove too complicated. I can do everything except test the build, but I'm on holiday for a couple of weeks

natebragg commented 2 months ago

@bovine3dom I do know git, but I guess I'm uncertain what the instructions are, sorry if I'm a bit dense. I'm happy to test the build though.

inkarkat commented 1 month ago

+1 for this; I use a Pinebook with Ubuntu 24.04. Manual compilation (of https://github.com/tridactyl/native_messenger/commit/3059abd9fb3f14d598f6c299335c3ebac5bc689a) worked fine, but it's a lot of manual steps.

$ sudo apt install nim
$ git clone https://github.com/tridactyl/native_messenger.git
$ cd native_messenger
$ nimble build -d:release
$ cp ./native_main ~/.local/share/tridactyl/native_main
$ file ~/.local/share/tridactyl/native_main
native_main: ELF 64-bit LSB pie executable, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=b886eabea00c986b7201d8d63f526dd22e7a340f, for GNU/Linux 3.7.0, not stripped
bovine3dom commented 3 weeks ago

@inkarkat could you try the arm64 artifact from this build? https://github.com/tridactyl/native_messenger/actions/runs/11164413608

if you could do me a favour and also give me the output of

command -v bash >/dev/null && bash -c 'echo $OSTYPE'

on your machine I would be grateful as it would let us improve the automatic installer

https://github.com/tridactyl/native_messenger/blob/e270154440e818ed27d3600c321f6a393aec53a7/installers/install.sh#L26

inkarkat commented 3 weeks ago

@bovine3dom The build's arm64 artifact is working fine, just like the one I compiled myself.

And here's the value of $OSTYPE:

$ command -v bash >/dev/null && bash -c 'echo $OSTYPE'
linux-gnu
bovine3dom commented 3 weeks ago

Brilliant, thanks. Could you confirm that uname -m returns aarch64?

inkarkat commented 3 weeks ago

Brilliant, thanks. Could you confirm that uname -m returns aarch64?

@bovine3dom Yes, it does.

$ uname -a
Linux pinebook 6.6.47-current-rockchip64 #1 SMP PREEMPT Mon Aug 19 04:04:32 UTC 2024 aarch64 aarch64 aarch64 GNU/Linux
bovine3dom commented 3 weeks ago

Thanks, I'm fighting with GitHub actions but that's really useful and we should get it working soon :)