rust-analyzer: "Bootstrap Error" rust-analyzer requires glibc >= 2.28 in latest build.

rust-analyzer no longer will run on Ubuntu 18.04( which bundles glibc 2.27), and other distros which have a glibc older than 2.27.

this issue manifests as a “Bootstrap Error” notably, the extension output will log something along the lines of:

ERROR [2/28/2022, 8:46:56 AM]: Bootstrap error [Error: Failed to execute /home/newuser/.vscode/extensions/matklad.rust-analyzer-0.2.956/server/rust-analyzer --version

when running the binary, we get the following error:

/home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.953/server/rust-analyzer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found (required by /home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.953/server/rust-analyzer)
/home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.953/server/rust-analyzer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /home/jake/.vscode-server-insiders/extensions/matklad.rust-analyzer-0.3.953/server/rust-analyzer)

current workarounds are mentioned in this comment: https://github.com/rust-analyzer/rust-analyzer/issues/11558#issuecomment-1054802255

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 6
  • Comments: 51 (30 by maintainers)

Commits related to this issue

Most upvoted comments

Summary of a workaround

  • the last working build: 0.2.948
  • the first broken build: 0.2.956
  • who is affected: anyone running Ubuntu < v.20

Option 1 - downgrade

1.Open the extension page in VS Code 2. Click on [V] next to Uninstall button 3. Select 0.2.948 and reload

Notes

You will be perpetually stuck on that version.

Option 2 - use pre-prelease via rustup

  1. Install rust-analyzer-preview by running rustup toolchain install nightly --component rust-analyzer-preview
  2. Go to VSCode settings and search for rust-analyzer.server.path. You should see something along these lines image
  3. Click on Edit in settings.json and add "rust-analyzer.server.path": "~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer"
  4. Reload VSCode

Notes

You will have to update the extension manually with rustup update

$ rustup toolchain install nightly --component rust-analyzer-preview

Then set rust-analyzer.server.path to ~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer.

This is somewhat problematic for us, because our remote development environment for our company is ubuntu 18.04 at current, which means the rust-analyzer extension will suddenly break in a weird way (the error message isn’t that clear about lacking glibc, I had to actually go and execute the bundled r-a binary directly.)

I wonder how many people will run into this issue when this change hits the main release.

To ensure maximum compatibility with the rust-analyzer binary distributed in the vscode extension, should we instead bundle the musl binary?

This issue seems to reappear in the most recent release:

~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1170-linux-x64/server/rust-analyzer --version
rust-analyzer 0.3.1170-standalone (b6d59f2bb 2022-08-14)

~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1178-linux-x64/server/rust-analyzer --version
/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.29' not found

objdump -T ~/.vscode-server/extensions/rust-lang.rust-analyzer-0.3.1178-linux-x64/server/rust-analyzer | grep "GLIBC_2.29"
0000000000000000  w   DF *UND*  0000000000000000  GLIBC_2.29  posix_spawn_file_actions_addchdir_np

This is on Debian 10.12 that has GLIBC 2.28:

~$ cat /etc/issue
Debian GNU/Linux 10 \n \l

$ cat /etc/debian_version
10.12

$ readlink -f /lib/x86_64-linux-gnu/libc.so.6
/usr/lib/x86_64-linux-gnu/libc-2.28.so

Workaround Option 1 is not working for me. When I try to downgrade to 0.2.948 I get the following error in VSCode:

“Can’t install ‘matklad.rust-analyzer’ extension because it is not compatible with the current version of Visual Studio Code (version 1.64.2).”

For Option 2, note that when searching for rust-analyzer.server.path you need to be in the remote tab of settings.

Getting the same error as @dpypin for Option 1. When I try Option 2, I don’t actually see any rust-analyzer.server.path option. If I put it in manually in settings.json, vscode just says that it is unused. Does that setting work for when the extension is installed remotely over SSH? I followed the rustup step on my remote server, so everything should be installed correctly.

Edit: Worth noting that I have the latest version of vscode which is 1.64.2. I’m currently in the process of downgrading to see if I can get it working again.

It should update automatically, so you don’t have to reinstall it. But in the meanwhile you can test a pre-release version by clicking on this button:

image

(the pre-release versions are generally quite stable)

Next monday.

It should update automatically, so you don’t have to reinstall it. But in the meanwhile you can test a pre-release version by clicking on this button:

image

(the pre-release versions are generally quite stable)

Done!It seems to working on Ubuntu 18.04 now.But my pre-release version is v0.3.962.

It works for me in AL2

  • First make sure the extension is installed.
  • install the nightly version rustup toolchain install nightly --component rust-analyzer-preview
  • Note on the previous comment mentioned path of the bin could be different. For my case it was under ASDF
  • add "rust-analyzer.server.path": "/home/ec2-user/.asdf/installs/rust/1.69.0/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer", to the remote settings.

I suggest building from source for now. The config key is still rust-analyzer.server.path.

The GLIBC version in Debian 9 is too old, you’ll have to use rustup as described above. Debian 10 should work.

Yeah, just keep in mind that it won’t update automatically and the Code extension and server binary might become mismatched.

This was probably caused by https://github.com/rust-lang/rust/pull/90846. We’re pulling in statx and posix_spawn:

    97: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND statx@GLIBC_2.28 (17)
 66653: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND statx@@GLIBC_2.28
   124: 0000000000000000     0 FUNC    WEAK   DEFAULT  UND posix_spawn_file_actions_@GLIBC_2.29 (21)

@sejr you can download one from https://github.com/rust-analyzer/rust-analyzer/releases, chmod +x it, then set rust-analyzer.server.path.

Is there any way to get one of the previous builds to work with VS Code 1.64.2? This has kinda derailed me in an environment where I can’t use rustup.

Hmm, is there any viable path forward to restore 18.04 support? Ubuntu 18.04 is supported until April 2023, which means it will be in wide use until then (and probably for a while after…)

In addition using musl would make it impossible to load proc macros compiled for glibc. (which is the default)