Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LTex Extension for VSCode doesn't work properly with Apple Silicon #25

Closed
yax-lakam-tuun opened this issue Apr 24, 2023 · 1 comment · Fixed by #48
Closed

LTex Extension for VSCode doesn't work properly with Apple Silicon #25

yax-lakam-tuun opened this issue Apr 24, 2023 · 1 comment · Fixed by #48
Assignees
Labels
bug Something isn't working

Comments

@yax-lakam-tuun
Copy link
Owner

yax-lakam-tuun commented Apr 24, 2023

When running on macOS using Apple M1, the ltex extension for LaTeX doesn't work.
The log looks something like this:

2023-04-24T07:33:09.822Z Info: Searching for ltex-ls in '/home/ajtzib/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib'...
2023-04-24T07:33:09.823Z Info: ltex-ls found in '/home/ajtzib/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2023-04-24T07:33:09.823Z Info: 
2023-04-24T07:33:09.823Z Info: Using ltex-ls from '/home/ajtzib/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0'.
2023-04-24T07:33:09.823Z Info: Using Java bundled with ltex-ls as ltex.java.path is not set.
2023-04-24T07:33:09.825Z Info: Testing ltex-ls...
2023-04-24T07:33:09.825Z Info:   Command: "/home/ajtzib/.vscode-server/extensions/valentjn.vscode-ltex-13.1.0/lib/ltex-ls-15.2.0/bin/ltex-ls"
2023-04-24T07:33:09.825Z Info:   Arguments: ["--version"]
2023-04-24T07:33:09.825Z Info:   env['JAVA_HOME']: undefined
2023-04-24T07:33:09.825Z Info:   env['JAVA_OPTS']: "-Xms64m -Xmx512m"
2023-04-24T07:33:09.835Z Error: Test failed.
2023-04-24T07:33:09.835Z Error: Error details:
2023-04-24T07:33:09.835Z Info: ltex-ls terminated with non-zero exit code 255.

The reason is, that the Java Runtime Environment (JRE) is not shipped with the extension for Apple Silicon (ARM64).
The problem can be somewhat mitigated when the JRE is installed manually (e.g. using brew).
The environment variable JAVA_HOME has to be set to the path of installation.
Additionally, inside the settings.json of VSCode, one has to specify the location using ltex.java.path

This issue also applies to Docker images as the Ubuntu guest system is also based on ARM64 on an Apple Silicon.
One part of a fix would be to install the JRE in the Docker container (adding an appropriate install command to Dockerfile.
However, adding the ltex.java.path to the general settings file is discouraged as other systems would not find the JRE automatically anymore.

I don't think it's worth requiring all users to have Java installed and setting the configuration in settings.json.
This would contradict the "it works out-of-the-box" approach here.

To be investigated...

Links regarding this topic:
valentjn/vscode-ltex#224
valentjn/vscode-ltex#634

Required steps to install Java (openjdk-18-jre) in Docker:

RUN apt-get -qq install \
        git git-lfs \
        inkscape vim \
        curl wget \
        openjdk-18-jre \
        apt-transport-https software-properties-common

ENV JAVA_HOME "/usr"

Line to install in settings.json:
"ltex.java.path": "/usr"

@yax-lakam-tuun yax-lakam-tuun added the bug Something isn't working label Apr 24, 2023
@yax-lakam-tuun yax-lakam-tuun changed the title LTex Extension for VSCode doesn't work properly with Apple M1 LTex Extension for VSCode doesn't work properly with Apple Silicon (M1/M2) Apr 24, 2023
@yax-lakam-tuun yax-lakam-tuun changed the title LTex Extension for VSCode doesn't work properly with Apple Silicon (M1/M2) LTex Extension for VSCode doesn't work properly with Apple Silicon Jan 11, 2025
@yax-lakam-tuun
Copy link
Owner Author

A fix is possible by installing Java inside the container.
The container specific devcontainer.json gets the additional setting mentioned above: "ltex.java.path": "/usr".
Then, the ltex extension is able to find Java inside the container.
This fix should work in all scenarios regardless of operating system and being in a container or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant