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

Ubuntu 21.10 "Can not attach stdlib sources automatically" #8364

Open
sturmf opened this issue Jan 5, 2022 · 9 comments
Open

Ubuntu 21.10 "Can not attach stdlib sources automatically" #8364

sturmf opened this issue Jan 5, 2022 · 9 comments

Comments

@sturmf
Copy link

sturmf commented Jan 5, 2022

Environment

  • IntelliJ Rust plugin version: 0.4.162.4321-213
  • Rust toolchain version: 1.53.0+dfsg1+llvm-4ubuntu1~21.10.1
  • IDE name and version: IDEA community 2021.3.1
  • Operating system: Ubuntu 21.10

Problem description

Opening or creating a rust project shows "Can not attach stdlib sources automatically without rustup".
Attaching the sources manually seems to fail and I tried with many different paths.
It seems rustup itself is not available in a Debian package and the available snap did not help.

Installed rust Debian packages:

ii  libstd-rust-1.53:amd64                     1.53.0+dfsg1+llvm-4ubuntu1~21.10.1         amd64        Rust standard libraries
ii  libstd-rust-dev:amd64                      1.53.0+dfsg1+llvm-4ubuntu1~21.10.1         amd64        Rust standard libraries - development files
ii  rust-src                                   1.53.0+dfsg1+llvm-4ubuntu1~21.10.1         all          Rust systems programming language - source code
ii  rustc                                      1.53.0+dfsg1+llvm-4ubuntu1~21.10.1         amd64        Rust systems programming language
@artemmukhin
Copy link
Member

artemmukhin commented Jan 6, 2022

Hello @sturmf, could you try reinstalling Rust using rustup via curl? It is the primary installation method for Rust described here

@sturmf
Copy link
Author

sturmf commented Jan 24, 2022

Yes uninstalling all Ubuntu packages and using rustup works as expected. But at some point it would be great to get it working with the packages provided by the distribution. But then I guess it is more a bug of the distro then a problem with the rust plugin.

@aboseley
Copy link

I have the same issue when using the rust packages provided by fedora35

@tiagolobocastro
Copy link

I'm having this same issue and attaching the sources manually does not seem to help. The "Can not attach..." message keeps showing up and the plugin is not able to navigate through std::"

@tiagolobocastro
Copy link

tiagolobocastro commented Apr 5, 2022

UPDATE:
If I purge ~/.cache/JetBrains/CLion2021.3/ and reopen clion then it starts working... but then if I close&reopen it breaks again and I see this type of error:

022-04-05 18:03:02,124 [   6321]  ERROR - ct.workspace.StdlibDataFetcher - Execution failed (exit code 101).
/nix/store/n5iyizfh8c1b01d5iswmgfhpi6issk0f-rust-default-1.58.0-nightly-2021-11-22/bin/cargo metadata --verbose --format-version 1 --all-features
stdout :     Updating crates.io index
error: failed to write /nix/store/grr7rc5z4jb8hams62m1yr3sgc2054rr-rust-src-1.58.0-nightly-2021-11-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/profiler_builtins/Cargo.lock

Caused by:
  failed to open: /nix/store/grr7rc5z4jb8hams62m1yr3sgc2054rr-rust-src-1.58.0-nightly-2021-11-22-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/profiler_builtins/Cargo.lock

Caused by:
  Read-only file system (os error 30)

EDIT: Seems like an issue with cargo metadata: rust-lang/cargo#10096

@slonopotamus
Copy link

I'm experiencing the same issue on Ubuntu 20.04 (unable to attach stdlib sources installed via apt-get install rust-src).

clion log says:

2022-09-16 19:18:30,476 [ 117783] SEVERE - #o.r.c.p.w.StdlibDataFetcher - CLion 2022.2.3  Build #CL-222.4167.35
2022-09-16 19:18:30,476 [ 117783] SEVERE - #o.r.c.p.w.StdlibDataFetcher - JDK: 17.0.4; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2022-09-16 19:18:30,476 [ 117783] SEVERE - #o.r.c.p.w.StdlibDataFetcher - OS: Linux
2022-09-16 19:18:30,476 [ 117783] SEVERE - #o.r.c.p.w.StdlibDataFetcher - Plugin to blame: Rust version: 0.4.178.4873-222
2022-09-16 19:18:30,477 [ 117784]   INFO - o.r.o.CommandLineExt - Executing `/usr/bin/cargo metadata --verbose --format-version 1 --all-features --filter-platform x86_64-unknown-linux-gnu`
2022-09-16 19:18:30,917 [ 118224] SEVERE - #o.r.c.p.w.StdlibDataFetcher - Execution failed (exit code 101).
/usr/bin/cargo metadata --verbose --format-version 1 --all-features --filter-platform x86_64-unknown-linux-gnu
stdout :     Updating crates.io index
error: failed to write /usr/src/rustc-1.59.0/Cargo.lock

