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

Prebuilt Binaries for Android Termux (aarch64) #145

Open
ayoubelmhamdi opened this issue Oct 19, 2024 · 8 comments
Open

Prebuilt Binaries for Android Termux (aarch64) #145

ayoubelmhamdi opened this issue Oct 19, 2024 · 8 comments
Assignees

Comments

@ayoubelmhamdi
Copy link

Prebuilt Binaries for Android Termux (aarch64)

Currently, prebuilt binaries for blink.cmp are not available for Android Termux on aarch64 architecture. This forces users on this platform to build from source, which requires the nightly Rust toolchain.

Issues with Building from Source:

Installing the nightly Rust toolchain on Termux can be challenging and error-prone. Users frequently encounter issues related to dependencies and build tools.

Feature Request: Provide prebuilt binaries for Android Termux (aarch64) to eliminate the need for a nightly Rust toolchain and simplify installation and usage for users on this platform. This will significantly improve accessibility for Termux users and expand the plugin's user base.

@scottmckendry scottmckendry self-assigned this Oct 19, 2024
@scottmckendry
Copy link
Collaborator

scottmckendry commented Oct 19, 2024

@ayoubelmhamdi this should be possible. I've got the binary building in my branch here.

Can you please tell me what the output of :lua print(jit.os) & :lua print(jit.arch) is from your neovim instance in Termux?

I'll need this to update the platform detection logic so the new binary can be downloaded automatically.

@ayoubelmhamdi
Copy link
Author

ayoubelmhamdi commented Oct 19, 2024

:lua print(jit.os)

Linux

:lua print(jit.arch)

arm64

@scottmckendry
Copy link
Collaborator

Okay, slight change of approach will be required. Some more testing is needed (sorry, I don't have an android device I can personally test on).

Can you send the outputs of the following:

  • :lua print(vim.fn.has('android') == 1)
  • :lua print(vim.inspect(vim.uv.os_uname()))

@ayoubelmhamdi
Copy link
Author

ayoubelmhamdi commented Oct 19, 2024

Never mind, I am your Android device tester. Don't be shy, ask me anything.

:lua print(vim.fn.has('android') == 1)

true

:lua print(vim.inspect(vim.uv.os_uname()))
{
  machine = "aarch64",
  release = "4.14.186-perf-g15987c3eee85",
  sysname = "Linux",
  version = "#1 SMP PREEMPT Thu Jul 18 08:05:25 UTC 2024"
}

@scottmckendry
Copy link
Collaborator

Thanks @ayoubelmhamdi! Looks like we can safely use vim.has to run the OS check.

I've pushed another release to my branch so we can test versioned binaries without affecting main or needlessly creating releases here. Here's a minimal config example that should get you up and running with the latest build for Android:

{
    "scottmckendry/blink.cmp",
    lazy = false,
    version = "1.*",
    opts = {},
}

Important

Make sure you check the repo name and version. These need to be set exactly as above to test the new binary correctly. If you've already got the main branch installed via Lazy, you'll need to remove it and add it again to fix the error when changing origin.

Let me know how it goes! If you encounter any errors, please post them here.

@ayoubelmhamdi
Copy link
Author

ayoubelmhamdi commented Oct 20, 2024

it's seem that everything install correctly, however the first keystroke give me this error:

 Error detected while processing TextChangedI Autocommands for "*":
Error executing lua callback: error loading module 'blink_cmp_fuzzy' from file '/data/data/com.termux/files/home/.local/share/nvim-ayoub/lazy/blink.cmp/lua/blink/cm
p/fuzzy/../../../../target/release/libblink_cmp_fuzzy.so':
        dlopen failed: cannot locate symbol "lua_pushboolean" referenced by "/data/data/com.termux/files/home/.local/share/nvim-ayoub/lazy/blink.cmp/target/release/libblink_cmp_fuzzy.so"...stack traceback:
        [C]: at 0x7579d68dd4
        [C]: at 0x7579d690a4
        [C]: in function 'require'
        ...e/nvim-ayoub/lazy/blink.cmp/lua/blink/cmp/fuzzy/init.lua:8: in main chunk                                                                                        [C]: in function 'require'
        ...l/share/nvim-ayoub/lazy/blink.cmp/lua/blink/cmp/init.lua:42: in function 'update_completions'
        ...l/share/nvim-ayoub/lazy/blink.cmp/lua/blink/cmp/init.lua:57: in function 'on_show'
        ...youb/lazy/blink.cmp/lua/blink/cmp/trigger/completion.lua:185: in function 'show'
        ...youb/lazy/blink.cmp/lua/blink/cmp/trigger/completion.lua:58: in function <...youb/lazy/blink.cmp/lua/blink/cmp/trigger/completion.lua:33

@ayoubelmhamdi
Copy link
Author

$ ldd target/release/libblink_cmp_fuzzy.so

        libdl.so => /system/lib64/libdl.so                                                libc.so => /system/lib64/libc.so
        ld-android.so => /system/lib64/ld-android.so
$ ld target/release/libblink_cmp_fuzzy.so


ld: warning: cannot find entry symbol _start; not setting start address
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_isstring'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_setmetatable
'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushfstring'ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushinteger'ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_gettable'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushvalue'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_xmove'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_createtable'ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_touserdata'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushcclosure
'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_insert'     ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushthread'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_tothread'   ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_gettop'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_typename'   ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_newuserdata'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushlightuse
rdata'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_getstack'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_rawseti'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushboolean'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_settable'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_settop'     ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `luaL_getmetafiel
d'                                                                                
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_rawget'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pcall'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_checkstack'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_topointer'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_concat'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_rawequal'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_toboolean'  ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_newthread'  ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_next'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_getinfo'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_getallocf'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_error'      ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_type'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_replace'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_isnumber'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_rawset'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `luaL_callmeta'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_remove'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushlstring'ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_rawgeti'    ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_tolstring'  ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `luaL_error'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_tonumber'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushnumber'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_getmetatable'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `lua_pushnil'
ld: target/release/libblink_cmp_fuzzy.so: undefined reference to `luaL_ref'

@scottmckendry
Copy link
Collaborator

Possibly a missing build flag. I've updated the cargo config to match the Linux settings and pushed another release, any difference? You might need to re-install it again.

The output of ld on Linux is similar, so I'm not 100% sure what's going on. May need some help from someone who has a bit more experience with Rust to figure it out 🤷🏻

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

No branches or pull requests

2 participants