Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(build): support riscv #814

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

goyox86
Copy link

@goyox86 goyox86 commented Nov 6, 2024

Hi there!

First of all, thanks for creating this plugin. Been using it for weeks and I love it!

I have a RISC-V workstation and I am working on adding support for Neovim and Neovim plugins that I use so everyone else also using RISC-V machines can benefit from it.

With the changes in this PR, avante builds and runs without any modification to the Rust/Lua code 🥳. It just needs a little nudge in the build scripts in RISC-V. I think it is a good middle ground to default to compile from source whenever we detect we are running on RISC-V.

I think this does not break anything in other platforms.

Sample run on my machine

avante-works-riscv.webm

Config I'm using

return {
  {
    "goyox86/avante.nvim",
    branch = "goyox86/riscv64",
    event = "VeryLazy",
    lazy = false,
    version = false, -- set this if you want to always pull the latest change
    opts = {
      -- add any opts here
    },
    -- cond = require("utils").arch() ~= "riscv64",
    -- 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 = {
      "stevearc/dressing.nvim",
      "nvim-lua/plenary.nvim",
      "MunifTanjim/nui.nvim",
      --- The below dependencies are optional,
      "nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
      "zbirenbaum/copilot.lua", -- for providers='copilot'
      {
        -- support for image pasting
        "HakonHarnes/img-clip.nvim",
        event = "VeryLazy",
        opts = {
          -- recommended settings
          default = {
            embed_image_as_base64 = false,
            prompt_for_file_name = false,
            drag_and_drop = {
              insert_mode = true,
            },
            -- required for Windows users
            use_absolute_path = true,
          },
        },
      },
      {
        -- Make sure to set this up properly if you have lazy=true
        "MeanderingProgrammer/render-markdown.nvim",
        opts = {
          file_types = { "markdown", "Avante" },
        },
        ft = { "markdown", "Avante" },
      },
    },
  },
}

Observations

  • It takes some (longish) time to compile the Rust part of it. Even the fastest current RISC-V workstations (MILK-V Pioneer), are not super fast and Rust is known for being a bit slow compiling I increased my lazy.nvim git timeout which is by default 120 seconds killing processes that last longer than that while git fetching and building. I increased it to 600 seconds in my config and is more than enough. If you keep pressing gs in the LazyVim main window it will eventually finish but that is a bit annoying. It looks something like:
require("lazy").setup({
defaults = ...,
git = {
  timeout = 600,
}
install = ...
})
NVIM v0.11.0-dev-1057+g0b7cc014f
Build type: Debug
LuaJIT 2.1.1730654311
Run "nvim -V1 -v" for more info

@aarnphm
Copy link
Collaborator

aarnphm commented Nov 7, 2024

I think this is a bit of an edge use case. But we can add a note for ppl who wants to build from RISC-V to compile from source atm. I'm sure that the RISC-V will landed in luajit soon.

For this if you want to maintain this going forward I'm happy to merge this in, otherwise we don't have bandwidth to cover all edge case atm.

@goyox86
Copy link
Author

goyox86 commented Nov 7, 2024

Sure count me in for the maintainer of all things RISC-V! 🫡

@@ -38,6 +38,9 @@ aarch64)
arm64)
ARCH="aarch64"
;;
riscv64)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you also update the CI to support riscv build?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I missed this one. I will have to check if I can use some of the QEMU based runners for GH actions. Let me take a look and will report back.

@aarnphm aarnphm changed the title Add support for building from source on RISCV. feat(build): support riscv Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants