-
Notifications
You must be signed in to change notification settings - Fork 287
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
bug: issues building on aarch64 within a proot-distro alias of Debian GNU/Linux proot chroot in an unrooted Termux #890
Comments
Though the people I based this ollama config on: ...favoured the copilot API endpoints, I noted that my research seems to point to favouring openai. But, following them as they got their locally served ollama configs working with the copilot API parser endpoints, I have rolled with that. The patches that I endeavoured to fix the broken Termux Debian proot chroot build of the plugin in the config have not worked. When I try to chat with qwen, errors are generated in Neovim. This is the base config I have settled on. I think it is conforming with your project. There are no Lua syntax in it: -- File: /lua/plugins/extras/coding/ai/avante.lua
-- Configured to use Copilot API endpoints while retaining Ollama model and endpoint
---@class AvanteProvider
---@field local boolean
---@field endpoint string
---@field model string
---@class AvanteConflictHighlights
return {
{
"yetone/avante.nvim",
event = "VeryLazy",
lazy = false,
version = false, -- set this if you want to always pull the latest changes
opts = {
provider = "copilot", -- Changed from "openai" to "copilot"
use_absolute_path = true,
vendors = {
---@type AvanteProvider
copilot = { -- Changed key from "openai" to "copilot"
["local"] = true,
endpoint = "http://127.0.0.1:11434", -- Retained Ollama's endpoint
model = "qwen2.5-coder:1.5b", -- Retained Ollama's model
parse_curl_args = function(opts, code_opts)
return {
url = opts.endpoint .. "/chat/completions",
headers = {
["Accept"] = "application/json",
["Content-Type"] = "application/json",
},
body = {
model = opts.model,
messages = require("avante.providers").copilot.parse_messages(code_opts), -- Updated to use copilot parser
max_tokens = 4096, -- Adjust as needed
temperature = 0.6, -- Proper scaling
stream = true,
},
}
end,
parse_response_data = function(data_stream, event_state, opts)
require("avante.providers").copilot.parse_response(data_stream, event_state, opts) -- Updated to use copilot parser
end,
},
},
behaviour = {
auto_suggestions = true, -- Experimental stage
auto_set_highlight_group = true,
auto_set_keymaps = true,
auto_apply_diff_after_generation = true,
support_paste_from_clipboard = true,
},
mappings = {
--- @class AvanteConflictMappings
diff = {
ours = "co",
theirs = "ct",
all_theirs = "ca",
both = "cb",
cursor = "cc",
next = "]x",
prev = "[x",
},
suggestion = {
accept = "<M-l>",
next = "<M-]>",
prev = "<M-[>",
dismiss = "<C-]>",
},
jump = {
next = "]]",
prev = "[[",
},
submit = {
normal = "<CR>",
insert = "<C-s>",
},
},
hints = { enabled = true },
windows = {
---@type "right" | "left" | "top" | "bottom"
position = "right", -- the position of the sidebar
wrap = true, -- similar to vim.o.wrap
width = 30, -- default % based on available width
sidebar_header = {
align = "center", -- left, center, right for title
rounded = true,
},
},
highlights = {
---@type AvanteConflictHighlights
diff = {
current = "DiffText",
incoming = "DiffAdd",
},
},
--- @class AvanteConflictUserConfig
diff = {
autojump = true,
---@type string | fun(): any
list_opener = "copen",
},
},
-- Build from source if necessary
build = function()
-- Build from source and reapply custom patches
vim.fn.system(
"make BUILD_FROM_SOURCE=true && sh $HOME/.config/b9Joker108/my.neovim.config/patches/avante.lua/apply_patches.sh"
)
end,
-- Dependencies required for full functionality
dependencies = {
"nvim-treesitter/nvim-treesitter",
"stevearc/dressing.nvim",
"nvim-lua/plenary.nvim",
"MunifTanjim/nui.nvim",
--- Optional dependencies
"nvim-tree/nvim-web-devicons", -- or echasnovski/mini.icons
{
-- 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,
},
},
},
{
-- Markdown rendering support
"MeanderingProgrammer/render-markdown.nvim",
opts = {
file_types = { "markdown", "Avante" },
},
ft = { "markdown", "Avante" },
},
},
-- Keybindings for Avante
keys = {
{
"<leader>aa",
function()
require("avante.api").ask()
end,
desc = "avante: ask",
mode = { "n", "v" },
},
{
"<leader>ar",
function()
require("avante.api").refresh()
end,
desc = "avante: refresh",
},
{
"<leader>ae",
function()
require("avante.api").edit()
end,
desc = "avante: edit",
mode = "v",
},
},
},
} |
After a successful manual build, well a build with no errors or warnings in verbose logging and doing only a Lazy sync with the local files, this is the error that was generated on executing Neovim: Error executing vim.schedule lua callback: ...y.neovim.config/lazy/avante.nvim/lua/avante/repo_map.lua:23: Failed
to load avante_repo_map
stack traceback:
[C]: in function 'error'
...y.neovim.config/lazy/avante.nvim/lua/avante/repo_map.lua:23: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0>
...108/my.neovim.config/lazy/avante.nvim/lua/avante/llm.lua:45: Make sure to build avante (missing
avante_templates)
3 stack traceback:
4 > [C]: in function 'error'
5 > ...08/my.neovim.config/lazy/avante.nvim/lua/avante/path.lua:96: in function 'get'
6 > ...108/my.neovim.config/lazy/avante.nvim/lua/avante/llm.lua:45: in function '_stream'
7 > ...108/my.neovim.config/lazy/avante.nvim/lua/avante/llm.lua:365: in function 'stream'
8 > ...neovim.config/lazy/avante.nvim/lua/avante/suggestion.lua:70: in function 'suggest'
9 > ...neovim.config/lazy/avante.nvim/lua/avante/suggestion.lua:282: in function 'func'
10 > ...neovim.config/lazy/avante.nvim/lua/avante/utils/init.lua:556: in function <...neovim.config/lazy/avante.
nvim/lua/avante/utils/init.lua:555> |
Describe the bug
Issues building on aarch64 within a proot-distro alias of Debian GNU/Linux proot chroot guest of an unpriviliged user in an unrooted Termux host environment. I have pretty much the same bug as this other Android Termux user:
#879
I have left a comment on the closed issue for them to respond, outlining if they could please advise how they resolved the issue, as they have not included any specifics when they closed the issue to say how it was resolved.
The error from within Noice:
Now, I tweaked a few files of the install in ~/.local..., as follows to get a successful build manually:
Cargo.toml
/home/hummingbird108/.local/share/b9Joker108/my.neovim.config/lazy/avante.nvim/Cargo.toml
lib.rs
/home/hummingbird108/.local/share/b9Joker108/my.neovim.config/lazy/avante.nvim/crates/avante-templates/src/lib.rs
Here's a summary of the tweaks made to the
avante.nvim
plugin to get it to build:Apply changes to
Cargo.toml
mlua
dependency with specific features to ensure compatibility with Lua 5.4 and module support.Update
lib.rs
mlua
andminijinja
libraries.State
struct to handle the environment with a mutex for thread safety.TemplateContext
struct for template rendering.render
andinitialize
functions for rendering templates and initializing the environment.avante_templates
function to register the Lua module with the required functionality.from_value
to convert Lua values toTemplateContext
.Rebuild the plugin
cargo build --release
to compile the plugin with the new changes.But, I am not sure how best to apply this fix to the automatically generated builds requested from avante.lua going forward and also, even whether I should instigate a patch and dynamic build shell script to handle this process or if there is more appropriate and elegant solution. My Lua, Rust, Cargo and Neovim skills are not very refined and I am far from even being of intermediate level, but I give it a go.
To reproduce
I got most of this code from another user who included it in Discussion and adapted it:
Expected behavior
I just want a successful, straightforward build. I tweaked with some code in a few files and got it to build successfully through manual intervension, and then saved the tweaks and am contemplating how I can make a dynamic and adaptive patch and script going forward, but I am not adept at any of this and wonder if there isxa quicker, easier, more robust and rigorous solution, because the build happens every time I use Neovim with this plugin enabled.
Installation method
I use the lazy.nvim framework ans the Lazy package manager:
Lazy build failed message:
avante.nvim 1070.69ms start ■ build failed
cargo build --release --features=luajit -p avante-tokenizers
Compiling proc-macro2 v1.0.86
Compiling unicode-ident v1.0.12
Compiling shlex v1.3.0
Compiling libc v0.2.158
Compiling pkg-config v0.3.30
Compiling cfg-if v1.0.0 Compiling memchr v2.7.4 Compiling cc v1.1.21 Compiling serde v1.0.209 Compiling autocfg v1.3.0
Compiling vcpkg v0.2.15 Compiling byteorder v1.5.0
Compiling crossbeam-utils v0.8.20
Compiling getrandom v0.2.15
Compiling aho-corasick v1.1.3
Compiling quote v1.0.37
Compiling ring v0.17.8
Compiling openssl-sys v0.9.103
Compiling syn v2.0.77
Compiling regex-syntax v0.8.5
Compiling tinyvec_macros v0.1.1
Compiling once_cell v1.19.0
Compiling fnv v1.0.7
Compiling strsim v0.11.1
Compiling ident_case v1.0.1
Compiling tinyvec v1.8.0
Compiling regex-automata v0.4.8
Compiling foreign-types-shared v0.1.1
Compiling rustls-pki-types v1.8.0
Compiling darling_core v0.20.10
Compiling untrusted v0.9.0
Compiling smallvec v1.13.2
Compiling openssl v0.10.66
Compiling serde_derive v1.0.209
Compiling zerocopy-derive v0.7.35
Compiling either v1.13.0
Compiling spin v0.9.8
Compiling darling_macro v0.20.10
Compiling zerocopy v0.7.35
Compiling openssl-macros v0.1.1
Compiling foreign-types v0.3.2
Compiling unicode-normalization v0.1.23
Compiling crossbeam-epoch v0.9.18
Compiling lock_api v0.4.12
Compiling num-traits v0.2.19
Compiling rustls v0.23.12
Compiling rayon-core v1.12.1
Compiling portable-atomic v1.7.0
Compiling percent-encoding v2.3.1
Compiling unicode-bidi v0.3.15
Compiling native-tls v0.2.12
Compiling adler2 v2.0.0
Compiling lazy_static v1.5.0
Compiling log v0.4.22
Compiling parking_lot_core v0.9.10
Compiling bitflags v2.6.0
Compiling serde_json v1.0.127 Compiling rustls-webpki v0.102.7
Compiling miniz_oxide v0.8.0 Compiling idna v0.5.0
Compiling form_urlencoded v1.2.1
Compiling crossbeam-deque v0.8.5
Compiling ppv-lite86 v0.2.20
Compiling darling v0.20.10
Compiling rand_core v0.6.4
Compiling onig_sys v69.8.1
Compiling crc32fast v1.4.2
Compiling zeroize v1.8.1
Compiling paste v1.0.15
Compiling subtle v2.6.1
Compiling ryu v1.0.18
Compiling typeid v1.0.2
Compiling thiserror v1.0.65
Compiling openssl-probe v0.1.5
Compiling bit-vec v0.6.3
Compiling scopeguard v1.2.0
Compiling itoa v1.0.11
Compiling unicode-width v0.1.13
Compiling option-ext v0.2.0
Compiling dirs-sys v0.4.1
Compiling console v0.15.8
Compiling bit-set v0.5.3
Compiling mlua-sys v0.6.4
Compiling flate2 v1.0.33
Compiling rand_chacha v0.3.1
Compiling derive_builder_core v0.20.1
Compiling url v2.5.2
Compiling thiserror-impl v1.0.65
Compiling webpki-roots v0.26.5
Compiling esaxx-rs v0.1.10
Compiling socks v0.3.4
Compiling base64 v0.22.1
Compiling anyhow v1.0.86
Compiling number_prefix v0.4.0
Compiling minimal-lexical v0.2.1
Compiling indicatif v0.17.8
Compiling nom v7.1.3
Compiling ureq v2.10.1
Compiling parking_lot v0.12.3
Compiling ordered-float v2.10.1
Compiling rayon v1.10.0
Compiling derive_builder_macro v0.20.1
Compiling rand v0.8.5
Compiling fancy-regex v0.13.0
Compiling dirs v5.0.1 Compiling itertools v0.11.0
Compiling monostate-impl v0.1.13 Compiling bstr v1.10.0
Compiling regex v1.11.1
Compiling macro_rules_attribute-proc_macro v0.2.0
Compiling unicode-segmentation v1.11.0
Compiling bitflags v1.3.2
Compiling base64 v0.13.1
Compiling monostate v0.1.13
Compiling bstr v1.10.0 Compiling regex v1.11.1
Compiling macro_rules_attribute-proc_macro v0.2.0
Compiling unicode-segmentation v1.11.0
Compiling bitflags v1.3.2
Compiling base64 v0.13.1
Compiling monostate v0.1.13
Compiling rayon-cond v0.3.0
Compiling macro_rules_attribute v0.2.0
Compiling spm_precompiled v0.1.4
Compiling erased-serde v0.4.5
Compiling hf-hub v0.3.2
Compiling derive_builder v0.20.1
Compiling serde-value v0.7.0
Compiling itertools v0.12.1
Compiling mlua_derive v0.10.0
Compiling unicode-normalization-alignments v0.1.12
Compiling rustc-hash v2.0.0
Compiling unicode_categories v0.1.1
Compiling base64 v0.21.7
Compiling rustc-hash v1.1.0
Compiling mlua v0.10.0
Compiling tiktoken-rs v0.6.0
Compiling onig v6.4.0
Compiling tokenizers v0.20.0
nvim/lazy/avante.nvim/crates/avante-tokenizers)
Finished
release
profile [optimized] target(s) in 1m 28scp target/release/libavante_tokenizers.so build/avante_tokenizers.so
cargo build --release --features=luajit -p avante-templates
Compiling version_check v0.9.4
Compiling syn v2.0.77
Compiling v_htmlescape v0.15.8
Compiling bstr v1.10.0 Compiling memo-map v0.3.3
Compiling aho-corasick v1.1.3 Compiling self_cell v1.0.4
Compiling unicode-ident v1.0.12
Compiling unicase v2.7.0
Compiling serde_derive v1.0.209
Compiling mlua_derive v0.10.0
Compiling serde v1.0.209
Compiling serde_json v1.0.127
Compiling erased-serde v0.4.5
Compiling serde-value v0.7.0
Compiling mlua v0.10.0
Compiling minijinja v2.4.0
Compiling avante-templates v0.1.0 (/home/hummingbird108/.local/share/
nvim/lazy/avante.nvim/crates/avante-templates)
Finished
release
profile [optimized] target(s) in 24.32scp target/release/libavante_templates.so build/avante_templates.so
cargo build --release --features=luajit -p avante-repo-map
Compiling tree-sitter-language v0.1.0
Compiling aho-corasick v1.1.3
Compiling regex-syntax v0.8.5
Compiling tree-sitter-c v0.23.1
Compiling tree-sitter-typescript v0.23.0
Compiling tree-sitter-ruby v0.23.0
Compiling tree-sitter-scala v0.23.2
Compiling tree-sitter-javascript v0.23.0
Compiling tree-sitter-lua v0.2.0
Compiling tree-sitter-go v0.23.1
Compiling tree-sitter-rust v0.23.0
Compiling tree-sitter-zig v1.0.2
Compiling tree-sitter-python v0.23.2
Compiling tree-sitter-cpp v0.23.1
Compiling tree-sitter v0.23.0
Compiling regex-automata v0.4.8
make: *** [Makefile:57: luajit-repo-map] Terminated
Process was killed because it reached the timeout
934602b fix: fix installation build in powershell (windows) (24 hours
ago)
341ecd2 feat: minimal diff (#583) (2 days ago)
2863473 fix: do not ignore curl error (#877) (4 days ago)
56ebcad fix: must not be called in a lua loop (#876) (4 days ago)
5dd4254 fix: use relative path (#875) (4 days ago)
d17905a fix(doc): vim-plug missing setup (#873) (4 days ago)
3c010e3 feat: update copilot model version (#872) (5 days ago)
3beed68 fix: copilot url join (#871) (5 days ago)
Repro
The text was updated successfully, but these errors were encountered: