valentjn / vscode-ltex

LTeX: Grammar/spell checker :mag::heavy_check_mark: for VS Code using LanguageTool with support for LaTeX :mortar_board:, Markdown :pencil:, and others
https://valentjn.github.io/ltex
Mozilla Public License 2.0
815 stars 29 forks source link

Linux-based Devcontainer on arm-based Mac: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory #861

Open pstoeckle opened 1 year ago

pstoeckle commented 1 year ago

Describe the bug

I added the extension to the extensions list of a devcontainer.json. After the devaontainer is loaded, the extension is failing with the following log.

2023-11-15T20:38:12.997Z Info: Setting LTeX UI language to 'en'.
2023-11-15T20:38:12.997Z Info: Loading i18n messages...
2023-11-15T20:38:12.997Z Info: Loading default i18n messages...
2023-11-15T20:38:12.998Z Info: 
2023-11-15T20:38:12.999Z Info: ltex.ltex-ls.path not set.
2023-11-15T20:38:12.999Z Info: Searching for ltex-ls in '/home/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib'...
2023-11-15T20:38:12.999Z Info: ltex-ls found in '/home/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2023-11-15T20:38:12.999Z Info: 
2023-11-15T20:38:12.999Z Info: Using ltex-ls from '/home/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2023-11-15T20:38:12.999Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2023-11-15T20:38:13.000Z Info: Testing ltex-ls...
2023-11-15T20:38:13.000Z Info:   Command: "/home/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/bin/ltex-ls"
2023-11-15T20:38:13.000Z Info:   Arguments: ["--version"]
2023-11-15T20:38:13.000Z Info:   env['JAVA_HOME']: undefined
2023-11-15T20:38:13.000Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2023-11-15T20:38:13.015Z Error: Test failed.
2023-11-15T20:38:13.016Z Error: Error details:
2023-11-15T20:38:13.016Z Info: ltex-ls terminated with non-zero exit code 255.
2023-11-15T20:38:13.016Z Info: stdout of ltex-ls:
2023-11-15T20:38:13.016Z Info: 
2023-11-15T20:38:13.016Z Info: stderr of ltex-ls:
2023-11-15T20:38:13.016Z Info: qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory
2023-11-15T20:38:13.016Z Info: 
2023-11-15T20:38:13.016Z Info: You might want to try offline installation, see https://valentjn.github.io/vscode-ltex/docs/installation-and-usage.html#offline-installation.

Potential Problem

I'm working on an arm-based macOS. Thus, I think the problem is here. Since the plugin is running within the Linux-based devcontainer, it downloads the latest Linux-version of the plugin.

Steps to reproduce

Steps to reproduce the behavior:

  1. Create a .devcontainer/devcontainer.json with

    {
    "customizations": {
        "vscode": {
            "extensions": [
                "DavidAnson.vscode-markdownlint",
                "valentjn.vscode-ltex"
            ],
     }
     ...
     "image": "mcr.microsoft.com/devcontainers/python:1-3.9-bookworm"
    }
  2. Command Dev Containers: Rebuild and Reopen in Container
  3. After the devcontainer has been built, and VSCode has been loaded in the devcontainer, open any Markdown file. Wait for the download to finish.
  4. You will get an error.

Expected behavior

Normal hints as in VScode with the devcontainer.

** Potential Fix

  1. Install Java on the devcontainer, e.g., via this feature.
  2. Add "ltex.java.path": "/usr/local/sdkman/candidates/java/current/" to the customizations.vscode.settings in the devcontainer.json.

Version information List here the version information of the relevant software.

Additional context/information

I really like this extension! Thanks for working on it!

CheariX commented 3 months ago

I stumbled on the same problem some time ago. For the Record:

The issue is that the ltex cannot find java.

You can specify the java path in devcontainer.json like this:

"ltex.java.path": "/usr/lib/jvm/msopenjdk-current",

Note that some images do not ship Java per default. I noticed also differences in versions, e.g. x86 Debian shipped Java while the corresponding aarch64 variant does not. For this reason, I use mcr.microsoft.com/vscode/devcontainers/java:17-bullseye in my LaTex Containers.

Not directly related to this issue, but there is also https://github.com/prulloac/devcontainer-features/tree/main/src/latex Haven't tried it yet, but maybe interesting for some people in case you don't want to install your LaTeX distribution manuallay via apt.