helix: Misbeavings with target x86_64-unknown-linux-musl
Reproduction steps
I managed to build helix editor v0.6.0 with target set to x86_64-unknown-linux-musl.
Here’s the Dockerfile. If I extract the binary from the built image and I run it on my Ubuntu 20.04.3 LTS desktop for instance, it works as expected. It did not under the Alpine Linux v3.15.0 container. The theme doesn’t seem to be applied as well as the syntax highlighting.
Build the above Dockerfile:
docker build \
--file ./Dockerfile \
--pull -t "<DOCKER-IMAGE-NAME>" .
… and run the container with the following:
docker run --rm -it <DOCKER-IMAGE-NAME> /bin/ash
From within the running container download an example file:
wget https://raw.githubusercontent.com/lanceschi/threejs-ply-loader/develop/tests/index.spec.js
Open it verbosely:
./hx -vvv index.spec.js
Here’s a screenshot:

Here the content of Alpine Linux file ~/.cache/helix/helix.log:
2022-01-29T19:28:27.724 helix_core::syntax [INFO] Error opening dynamic library "/helix-v0.6.0/runtime/grammars/javascript.so"
2022-01-29T19:28:27.725 helix_view::editor [ERROR] Failed to initialize the LSP for `source.js` { LSP not defined }
2022-01-29T19:28:27.725 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-01-29T19:28:27.725 mio::poll [TRACE] registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
2022-01-29T19:28:27.725 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-01-29T19:28:27.725 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE
2022-01-29T19:30:05.388 mio::poll [TRACE] deregistering event source from poller
2022-01-29T19:30:05.388 mio::poll [TRACE] deregistering event source from poller
Here’s the screenshot of the same file opened with the same musl binary on the host Ubuntu 20.04.3 LTS:

Here’s the Ubuntu log ~/.cache/helix/helix.log:
2022-01-29T20:41:31.821 helix_core::syntax [INFO] Error opening dynamic library "/home/luca/dev/tools-in-rust/helix-editor-musl2/dist/helix-v0.6.0/runtime/grammars/javascript.so"
2022-01-29T20:41:31.822 helix_view::editor [ERROR] Failed to initialize the LSP for `source.js` { LSP not defined }
2022-01-29T20:41:31.822 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE | WRITABLE
2022-01-29T20:41:31.822 mio::poll [TRACE] registering event source with poller: token=Token(2), interests=READABLE | WRITABLE
2022-01-29T20:41:31.822 mio::poll [TRACE] registering event source with poller: token=Token(0), interests=READABLE
2022-01-29T20:41:31.822 mio::poll [TRACE] registering event source with poller: token=Token(1), interests=READABLE
2022-01-29T20:41:33.929 mio::poll [TRACE] deregistering event source from poller
2022-01-29T20:41:33.929 mio::poll [TRACE] deregistering event source from poller
Environment
- Platform: Alpine Linux v3.15.0
- Terminal emulator: Terminator (and WezTerm)
- Helix version: helix v0.6.0-dirty
Thanks 💯 for the awesome app!!!
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 20 (6 by maintainers)
I’ve packaged Helix in Alpine Linux (package helix), so you don’t have to build it yourself anymore. It’s currently in the testing repo, I’m gonna move it to the community repo soon.
testing/helix in the Alpine aports repository. However, you will not find anything special here. Maybe the key difference is that you build it with the stock rustc instead of rustc from Alpine package.
export COLORTERM=truecolordid the trick for me. Thanks @jirutkaI just tried it on my Alpine desktop in Kitty terminal and I see a purple background.
Relevant env. variables:
I don’t understand what’s unclear on this. They are packaged separately, i.e. there are packages tree-sitter-rust, tree-sitter-ruby etc. which you can install to get syntax highlighting for the given languages. Or you can install
tree-sitter-grammarswhich will install all tree-sitter grammar packages available in the Alpine repository. Packages are installed usingapk add, as you already did to install helix itself.Thanks, I’ll fix this. The problem here is that helix foolishly reads its own version during the build from a git repository where the sources are unpacked. This version (v3.15.0-5432-gd33618c49f) actually comes from our aports repository, where build recipes are stored and packages are built from.
Ah I see, maybe it’s related to #1028 then.