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

Error when booting extension on Mac Silicon #974

Closed
robertmoura opened this issue Mar 12, 2024 · 16 comments · Fixed by #977
Closed

Error when booting extension on Mac Silicon #974

robertmoura opened this issue Mar 12, 2024 · 16 comments · Fixed by #977
Labels
binary bug Something isn't working
Milestone

Comments

@robertmoura
Copy link

Thanks for working on this extension! Really love using it for formatting XML files.

I recently upgraded my Mac and this extension used to work but is failing on start up now. I think it may have something to do with the M1 chip? Any idea what could be causing this issue? Here's what I'm getting in the XML Support output:

[Error - 11:50:19] XML Support client: couldn't create connection to server.
Error: spawn Unknown system error -86
    at ChildProcess.spawn (node:internal/child_process:413:11)
    at Object.spawn (node:child_process:795:9)
    at transports (/Users/___/.vscode/extensions/redhat.vscode-xml-0.26.1-darwin-arm64/node_modules/vscode-languageclient/lib/node/main.js:424:46)
    at w.connection [as createConnection] (/Users/___/.vscode/extensions/redhat.vscode-xml-0.26.1-darwin-arm64/node_modules/vscode-languageclient/lib/common/client.js:1030:15)
    at w.start (/Users/___/.vscode/extensions/redhat.vscode-xml-0.26.1-darwin-arm64/node_modules/vscode-languageclient/lib/common/client.js:612:19)
@angelozerr
Copy link
Contributor

@fbricon have you the same problem ?

@Estreuselito
Copy link

I second that, I have a the exact same issue as described by @robertmoura. Thank you for looking into this! I highly appreciate your effort!

@angelozerr
Copy link
Contributor

@fbricon @datho7561 @rgrunber have you some idea about the problem?

@fbricon
Copy link
Collaborator

fbricon commented Mar 13, 2024

Tried on a MacBok Air M1 without any problem.

spawn Unknown system error -86 might suggest a corrupt file.

Can you try the latest vscode-xml pre-release?

@Estreuselito
Copy link

Hm, sadly that did not work. I am running a MacBook Pro M3. Here are some screenshots after switching to pre-release:

Screenshot 2024-03-13 at 14 12 04

After clicking on yes:

Screenshot 2024-03-13 at 14 12 34

I would appreciate any help :)

@fbricon
Copy link
Collaborator

fbricon commented Mar 13, 2024

can you check in the Mac security settings if the binary was blocked from running?

@rgrunber
Copy link
Member

For darwin-arm64, the binary should be lemminx-osx-aarch_64, and not lemminx-osx-x86_64

$ ls
redhat.vscode-xml-0.26.2024022308@darwin-arm64.vsix
$ unzip -Z1 redhat.vscode-xml-0.26.2024022308@darwin-arm64.vsix | grep server
extension/server/lemminx-osx-aarch_64
extension/server/lemminx-osx-aarch_64.sha256
extension/server/org.eclipse.lemminx-uber.jar

How was your vscode-xml installed ? Did you download it from somewhere, or did you install it through the VS Code Marketplace ?

@robertmoura
Copy link
Author

robertmoura commented Mar 14, 2024

I got the same issue as @Estreuselito when installing the pre-release.

can you check in the Mac security settings if the binary was blocked from running?

Hmm, not exactly sure how to check that but in the Privacy & Security section of the System Settings I can't see anything out of the ordinary. Was there something specific that you were looking for?

How was your vscode-xml installed ?

Just via the VS Code Marketplace. Nothing out of the ordinary that I know of.

@rgrunber
Copy link
Member

case 'darwin':
// FIXME: once we support Apple ARM, incorporate the architecture into this string
return 'lemminx-osx-x86_64';

😐 thanks @datho7561 for reminding about this. I'll propose a fix.

As a workaround, could anyone with the issue try :

  1. Going into /Users/.../vscode/extensions/redhat.vscode-xml-0.26.20204022308-darwin-arm64/server/.
  2. Confirm there is a file there named lemminx-osx-aarch_64, and rename it to lemminx-osx-x86_64.
  3. Start VS Code and see whether the XML functionality works through the binary. You will likely have to click "Yes" to trust the binary on the prompt, when it comes up.

@robertmoura
Copy link
Author

