Segfaults on musl box
Description
The shipped binary links against glibc. It segfaults when the compat layer is present. It simply fails to run otherwise.
[user@node5 ~]$ /home/user/node_modules/opencode-linux-x64/bin/opencode
-bash: /home/user/node_modules/opencode-linux-x64/bin/opencode: cannot execute: required file not found
[user@node5 ~]$ file /home/user/node_modules/opencode-linux-x64/bin/opencode
/home/user/node_modules/opencode-linux-x64/bin/opencode: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=668a1c029f30aa64ce77170cdab8fc16233395b1, not stripped
[user@node5 ~]$ /lib64/ld-linux-x86-64.so.2
-bash: /lib64/ld-linux-x86-64.so.2: No such file or directory
On a different system, running in valgrind results in:
==6016== Syscall param execve(argv) points to uninitialised byte(s)
==6016== at 0x6775B2B: ??? (in /usr/lib/ld-linux-x86-64.so.2)
==6016== by 0x1FFEFFFC77: ???
==6016== by 0x67751F1: ??? (in /usr/lib/ld-linux-x86-64.so.2)
==6016== by 0x677584A: ??? (in /usr/lib/ld-linux-x86-64.so.2)
==6016== Address 0x677b038 is in the brk data segment 0x677b000-0x677bfff
Among ways to fix this:
- Static compilation of the binary. Zig should make this easy.
- Build the binary for more libcs.
OpenCode version
1.0.20
Steps to reproduce
- Install Void Linux musl (all works fine on glibc)
npm install opencode-ai@latestnode_modules/.bin/opencode
Screenshot and/or share link
No response
Operating System
Void Linux x86_64 musl
Terminal
No response
This issue might be a duplicate of existing issues. Please check:
- #649: Same problem with Alpine Linux (musl-based distros) - binary fails to run due to glibc vs musl incompatibility
- #462: Request for static linked binaries to solve similar dynamic linking issues on NixOS
- #3540: Similar dynamic linking problems on NixOS - same class of system compatibility issue
All of these issues stem from the same root cause: OpenCode's binary is dynamically linked against glibc and cannot run on musl-based systems or systems with different library setups. The proposed solutions (static compilation or building for multiple libcs) are also consistent across these issues.
Feel free to ignore if none of these address your specific case.
That is an opentui lib issue actually, possibly because it is cross compiled. Need to pick that up in the opentui repo.