Can't use futures as a dependency

Hi all,

Building a fresh project with the following Cargo.toml fails.

[package]
name = "cargo"
version = "0.1.0"
edition = "2024"

[dependencies]
futures = "0.3"

With the following messages.>

Compiling futures-macro v0.3.31
Compiling futures-util v0.3.31
error[E0463]: can't find crate for futures_macro
--> /home/maximb/wd/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/futures-util-0.3.31/src/async_await/stream_select_mod.rs:5:9
|
5 | pub use futures_macro::stream_select_internal;
| ^^^^^^^^^^^^^ can't find crate

As you can see from the above, futures_macro is built right before futures-util, but the compiler still can't find it.
Running cargo update, cargo clean, updating rust doesn't help.

sjcvl-aae-ci /t/cargo> rustc --version
rustc 1.86.0 (05f9846f8 2025-03-31)
sjcvl-aae-ci /t/cargo> uname -a
Linux sjcvl-aae-ci 4.18.0-305.el8.x86_64 #1 SMP Thu Apr 29 08:54:30 EDT 2021 x86_64 GNU/Linux

Please help.

Cannot reproduce. If I run cargo new foo, replace the contents of the Cargo.toml with that shown here, and run cargo build, the build is successful. I'm using Rust 1.86 on an Intel MacBook Pro.

You may have modified your crate registry by accident. Try deleting it and letting the crates re-download.

Thanks! This didn't help.
I downgraded rustc to 1.69 and that changed the error text to the following.

error: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /tmp/a/target/debug/deps/libfutures_macro-13a70127e927243e.so)
--> /home/maximb/wd/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-util-0.3.31/src/async_await/stream_select_mod.rs:5:9
|
5 | pub use futures_macro::stream_select_internal;

So I guess this is the reason.
Wondering if overriding LD_LIBRARY_PATH is the solution here.

It sounds like your setup has a problem that causes proc macros to not work correctly. It's probably not specific to the futures crate.

1 Like