Pre-compiled Neovim binaries fail on OpenWrt with interpreter/linker errors:
ei https://github.com/neovim/neovim/releases/download/nightly/nvim-linux-x86_64.tar.gz
nvim
# Error: Failed to execute process: The file exists and is executable.
# Check the interpreter or linker?
This happens due to glibc/musl incompatibility. Building from source ensures compatibility with OpenWrt's musl libc.
Prerequisites
This guide uses OpenWrt 24.10.4 x86_64. For other versions, refer to the original guide.
Installing Dependencies
Install the required build tools and libraries:
opkg update
opkg install git git-http python3 python3-pip make luajit gcc coreutils-install
pip install cmake
Fixing Missing Libraries
OpenWrt's minimal environment lacks some standard libraries that Neovim expects.
Fix Missing libdl
The dynamic linker library is built into musl but needs a stub for linking:
printf "!<arch>\n" > /usr/lib/libdl.a
This creates an empty archive that satisfies the linker without adding actual code (musl already provides dlopen and friends).
Fix Missing libutil
Create a dummy shared library for the utility functions:
echo "int main() { return 0; }" > dummy.c
gcc -shared -o /usr/lib/libutil.so dummy.c
rm dummy.c
Most libutil functions (like forkpty) are either unused by Neovim or provided by other libraries on musl systems.
Building Neovim
Clone the repository (shallow clone to save space):
git clone https://github.com/neovim/neovim --depth=1
cd neovim
Build with release optimizations and debug symbols:
make CMAKE_BUILD_TYPE=RelWithDebInfo
This takes 10-30 minutes depending on your system. The RelWithDebInfo build type provides good performance while keeping some debug information for troubleshooting.
Installing Neovim
Install to the default location:
make install
This installs to /usr/local/bin/nvim. Create a symlink for convenience:
ln -sf /usr/local/bin/nvim /usr/bin/nvim
Verify the installation:
nvim --version
Setting Up LazyVim
LazyVim is a modern Neovim configuration with sensible defaults and a plugin manager.
git clone https://github.com/LazyVim/starter --depth=1 ~/.config/nvim
On first launch, Neovim will automatically install plugins:
nvim
Installing tmux
opkg install tmux
Top comments (0)