yetone / avante.nvim

Use your Neovim like using Cursor AI IDE!
Apache License 2.0
7.25k stars 270 forks source link

bug: avante.nvim can't start inside ubuntu 22.04 arm64 #741

Open ghosert opened 1 month ago

ghosert commented 1 month ago

Describe the bug

I saw the same issue with this one: https://github.com/yetone/avante.nvim/issues/684

but it happens inside Ubuntu 22.04 arm64. It could be reproduced in the host Macbook M3 Pro or the host Android phone. Both hosts are ARM64 architectures, and the docker guest OS is Ubuntu 22.04 arm64.

Neovim inside guest os ubuntu 22.04 is built from neovim source code.

I eventually resolved this issue by building avante.nvim from source code inside guest OS like:

make BUILD_FROM_SOURCE=true

but would like to check if this could be avoided since compiling sources usually takes time.

To reproduce

  1. find a Macbook M chip-based machine
  2. Install docker and start a simple Ubuntu 22.04 docker container, by default this Ubuntu is arm64-based since the host is an M chip-based machine.
  3. Inside docker container, install neovim 0.10.1+ and avante.nvim
  4. You will see avante.nvim fails to start with the same error reported in https://github.com/yetone/avante.nvim/issues/684
  5. My guess is regardless of docker, the same issue may be reproduced in Ubuntu 22.04 arm64, please help double-check.

Expected behavior

avante.nvim should be able to start inside Ubuntu 22.04 arm64-based machine

Installation method

Use lazy.nvim:

{
  "yetone/avante.nvim",
  event = "VeryLazy",
  lazy = false,
  version = false, -- set this if you want to always pull the latest change
  opts = {
    -- add any opts here
  },
  -- if you want to build from source then do `make BUILD_FROM_SOURCE=true`
  build = "make",
  -- build = "powershell -ExecutionPolicy Bypass -File Build.ps1 -BuildFromSource false" -- for windows
  dependencies = {
    "nvim-treesitter/nvim-treesitter",
    "stevearc/dressing.nvim",
    "nvim-lua/plenary.nvim",
    "MunifTanjim/nui.nvim",
  },
}

Environment

neovim: 0.10.1+, my neovim is installed from neovim source codes, not sure if the same error happens from apt install neovim OS: Ubuntu 22.04 arm64

Repro

No response

yuchanns commented 1 month ago

The bug is confirmed: the Linux Aarch64 artifact downloaded from the release has the wrong architecture.

$ file avante_repo_map.so
avante_repo_map.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=7206c1188027a8a8e00385c612064599b9227481, not stripped

https://github.com/yetone/avante.nvim/blob/9de95f9e021c0f1c5f200f8fcb46030f38deacc8/.github/workflows/release.yaml#L97

The build script should specify the --target in an x86_64 host. Besides, to build Aarch Linux, gcc-aarch64-linux-gnu is required.

FYI: https://github.com/apache/opendal-go-services/blob/57c42a0fb656977bcbb5c60492528895e8826d30/.github/workflows/build_artifacts.yaml#L91 https://github.com/apache/opendal-go-services/blob/57c42a0fb656977bcbb5c60492528895e8826d30/.github/workflows/build_artifacts.yaml#L69

I could submit a change tomorrow.

cc @yetone

yuchanns commented 1 month ago

UPDATE Well, there is a cross-compile issue. The tokenizers crate with http feature enabled depends on hf-hub, which depends on OpenSSL. OpenSSL has a well-known problem with cross-compilation.

FYI:

We can take a try on: https://github.com/255doesnotexist/lintestor/issues/22

aarnphm commented 3 weeks ago

Hmm let me try to see if I can depend on tokio for tokenizers

ghosert commented 2 weeks ago

This was reported for two weeks. I've mentioned it could be resolved by

make BUILD_FROM_SOURCE=true

but it's not an ideal solution.

Is this hard to resolve?