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

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

Closed
jhgg opened this issue Feb 26, 2022 · 51 comments · Fixed by #11593
Closed

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

jhgg opened this issue Feb 26, 2022 · 51 comments · Fixed by #11593
Assignees

Comments

@jhgg
Copy link
Contributor

jhgg commented Feb 26, 2022

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: #11558 (comment)

@jhgg
Copy link
Contributor Author

jhgg commented Feb 26, 2022

Compiling from source works, wonder if something changed on the GH actions runner that made it require a newer glibc. 🤔

@bjorn3
Copy link
Member

bjorn3 commented Feb 26, 2022

You can use the rust-analyzer from rustup if you need to run it on a system with an older glibc version. The change breaking 18.04 support was probably #10672 which updated the builder from ubuntu 18.04 to 20.04.

@lnicola
Copy link
Member

lnicola commented Feb 26, 2022

It was actually working on 20.04 at the time (I checked and marked it as "potentially breaking" in the changelog, as opposed to "breaking"). Maybe we (or the compiler, in 1.59) recently started using some symbol from 2.28 or 2.29.

@jhgg
Copy link
Contributor Author

jhgg commented Feb 27, 2022

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?

@bjorn3
Copy link
Member

bjorn3 commented Feb 27, 2022

Musl's memory allocator is slower. It may also affect memory usage (positive or negative).

@bjorn3
Copy link
Member

bjorn3 commented Feb 27, 2022

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

@jhgg
Copy link
Contributor Author

jhgg commented Feb 27, 2022

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...)

@bjorn3
Copy link
Member

bjorn3 commented Feb 27, 2022

Using the rust-analyzer-preview component from rustup is the easiest way. This one is built to support the exact same glibc versions as rustc.

@jhgg
Copy link
Contributor Author

jhgg commented Feb 27, 2022

Is that one regularly updated with each week's r-a release? From a user-friendliness perspective, the vscode extension "just updates" and keeps up to date with the latest version, having to pull from rustup means no more auto updates :/

@bjorn3
Copy link
Member

bjorn3 commented Feb 27, 2022

Yes, it get updated every week: https://github.com/rust-lang/rust/pulls?q=is%3Apr+%3Aup%3A+rust-analyzer+is%3Amerged+-label%3Arollup I agree that it is less user friendly.

@jhgg
Copy link
Contributor Author

jhgg commented Feb 27, 2022

Would it be possible to just replicate what rustc is doing to compile rust-analyzer here? That way we can maintain same support as the rustup component?

@bjorn3
Copy link
Member

bjorn3 commented Feb 27, 2022

Rustc uses a docker image with an older linux distro to build everything. I believe @matklad is worried that it will harm maintenance to do so for rust-analyzer too due to complicating the CI. Currently the exact same steps are used for all platforms for which binaries are released. Using docker on linux would require duplicating this.

@lnicola
Copy link
Member

lnicola commented Feb 27, 2022

We could try to roll back our CI to 18.04, but in general we don't have the same infrastructure as rust-lang/rust and we can't offer the same variety of builds. That's why it's available in rustup.

@taikulawo
Copy link

We could try to roll back our CI to 18.04, but in general we don't have the same infrastructure as rust-lang/rust and we can't offer the same variety of builds. That's why it's available in rustup.

How I can use RA from rustup? what should I do

@taikulawo
Copy link

taikulawo commented Feb 28, 2022

Bootstrap error [Error: Failed to execute /root/.vscode-server/extensions/matklad.rust-analyzer-0.2.956/server/rust-analyzer --version

$ /root/.vscode-server/extensions/matklad.rust-analyzer-0.2.956/server/rust-analyzer --version
> /root/.vscode-server/extensions/matklad.rust-analyzer-0.2.956/server/rust-analyzer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /root/.vscode-server/extensions/matklad.rust-analyzer-0.2.956/server/rust-analyzer)

Distributor ID: Debian
Description: Debian GNU/Linux 9.13 (stretch)
Release: 9.13
Codename: stretch

@lnicola
Copy link
Member

lnicola commented Feb 28, 2022

$ 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.

@Matthias247
Copy link
Contributor

Musl's memory allocator is slower. It may also affect memory usage (positive or negative).

This could be somewhat mitigated by using a custom allocator - e.g. either setting jemalloc or mimalloc via LD_LIBRARY_PATH or as a global allocator in Rust.

I definitely recommend to publish by default an extension which works with older glib versions - because far more distributions than just Ubuntu 18 haven't caught up and will run into issues. Whether that's best achieved using an older Ubuntu builder again or by moving to musl and bundling more dependencies is up to the team :)

@rimutaka
Copy link

rimutaka commented Feb 28, 2022

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

@dpypin
Copy link

dpypin commented Mar 1, 2022

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)."

@sunjay
Copy link
Member

sunjay commented Mar 1, 2022

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.

@jhgg jhgg changed the title rust-analyzer requires glibc >= 2.28 in pre-release build. rust-analyzer requires glibc >= 2.28 in latest build. Mar 1, 2022
@jhgg jhgg changed the title rust-analyzer requires glibc >= 2.28 in latest build. "Bootstrap Error" rust-analyzer requires glibc >= 2.28 in latest build. Mar 1, 2022
@sejr
Copy link

sejr commented Mar 1, 2022

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.

@lnicola
Copy link
Member

lnicola commented Mar 1, 2022

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

@opensas
Copy link

opensas commented Mar 5, 2022

Next monday.

so next monday (2022-03-14) with just reintalling the extension everything should work out of the box on 18.04. right?

@lnicola
Copy link
Member

lnicola commented Mar 5, 2022

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)

@opensas
Copy link

opensas commented Mar 5, 2022

I just went to the second option of this thread and it seems to be working fine.

@lnicola
Copy link
Member

lnicola commented Mar 5, 2022

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

@xflcx1991
Copy link

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.

@lnicola
Copy link
Member

lnicola commented Mar 6, 2022

Stable versions are 0.2.X, preview versions are 0.3.Y and source builds are 0.4.0.

@taikulawo
Copy link

taikulawo commented Mar 7, 2022

v0.3.963 not working in debian 9

Debian GLIBC 2.24-11+deb9u4

Distributor ID: Debian
Description:    Debian GNU/Linux 9.13 (stretch)
Release:        9.13
Codename:       stretch
/root/.vscode-server/extensions/matklad.rust-analyzer-0.3.963/server/rust-analyzer: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by /root/.vscode-server/extensions/matklad.rust-analyzer-0.3.963/server/rust-analyzer

@lnicola
Copy link
Member

lnicola commented Mar 7, 2022

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

@jotingen
Copy link

jotingen commented Mar 9, 2022

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

@yurymik
Copy link

yurymik commented Aug 22, 2022

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

@lnicola
Copy link
Member

lnicola commented Aug 23, 2022

@yurymik see #13081.

@ponchofiesta
Copy link

glibc 2.28 not supported by latest versions anymore.
Last working version with glibc 2.28 is v0.3.1170

@zybmajia1
Copy link

why the vscode can not select the version ? downward compatibility is correct。 give up the rust instead of C++。terrible rule.

@lnicola
Copy link
Member

lnicola commented Sep 22, 2022

Since two weeks ago the binaries are built again on Ubuntu 18.04. VS Code different know anything about GLIBC version requirements.

@zybmajia1
Copy link

Since two weeks ago the binaries are built again on Ubuntu 18.04. VS Code different know anything about GLIBC version requirements.

If our company use Rust,there are issues:
1.We programe closed type , connect WWW is not allowed. So config enviroment without WWW is impossible.
2.We use linux(run) + windows(vscode & rust-analyzer+Remote - SSH+CodeLLDB) 。 So weekly update is impossible.
Is there offline solution?

@wellingfine
Copy link

Not found "rust-analyzer.server.path" in v0.4.1387
first install by rustup, then mv to vscode's path:

rustup toolchain install nightly --component rust-analyzer-preview
mv /root/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rust-analyzer /root/.vscode-server/extensions/rust-lang.rust-analyzer-0.4.1387-linux-x64/server/rust-analyzer

@manmartgarc
Copy link

Looks like the issue should be reopened, still having the exact same issue and the current instructions to edit our VSCode settings are no longer up to date with the extensions' configuration schema.

@lnicola
Copy link
Member

lnicola commented Aug 25, 2023

@manmartgarc which distro are you on? I remember some Ubuntu version upgraded to a newer GLIBC a while ago.

@manmartgarc
Copy link

@manmartgarc which distro are you on? I remember some Ubuntu version upgraded to a newer GLIBC a while ago.

Using AL2

@lnicola
Copy link
Member

lnicola commented Aug 25, 2023

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

@people-can-fly
Copy link

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.

@NoobZang
Copy link

NoobZang commented Apr 21, 2024

git clone https://github.com/rust-analyzer/rust-analyzer
cd rust-analyzer && cargo build --release
cp target/release/rust-analyzer ~/.vscode-server/extensions/rust-lang.rust-analyzer-*version-number*-linux-x64/server/rust-analyzer
But you must recompile rust-analyzer project every time rust-analyzer extension is updated...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.