Bug 2316529

Summary: rust-analyzer fails because it can't load librustc_driver
Product: [Fedora] Fedora Reporter: Mattias Bengtsson <mattias.jc.bengtsson>
Component: rustAssignee: Josh Stone <jistone>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: amulhern, igor.raits, jistone, rust-sig, TicoTimo
Target Milestone: ---Keywords: Desktop
Target Release: ---Flags: jistone: mirror+
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rust-1.81.0-6.fc42 rust-1.81.0-6.fc41 rust-1.81.0-6.fc39 rust-1.82.0-1.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-10-09 07:11:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Mattias Bengtsson 2024-10-04 19:01:26 UTC
In a fresh Fedora 40 container (and on my 41 Beta system that's lived through many updates) when installing `rust-analyzer` and starting it I get this error:
```
rust-analyzer: error while loading shared libraries: librustc_driver-763f26e0b309ffde.so: cannot open shared object file: No such file or directory
```

Reproducible: Always

Steps to Reproduce:
```
system $ podman run --rm -it fedora:40 bash
fedora $ dnf install rust-analyzer
fedora $ rust-analyzer
rust-analyzer: error while loading shared libraries: librustc_driver-763f26e0b309ffde.so: cannot open shared object file: No such file or directory
```
Actual Results:  
rust-analyzer: error while loading shared libraries: librustc_driver-763f26e0b309ffde.so: cannot open shared object file: No such file or directory

Expected Results:  
It starts without error

# Details #

I've found out that for a fresh Fedora 40 it is enough to install the `rust` package after `rust-analyzer` to get going. On a fresh Fedora 41 it seems to work straight away while on my upgraded Fedora 41 it fails no matter what I do.

## Full logs ##

### Fedora 41 (Bare metal) ###

Long lived install that's gone through many updates. I tend to be pretty careful
with my installs though.

```
$ sudo dnf install --assumeyes --quiet rust-analyzer
Package "rust-analyzer-1.81.0-4.fc41.x86_64" is already installed.

Nothing to do.
$ sudo dnf install --assumeyes --quiet rust
Package "rust-1.81.0-1.fc41.x86_64" is already installed.

Nothing to do.
$ rust-analyzer
rust-analyzer: error while loading shared libraries: librustc_driver-763f26e0b309ffde.so: cannot open shared object file: No such file or directory
```

### Fedora 40 (Podman) ###

```
$ podman run --rm -it fedora:40 bash
[root@18816e0b57d8 /]# dnf install --assumeyes --quiet rust-analyzer

Installed:
  rust-analyzer-1.81.0-1.fc40.x86_64                                                               rust-src-1.81.0-1.fc40.noarch

[root@18816e0b57d8 /]# rust-analyzer
rust-analyzer: error while loading shared libraries: librustc_driver-5f9904c695098583.so: cannot open shared object file: No such file or directory
[root@18816e0b57d8 /]# dnf install --assumeyes --quiet rust

Downgraded:
  libgomp-14.0.1-0.15.fc40.x86_64
Installed:
  binutils-2.41-37.fc40.x86_64          binutils-gold-2.41-37.fc40.x86_64             cpp-14.0.1-0.15.fc40.x86_64                    elfutils-debuginfod-client-0.191-4.fc40.x86_64
  gc-8.2.2-6.fc40.x86_64                gcc-14.0.1-0.15.fc40.x86_64                   glibc-devel-2.39-22.fc40.x86_64                glibc-headers-x86-2.39-22.fc40.noarch
  guile30-3.0.7-12.fc40.x86_64          jansson-2.13.1-9.fc40.x86_64                  kernel-headers-6.10.3-200.fc40.x86_64          libedit-3.1-53.20240808cvs.fc40.x86_64
  libmpc-1.3.1-5.fc40.x86_64            libpkgconf-2.1.1-2.fc40.x86_64                libxcrypt-devel-4.4.36-5.fc40.x86_64           llvm-libs-18.1.8-2.fc40.x86_64
  make-1:4.4.1-6.fc40.x86_64            pkgconf-2.1.1-2.fc40.x86_64                   pkgconf-m4-2.1.1-2.fc40.noarch                 pkgconf-pkg-config-2.1.1-2.fc40.x86_64
  rust-1.81.0-1.fc40.x86_64             rust-std-static-1.81.0-1.fc40.x86_64

[root@18816e0b57d8 /]# rust-analyzer
^C
[root@18816e0b57d8 /]# # All good!
```

### Fedora 41 (Podman) ###

```
$ podman run --rm -it fedora:41 bash
[root@27b7088fd163 /]# dnf install --quiet --assumeyes rust-analyzer
Package                                                          Arch           Version                                                          Repository                               Size
Installing:
 rust-analyzer                                                   x86_64         1.81.0-4.fc41                                                    updates-testing                      27.9 MiB
Installing dependencies:
 binutils                                                        x86_64         2.43.1-2.fc41                                                    updates-testing                      27.5 MiB
 cpp                                                             x86_64         14.2.1-3.fc41                                                    updates-testing                      35.0 MiB
 elfutils-debuginfod-client                                      x86_64         0.191-8.fc41                                                     fedora                               64.9 KiB
 gcc                                                             x86_64         14.2.1-3.fc41                                                    updates-testing                     104.3 MiB
 glibc-devel                                                     x86_64         2.40-3.fc41                                                      fedora                               35.0 KiB
 glibc-headers-x86                                               noarch         2.40-3.fc41                                                      fedora                                2.2 MiB
 jansson                                                         x86_64         2.13.1-10.fc41                                                   fedora                               88.3 KiB
 kernel-headers                                                  x86_64         6.11.0-63.fc41                                                   updates-testing                       6.4 MiB
 libedit                                                         x86_64         3.1-53.20240808cvs.fc41                                          fedora                              244.1 KiB
 libmpc                                                          x86_64         1.3.1-6.fc41                                                     fedora                              164.7 KiB
 libpkgconf                                                      x86_64         2.3.0-1.fc41                                                     fedora                               78.2 KiB
 libxcrypt-devel                                                 x86_64         4.4.36-7.fc41                                                    fedora                               30.3 KiB
 llvm-libs                                                       x86_64         19.1.0-1.fc41                                                    updates-testing                     124.5 MiB
 make                                                            x86_64         1:4.4.1-8.fc41                                                   fedora                                1.8 MiB
 pkgconf                                                         x86_64         2.3.0-1.fc41                                                     fedora                               88.6 KiB
 pkgconf-m4                                                      noarch         2.3.0-1.fc41                                                     fedora                               14.4 KiB
 pkgconf-pkg-config                                              x86_64         2.3.0-1.fc41                                                     fedora                              989.0   B
 rust                                                            x86_64         1.81.0-4.fc41                                                    updates-testing                      86.5 MiB
Installing weak dependencies:
 rust-src                                                        noarch         1.81.0-4.fc41                                                    updates-testing                      28.7 MiB
 rust-std-static                                                 x86_64         1.81.0-4.fc41                                                    updates-testing                     136.5 MiB

Transaction Summary:
 Installing:        21 packages

[ 1/23] Verify package files                                                                                                                          100% |  22.0   B/s |  21.0   B |  00m01s
[ 2/23] Prepare transaction                                                                                                                           100% | 283.0   B/s |  21.0   B |  00m00s
[ 3/23] Installing libmpc-0:1.3.1-6.fc41.x86_64                                                                                                       100% |  40.6 MiB/s | 166.2 KiB |  00m00s
[ 4/23] Installing cpp-0:14.2.1-3.fc41.x86_64                                                                                                         100% | 230.3 MiB/s |  35.0 MiB |  00m00s
[ 5/23] Installing jansson-0:2.13.1-10.fc41.x86_64                                                                                                    100% |  43.8 MiB/s |  89.7 KiB |  00m00s
[ 6/23] Installing elfutils-debuginfod-client-0:0.191-8.fc41.x86_64                                                                                   100% |  21.8 MiB/s |  66.9 KiB |  00m00s
[ 7/23] Installing binutils-0:2.43.1-2.fc41.x86_64                                                                                                    100% | 312.8 MiB/s |  27.5 MiB |  00m00s
[ 8/23] Installing libedit-0:3.1-53.20240808cvs.fc41.x86_64                                                                                           100% |  80.0 MiB/s | 245.8 KiB |  00m00s
[ 9/23] Installing llvm-libs-0:19.1.0-1.fc41.x86_64                                                                                                   100% | 245.5 MiB/s | 124.5 MiB |  00m01s
[10/23] Installing make-1:4.4.1-8.fc41.x86_64                                                                                                         100% | 225.0 MiB/s |   1.8 MiB |  00m00s
[11/23] Installing kernel-headers-0:6.11.0-63.fc41.x86_64                                                                                             100% |  55.0 MiB/s |   6.5 MiB |  00m00s
[12/23] Installing libpkgconf-0:2.3.0-1.fc41.x86_64                                                                                                   100% |  38.7 MiB/s |  79.3 KiB |  00m00s
[13/23] Installing pkgconf-0:2.3.0-1.fc41.x86_64                                                                                                      100% |  44.5 MiB/s |  91.1 KiB |  00m00s
[14/23] Installing pkgconf-m4-0:2.3.0-1.fc41.noarch                                                                                                   100% |  14.5 MiB/s |  14.8 KiB |  00m00s
[15/23] Installing pkgconf-pkg-config-0:2.3.0-1.fc41.x86_64                                                                                           100% | 591.1 KiB/s |   1.8 KiB |  00m00s
[16/23] Installing glibc-headers-x86-0:2.40-3.fc41.noarch                                                                                             100% |  44.8 MiB/s |   2.3 MiB |  00m00s
[17/23] Installing libxcrypt-devel-0:4.4.36-7.fc41.x86_64                                                                                             100% |  15.9 MiB/s |  32.6 KiB |  00m00s
[18/23] Installing glibc-devel-0:2.40-3.fc41.x86_64                                                                                                   100% |   9.4 MiB/s |  38.4 KiB |  00m00s
[19/23] Installing gcc-0:14.2.1-3.fc41.x86_64                                                                                                         100% | 269.0 MiB/s | 104.4 MiB |  00m00s
[20/23] Installing rust-0:1.81.0-4.fc41.x86_64                                                                                                        100% | 220.1 MiB/s |  86.5 MiB |  00m00s
[21/23] Installing rust-std-static-0:1.81.0-4.fc41.x86_64                                                                                             100% | 253.3 MiB/s | 136.5 MiB |  00m01s
[22/23] Installing rust-src-0:1.81.0-4.fc41.noarch                                                                                                    100% |  65.3 MiB/s |  29.0 MiB |  00m00s
[23/23] Installing rust-analyzer-0:1.81.0-4.fc41.x86_64                                                                          100% [==================] | 227.0 MiB/s |  27.9 MiB | -00m00s
>>> Running trigger-install scriptlet: glibc-common-0:2.40-3.fc41.x86_64warning: posix.fork(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.spawn() or rpm.execute() instead
warning: posix.wait(): .fork(), .exec(), .wait() and .redirect2null() are deprecated, use rpm.spawn() or rpm.execute() instead
[23/23] Installing rust-analyzer-0:1.81.0-4.fc41.x86_64                                                                                               100% | 156.5 MiB/s |  27.9 MiB |  00m00s[root@27b7088fd163 /]# rust-analyzer
[root@27b7088fd163 /]# rust-analyzer
^C
[root@27b7088fd163 /]# # Worked immediately! (Though DNF in 41 doesn't do --quiet apparently)
```

Comment 1 Josh Stone 2024-10-08 19:39:11 UTC
You're right, this should have an explicit dependency on the same '%{name}%{?_isa} = %{version}-%{release}', as we do for a few other tools that link to the compiler libraries. It looks like rust-analyzer didn't have that link at the beginning, but it did show up a while ago. (I didn't pinpoint exactly when, but it doesn't really matter.)

The small saving grace is that rust-analyzer has a weak "Recommends: %{name}-src" (though unversioned), which in turn has a weak "Recommends: %{name}-std-static = %{version}-%{release}", which then "Requires: %{name} = %{version}-%{release}". That's how your F41 worked, and that works in F40 for me too -- not sure why yours didn't. Your long-lived install got mixed releases though, rust-analyzer-1.81.0-4 vs rust-1.81.0-1. The library hashes change every time because there's no ABI stability.

Anyway, I'll add the explicit Requires.

Comment 2 Fedora Update System 2024-10-09 06:33:12 UTC
FEDORA-2024-ef660b2737 (rust-1.81.0-6.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-ef660b2737

Comment 3 Fedora Update System 2024-10-09 07:11:47 UTC
FEDORA-2024-ef660b2737 (rust-1.81.0-6.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 4 Fedora Update System 2024-10-09 16:59:29 UTC
FEDORA-2024-5559209ca0 (rust-1.81.0-6.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-5559209ca0

Comment 5 Fedora Update System 2024-10-10 03:17:17 UTC
FEDORA-2024-5559209ca0 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-5559209ca0`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-5559209ca0

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 6 Fedora Update System 2024-10-12 04:47:51 UTC
FEDORA-2024-ca58822d5c (rust-1.81.0-6.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-ca58822d5c

Comment 7 Fedora Update System 2024-10-12 04:47:51 UTC
FEDORA-2024-108aeb3df5 (rust-1.81.0-6.fc39) has been submitted as an update to Fedora 39.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-108aeb3df5

Comment 8 Fedora Update System 2024-10-13 00:41:48 UTC
FEDORA-2024-5559209ca0 (rust-1.81.0-6.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 9 Fedora Update System 2024-10-13 02:12:25 UTC
FEDORA-2024-108aeb3df5 has been pushed to the Fedora 39 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-108aeb3df5`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-108aeb3df5

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 10 Fedora Update System 2024-10-13 03:08:27 UTC
FEDORA-2024-ca58822d5c has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-ca58822d5c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-ca58822d5c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2024-10-19 03:02:22 UTC
FEDORA-2024-e32b505d4f has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-e32b505d4f`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-e32b505d4f

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2024-10-21 01:28:57 UTC
FEDORA-2024-108aeb3df5 (rust-1.81.0-6.fc39) has been pushed to the Fedora 39 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 13 Fedora Update System 2024-10-28 03:52:39 UTC
FEDORA-2024-e32b505d4f (rust-1.82.0-1.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.