LuaLS / LuaLS/lua-language-server
Couldn't start client Lua from VSCode devcontainer
Nobody has claimed this yet.
- Dominant language
- Lua
- Stars
- 4.4k
- Forks
- 442
- PR merge metrics
- No merged PRs in 30d
Description
### How are you using the lua-language-server?
Visual Studio Code Extension (sumneko.lua)
### Which OS are you using?
Linux
### What is the issue affecting?
Other
### Expected Behaviour
Lua language server starts correctly.
### Actual Behaviour
I see this message when opening a Lua file, and language linting is not available:

### Reproduction steps
1. Add a Dockerfile in .devcontainer folder, I'm using this:
```
FROM python:3.8-alpine as build
LABEL description="Dev container - test-sumneko"
ARG USERNAME=vscode
ARG USER_UID=1000
ARG USER_GID=$USER_UID
RUN addgroup -g $USER_GID $USERNAME && adduser -D -u $USER_UID -G $USERNAME $USERNAME
USER $USERNAME
CMD ["sh"]
```
3. Specify sumneko extension in devcontainer.json:
```
{
"customizations": {
"vscode": {
"extensions": [
"sumneko.lua"
]
}
}
}
```
4. Do `Rebuild and Reopen in Container` from command palette
5. Open any `.lua` file in the workspace
### Additional Notes
`lua-language-server` seems there but it gives a strange `not found` error when launched:
```shell
/workspaces/test-sumneko $ /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server
/bin/ash: /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: not found
/workspaces/test-sumneko $ ls -la /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server
-rwxrwxrwx 1 vscode vscode 2068664 Nov 21 11:24 /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server
```
As current workaround I'm adding this in Dockerfile:
```
RUN apk add --update --no-cache --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing/ lua-language-server
```
and this in `devcontainer.json`:
```
"postCreateCommand": "sleep 10 && rm -vf /home/vscode/.vscode-server/extensions/sumneko.lua-*/server/bin/Linux/lua-language-server && ln -s /usr/bin/lua-language-server /home/vscode/.vscode-server/extensions/sumneko.lua-*/server/bin/Linux/",
```
Version used: `sumneko.lua-2.5.3`
### UPDATE
Looking around, seems this is the root cause:
> this can happen if binary is linked with a libc that doesn't exist on your device.
In fact:
```
/workspaces/test-sumneko $ ldd
musl libc (x86_64)
Version 1.2.4
Dynamic Program Loader
Usage: /lib/ld-musl-x86_64.so.1 [options] [--] pathname
/workspaces/test-sumneko $ ldd /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server
/lib64/ld-linux-x86-64.so.2 (0x7fd02de67000)
libm.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fd02de67000)
libdl.so.2 => /lib64/ld-linux-x86-64.so.2 (0x7fd02de67000)
libpthread.so.0 => /lib64/ld-linux-x86-64.so.2 (0x7fd02de67000)
libc.so.6 => /lib64/ld-linux-x86-64.so.2 (0x7fd02de67000)
Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server)
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __longjmp_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __fprintf_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __printf_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __strftime_l: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __memcpy_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __sprintf_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __snprintf_chk: symbol not found
Error relocating /home/vscode/.vscode-server/extensions/sumneko.lua-2.5.3/server/bin/Linux/lua-language-server: __fdelt_chk: symbol not found
```
### Log File
No log file available.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with the supplied Alpine Dockerfile and devcontainer.json, then inspect the extension binary at server/bin/Linux/lua-language-server and its libc dependencies. Compare the Linux artifact with the musl environment; done means the Lua language server starts in this devcontainer without the package-install and symlink workaround.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, linux, lua, vscode
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100