@rgrunber Thanks for looking into this issue! When going to that folder I already had that file. On the pre-release version I had both files in that folder so I'm not sure what to do in this case. Did you have any ideas?

Screenshot 2024-03-15 at 3 36 26 PM

Pre release version:

Screenshot 2024-03-15 at 3 30 13 PM

@rgrunber
Copy link
Member

rgrunber commented Mar 15, 2024

The first screenshot makes sense. Looks like it's of the 0.26.1 release, which did package the x86_64 LemMinX binary for macos-arm64 (relying on Rosetta layer to work).

As for the pre-release, I think I found yet another (similar) issue :

vscode-xml/package.json

Lines 27 to 31 in 4549a37

"binaryServerDownloadUrl": {
"linux": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-linux.zip",
"osx-x86_64": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-osx-x86_64.zip",
"win32": "https://github.com/redhat-developer/vscode-xml/releases/download/latest/lemminx-win32.zip"
},

In the event a binary can't be found locally, we download based on that logic. My guess is if the "aarch_64" (macos-arm64) binary failed to be located (because it was wrongly looking for the x76_64 one), the extension tried to download a pre-release version.. of the wrong version (the "latest" folder only applies to pre-releases).

I'll need to update this part of the build. @robertmoura , if you're able to do so the following would help :

  1. call file lemminx-osx-aarch_64 lemminx-osx-x86_64 and confirrm the output looks something like :
$ file lemminx-osx-aarch_64 lemminx-osx-x86_64
lemminx-osx-aarch_64: Mach-O 64-bit arm64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>
lemminx-osx-x86_64:   Mach-O 64-bit x86_64 executable, flags:<NOUNDEFS|DYLDLINK|TWOLEVEL|PIE>

Specifically, the aarch64 one should say something about arm64 and the x86_64 one should say something about x86_64.

  1. Just replace the aarch64 file with the x86_64 file

$ mv lemminx-osx-aarch_64 lemminx-osx-x86_64

This should just allow the extension to use the wrong file path, which now has the correct binary.

  1. Now start VS Code and see how the XML functionality works. You'll likely have a prompt asking to trust the binary.

Hopefully that works and confirms all the changes we need to make to fix things.

@rgrunber rgrunber reopened this Mar 17, 2024
@robertmoura
Copy link
Author

I've run that and got the following which matches what you've said.

lemminx-osx-aarch_64: Mach-O 64-bit executable arm64
lemminx-osx-x86_64:   Mach-O 64-bit executable x86_64

After running step 2 and restarting VSCode the extension seems to work as intended! I believe you may have hit this one on the head! Thanks heaps @rgrunber for being on top of this one! Really appreciate it 😊

@rgrunber
Copy link
Member

The next pre-release (20240318.. in a few hours from now), should have the necessary fix.

@kasthack
Copy link

@rgrunber I've got a similar issue but on Windows:

ESET antivirus detects the last version as a trojan:

C:\Users\<redacted>\.vscode-insiders\extensions\redhat.vscode-xml-0.26.2024031317-win32-x64\server\lemminx-win32.exe - ESET LiveGuard trojan - retained

AV screenshot

Extension version: v0.26.2024031808

VS Code version info:

Version: 1.88.0-insider (user setup)
Commit: 99a19815253d91900be5ec1016e0ecc7cc9a6950
Date: 2024-03-14T05:49:42.201Z (4 days ago)
Electron: 28.2.6
ElectronBuildId: 27476517
Chromium: 120.0.6099.291
Node.js: 18.18.2
V8: 12.0.267.19-electron.0
OS: Windows_NT x64 10.0.22621

Windows version:

Edition	Windows 11 Pro
Version	22H2
Installed on	‎10/‎13/‎2023
OS build	22621.3296
Experience	Windows Feature Experience Pack 1000.22687.1000.0

ESET version:

ESET Endpoint Security, Version 11.0.2044.0

@datho7561
Copy link
Contributor

@kasthack The bug reported in this issue was specific to apple on ARM64 and is resolved, could you please open a new issue for this bug?

@kasthack
Copy link

@datho7561 #979

@fbricon fbricon added bug Something isn't working binary labels Apr 24, 2024
@fbricon fbricon added this to the 0.27.0 milestone Apr 24, 2024
@fbricon fbricon changed the title Error when booting extension Error when booting extension on Mac Silicon Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
binary bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants