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

Can't link to rustc_driver with latest nightly #72564

Closed
bjorn3 opened this issue May 25, 2020 · 7 comments
Closed

Can't link to rustc_driver with latest nightly #72564

bjorn3 opened this issue May 25, 2020 · 7 comments
Labels
C-bug Category: This is a bug.

Comments

@bjorn3
Copy link
Member

bjorn3 commented May 25, 2020

I tried this code:

#![feature(rustc_private)]
extern crate rustc_driver;
fn main() {}

I expected to see this happen: Compiles fine.

Instead, this happened:

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/bjorn/.rustup/toolchains/nightly-2020-05-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "rust_out.rust_out.7rcbfp3g-cgu.0.rcgu.o" "rust_out.rust_out.7rcbfp3g-cgu.1.rcgu.o" "rust_out.rust_out.7rcbfp3g-cgu.2.rcgu.o" "rust_out.rust_out.7rcbfp3g-cgu.3.rcgu.o" "rust_out.rust_out.7rcbfp3g-cgu.4.rcgu.o" "-o" "rust_out" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-nodefaultlibs" "-L" "/home/bjorn/.rustup/toolchains/nightly-2020-05-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-L" "/home/bjorn/.rustup/toolchains/nightly-2020-05-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lrustc_driver-fefef43299f39010" "-Wl,--start-group" "-L" "/home/bjorn/.rustup/toolchains/nightly-2020-05-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-lstd-265ff16c7b6b86f9" "-Wl,--end-group" "-Wl,-Bstatic" "/home/bjorn/.rustup/toolchains/nightly-2020-05-25-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-a1755b3e88842f5d.rlib" "-Wl,-Bdynamic" "-lLLVM-10-rust-1.45.0-nightly" "-lutil" "-ldl" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: cannot find -lLLVM-10-rust-1.45.0-nightly
          collect2: error: ld returned 1 exit status

Meta

rustc --version --verbose:

rustc 1.45.0-nightly (46e85b432 2020-05-24)
binary: rustc
commit-hash: 46e85b4328fe18492894093c1092dfe509df4370
commit-date: 2020-05-24
host: x86_64-unknown-linux-gnu
release: 1.45.0-nightly
LLVM version: 10.0
@bjorn3 bjorn3 added the C-bug Category: This is a bug. label May 25, 2020
@jonas-schievink
Copy link
Contributor

Presumably expected breakage due to #72000?

@bjorn3
Copy link
Member Author

bjorn3 commented May 25, 2020

We'll move it to the llvm-tools-preview component directly,
and rustc-dev will have an implicit dependency on it.

That implicit dependency seems to be missing.

@jonas-schievink
Copy link
Contributor

Looks like it was dropped #72000 (comment)

@Mark-Simulacrum
Copy link
Member

Yes, closing as expected breakage. If llvm-tools-preview doesn't work for you, we can reopen.

The dependency is implicit, i.e. you need to manage it yourself, as rustup doesn't currently support dependencies.

@regexident
Copy link
Contributor

The dependency is implicit, i.e. you need to manage it yourself, as rustup doesn't currently support dependencies.

From a user's perspective what would that entail exactly?
I'm struggling to make this work. 😔

When creating a new project via:

cargo new rustc_driver_test

cd rustc_driver_test

echo "nightly-2020-06-16\n" > ./rust-toolchain

printf "\
#![feature(rustc_private)]\n\
extern crate rustc_driver;\n\
fn main() {}\n\
" > ./src/main.rs

rustup component add rust-src rustc-dev llvm-tools-preview

cargo +nightly build

… all I'm getting is this:

   Compiling rustc_driver_test v0.1.0 (…/emit-ffi)
error[E0463]: can't find crate for `rustc_driver`
 --> src/main.rs:2:1
  |
2 | extern crate rustc_driver;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `rustc_driver_test`.

To learn more, run the command again with --verbose.
rustup run nightly rustc --version --verbose
rustc 1.46.0-nightly (feb3536eb 2020-06-09)
binary: rustc
commit-hash: feb3536eba10c2e4585d066629598f03d5ddc7c6
commit-date: 2020-06-09
host: x86_64-apple-darwin
release: 1.46.0-nightly
LLVM version: 10.0

@bjorn3
Copy link
Member Author

bjorn3 commented Jun 19, 2020

rustup component add rust-src rustc-dev llvm-tools-preview

You need to specify that you want to add it to the nightly toolchain: rustup component add --toolchain nightly rust-src rustc-dev llvm-tools-preview.

@regexident
Copy link
Contributor

Thanks @bjorn3! Now it's kinda obvious. 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

4 participants