Caused by:
  failed to open: /usr/src/rustc-1.59.0/Cargo.lock

Caused by:
  Permission denied (os error 13)

stderr : 
org.rust.openapiext.RsProcessExecutionException$ProcessAborted: Execution failed (exit code 101).
/usr/bin/cargo metadata --verbose --format-version 1 --all-features --filter-platform x86_64-unknown-linux-gnu
stdout :     Updating crates.io index
error: failed to write /usr/src/rustc-1.59.0/Cargo.lock

Caused by:
  failed to open: /usr/src/rustc-1.59.0/Cargo.lock

Caused by:
  Permission denied (os error 13)

stderr : 
	at org.rust.openapiext.CommandLineExtKt.execute(CommandLineExt.kt:112)
	at org.rust.openapiext.CommandLineExtKt.execute$default(CommandLineExt.kt:55)
	at org.rust.cargo.toolchain.tools.Cargo.execute(Cargo.kt:483)
	at org.rust.cargo.toolchain.tools.Cargo.execute$default(Cargo.kt:477)
	at org.rust.cargo.toolchain.tools.Cargo.fetchMetadata(Cargo.kt:178)
	at org.rust.cargo.project.workspace.StdlibDataFetcher.collectPackageMetadata(StandardLibrary.kt:304)
	at org.rust.cargo.project.workspace.StdlibDataFetcher.fetchStdlibData(StandardLibrary.kt:218)
	at org.rust.cargo.project.workspace.StandardLibrary$Companion.fetchActualStdlib(StandardLibrary.kt:120)
	at org.rust.cargo.project.workspace.StandardLibrary$Companion.fetchActualStdlib$default(StandardLibrary.kt:110)
	at org.rust.cargo.project.workspace.StandardLibrary$Companion.fromFile(StandardLibrary.kt:87)
	at org.rust.cargo.project.workspace.StandardLibrary$Companion.fromFile$default(StandardLibrary.kt:64)
	at org.rust.ide.notifications.MissingToolchainNotificationProvider.createLibraryAttachingPanel$lambda-7$lambda-5(MissingToolchainNotificationProvider.kt:104)
	at com.intellij.ui.EditorNotificationPanel$3.handlePanelActionClick(EditorNotificationPanel.java:294)
	at com.intellij.ui.EditorNotificationPanel$ActionHyperlinkLabel$1.hyperlinkActivated(EditorNotificationPanel.java:339)
	at com.intellij.ui.HyperlinkAdapter.hyperlinkUpdate(HyperlinkAdapter.java:14)
	at com.intellij.ui.HyperlinkLabel.fireHyperlinkEvent(HyperlinkLabel.java:240)
	at com.intellij.ui.HyperlinkLabel.processMouseEvent(HyperlinkLabel.java:162)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:840)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

@enerjazzer
Copy link

enerjazzer commented Oct 5, 2022

I'm using system installation of Rust at work, rustup is not available and we can't install it by policy.
It's Red Hat, if it matters. The standard library is there, Cargo builds and runs the program without any problem, but I have that banner at the top of the editor and can't go into stdlib symbols.
So please fix the plugin to work without rustup.

@vlad20012
Copy link
Member

@enerjazzer Without rustup you have to download an stdlib sources somehow (using system package manager or manually) and specify the path to it in IntelliJ Rust project settings. For example, on Ubuntu it's possible by sudo apt install rust-src.

You don't need stdlib sources for building rust code, so it's expected that cargo build works while IDE doesn't. Stdlib sources are usually needed for IDEs only

@enerjazzer
Copy link

enerjazzer commented Oct 31, 2022

@enerjazzer Without rustup you have to download an stdlib sources somehow (using system package manager or manually) and specify the path to it in IntelliJ Rust project settings. For example, on Ubuntu it's possible by sudo apt install rust-src.

It is downloaded.
E.g. grepping for println:
/opt/third/rust/1.63.0/lib/rustlib/src/rust/library/std/src/macros.rs:macro_rules! println {

But the plugin still doesn't see it.
It always shows "Can not attach stdlib sources automatically without rustup" and a button "Attach manually" and no matter which part from the above path I put there it still shows that banner and Ctrl+Click on "println!" in the code doesn't work.

Please fix

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

No branches or pull requests

7 participants