Skip to content

Failed to get crate data for crate18' #85370

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

Closed
curvasuave opened this issue May 16, 2021 · 3 comments
Closed

Failed to get crate data for crate18' #85370

curvasuave opened this issue May 16, 2021 · 3 comments
Labels
A-metadata Area: Crate metadata C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@curvasuave
Copy link

While trying to compile an example for rav1e encoder I got the next error

thread 'rustc' panicked at 'Failed to get crate data for crate18', compiler/rustc_metadata/src/creader.rs:136:32

Maybe I'm doing it wrong because I'm using rustc directly:
rustc --edition=2018 --extern rav1e=../target/release/librav1e.rlib simple_encoding.rs

I tried using beta and nightly versions but I got other errors.

Code

https://github.com/xiph/rav1e/blob/master/examples/simple_encoding.rs

Meta

rustc --version --verbose:

rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0

Error output

thread 'rustc' panicked at 'Failed to get crate data for crate18', compiler/rustc_metadata/src/creader.rs:136:32

error: internal compiler error: unexpected panic

query stack during panic:
end of query stack

Backtrace

 0: rust_begin_unwind
           at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
 1: std::panicking::begin_panic_fmt
           at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:435:5
 2: rustc_metadata::creader::CrateLoader::maybe_resolve_crate
 3: rustc_metadata::creader::CrateLoader::maybe_process_path_extern
 4: rustc_resolve::Resolver::extern_prelude_get
 5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::early_resolve_ident_in_lexical_scope
 6: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
 7: rustc_resolve::Resolver::resolve_path_with_ribs
 8: rustc_resolve::imports::ImportResolver::resolve_imports
 9: rustc_resolve::macros::<impl rustc_expand::base::ResolverExpand for rustc_resolve::Resolver>::resolve_imports
10: rustc_expand::expand::MacroExpander::fully_expand_fragment
11: rustc_expand::expand::MacroExpander::expand_crate
12: rustc_session::utils::<impl rustc_session::session::Session>::time
13: rustc_interface::passes::configure_and_expand_inner
14: rustc_interface::passes::configure_and_expand::{{closure}}
15: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
16: rustc_interface::passes::configure_and_expand
17: rustc_interface::queries::Queries::expansion
18: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
19: rustc_span::with_source_map
20: rustc_interface::interface::create_compiler_and_run
21: scoped_tls::ScopedKey<T>::set

@curvasuave curvasuave added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels May 16, 2021
@jonas-schievink jonas-schievink added the A-metadata Area: Crate metadata label May 16, 2021
@ehuss
Copy link
Contributor

ehuss commented May 17, 2021

The -L ../target/release/deps flag is needed (along with -C lto=thin) since it needs to find the transitive dependencies and things like proc-macros. I would not recommend trying to use rustc directly like that. Usually examples are built with cargo build --example simple_encoding. If you really want to see how cargo builds things, you can use the -v flag to have it show the compiler invocation.

rustc shouldn't ICE in this situation, though. I'm not sure why it isn't displaying an error about not being able to find the dependencies.

@Heliozoa
Copy link
Contributor

I'm getting this error with the following example with cargo check on Ubuntu 20.04.2 LTS:

# Cargo.toml
[package]
name = "ice"
version = "0.1.0"
edition = "2018"

[lib]
proc-macro = true

[dependencies]
neon = "0.8"
// src/lib.rs
use neon::types::Value;
use proc_macro::TokenStream;

#[proc_macro_attribute]
pub fn proc(attr: TokenStream, item: TokenStream) -> TokenStream {
    panic!()
}
// tests/integration.rs
use ice::proc;
> rustc --version --verbose
rustc 1.52.1 (9bc8c42bb 2021-05-09)
binary: rustc
commit-hash: 9bc8c42bb2f19e745a63f3445f1ac248fb015e53
commit-date: 2021-05-09
host: x86_64-unknown-linux-gnu
release: 1.52.1
LLVM version: 12.0.0
> RUST_BACKTRACE=1 cargo check --tests
    Checking ice v0.1.0 (~/ice)
thread 'rustc' panicked at 'Failed to get crate data for crate18', compiler/rustc_metadata/src/creader.rs:136:32
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/9bc8c42bb2f19e745a63f3445f1ac248fb015e53/library/std/src/panicking.rs:435:5
   2: rustc_metadata::creader::CrateLoader::maybe_resolve_crate
   3: rustc_metadata::creader::CrateLoader::process_path_extern
   4: rustc_resolve::Resolver::extern_prelude_get
   5: rustc_resolve::macros::<impl rustc_resolve::Resolver>::early_resolve_ident_in_lexical_scope
   6: rustc_resolve::Resolver::resolve_path_with_ribs::{{closure}}
   7: rustc_resolve::Resolver::resolve_path_with_ribs
   8: rustc_resolve::imports::ImportResolver::finalize_import
   9: rustc_resolve::imports::ImportResolver::finalize_imports
  10: rustc_session::utils::<impl rustc_session::session::Session>::time
  11: rustc_resolve::Resolver::resolve_crate
  12: rustc_interface::passes::configure_and_expand_inner
  13: rustc_interface::passes::configure_and_expand::{{closure}}
  14: rustc_data_structures::box_region::PinnedGenerator<I,A,R>::new
  15: rustc_interface::passes::configure_and_expand
  16: rustc_interface::queries::Queries::expansion
  17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  18: rustc_span::with_source_map
  19: rustc_interface::interface::create_compiler_and_run
  20: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.1 (9bc8c42bb 2021-05-09) running on x86_64-unknown-linux-gnu

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: could not compile `ice`

To learn more, run the command again with --verbose.
> RUST_BACKTRACE=1 cargo +nightly check --tests
error: ~/ice/target/debug/deps/libice-3fb954df89f48978.so: undefined symbol: _ZN2v86Object19GetOwnPropertyNamesENS_5LocalINS_7ContextEEE
 --> tests/integration.rs:1:5
  |
1 | use ice::proc;
  |     ^^^

error: aborting due to previous error

error: could not compile `ice`

To learn more, run the command again with --verbose.

I thought there might be something wrong with my installation because the project worked with a lot more code than this and then stopped working, but I reproduced the issue on a fresh Docker image so maybe not. Let me know if there's more information I can provide.

@ehuss
Copy link
Contributor

ehuss commented May 26, 2021

I believe that the issue with "Failed to get crate data for crate18" for these particular cases has been fixed by #83404. That should be in 1.53 (beta or nightly). I'm going to close this as resolved by #83404.

@Heliozoa I think the nightly behavior (undefined symbol) is likely due to some linking issues with the neon C library? If you want to, you can file a new issue for that.

@ehuss ehuss closed this as completed May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-metadata Area: Crate metadata C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

4 participants