Skip to content

rust-analyzer: Failed to run build scripts of some packages #15324

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
EvilWatermelon opened this issue Jul 21, 2023 · 3 comments
Closed

rust-analyzer: Failed to run build scripts of some packages #15324

EvilWatermelon opened this issue Jul 21, 2023 · 3 comments
Labels
C-support Category: support questions

Comments

@EvilWatermelon
Copy link

EvilWatermelon commented Jul 21, 2023

I'm new with the rust-analyzer and after my successful installation I'm always getting this output from the analyzer:

FetchBuildDataError:
error: failed to run custom build command for `paho-mqtt-sys v0.8.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/debug/build/paho-mqtt-sys-6e7ed18a011a69ed/build-script-build` (exit status: 101)
  --- stdout
  debug:Running the bundled build for Paho C
  cargo:rerun-if-changed=build.rs
  [...]
  CMAKE = None
  [...]

  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  thread 'main' panicked at '
  failed to execute command: Not a directory (os error 20)

  build script failed, must exit now', /home/isumis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
     1: core::panicking::panic_fmt
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
     2: cmake::fail
     3: cmake::run
     4: cmake::Config::build
     5: build_script_build::build::main
     6: build_script_build::main
     7: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

thread '<unnamed>' panicked at 'Box<dyn Any>', /home/isumis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro-error-1.0.4/src/lib.rs:472:5
stack backtrace:
   0: std::panicking::begin_panic
   1: proc_macro_error::abort_now
   2: proc_macro_error::diagnostic::Diagnostic::abort
   3: <core::result::Result<T,syn::error::Error> as utoipa_gen::ResultExt<T>>::unwrap_or_abort
   4: utoipa_gen::path::{{closure}}
   5: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
   6: std::panicking::try::do_call
   7: __rust_try
   8: std::panicking::try
   9: std::panic::catch_unwind
  10: proc_macro_error::entry_point
  11: utoipa_gen::path
  12: core::ops::function::Fn::call
  13: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}::{{closure}}
  14: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}::{{closure}}
  15: proc_macro::bridge::scoped_cell::ScopedCell<T>::set::{{closure}}
  16: proc_macro::bridge::scoped_cell::ScopedCell<T>::replace
  17: proc_macro::bridge::scoped_cell::ScopedCell<T>::set
  18: proc_macro::bridge::client::run_client::{{closure}}::{{closure}}
  19: std::thread::local::LocalKey<T>::try_with
  20: std::thread::local::LocalKey<T>::with
  21: proc_macro::bridge::client::run_client::{{closure}}
  22: <core::panic::unwind_safe::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
  23: std::panicking::try::do_call
  24: __rust_try
  25: std::panicking::try
  26: std::panic::catch_unwind
  27: proc_macro::bridge::client::run_client
  28: proc_macro::bridge::client::Client<(proc_macro::TokenStream,proc_macro::TokenStream),proc_macro::TokenStream>::expand2::{{closure}}
  29: proc_macro::bridge::selfless_reify::reify_to_extern_c_fn_hrt_bridge::wrapper
  30: proc_macro::bridge::server::run_server::<proc_macro_srv::abis::abi_sysroot::ra_server::RustAnalyzer, (proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>, proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>), core::option::Option<proc_macro::bridge::Marked<proc_macro_srv::abis::abi_sysroot::ra_server::token_stream::TokenStream, proc_macro::bridge::client::TokenStream>>, proc_macro::bridge::server::SameThread>
  31: <proc_macro_srv::abis::Abi>::expand
  32: <proc_macro_srv::dylib::Expander>::expand
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

[ERROR rust_analyzer::main_loop] FetchBuildDataError:
error: failed to run custom build command for `paho-mqtt-sys v0.8.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/home/isumis/Dokumente/dev/whiz/target/debug/build/paho-mqtt-sys-6e7ed18a011a69ed/build-script-build` (exit status: 101)
  --- stdout
  debug:Running the bundled build for Paho C
  cargo:rerun-if-changed=build.rs
  [...]
  CMAKE = None
  [...]

  --- stderr
  fatal: not a git repository (or any of the parent directories): .git
  thread 'main' panicked at '
  failed to execute command: Not a directory (os error 20)

  build script failed, must exit now', /home/isumis/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  stack backtrace:
     0: rust_begin_unwind
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/std/src/panicking.rs:578:5
     1: core::panicking::panic_fmt
               at /rustc/90c541806f23a127002de5b4038be731ba1458ca/library/core/src/panicking.rs:67:14
     2: cmake::fail
     3: cmake::run
     4: cmake::Config::build
     5: build_script_build::build::main
     6: build_script_build::main
     7: core::ops::function::FnOnce::call_once
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

[Error - 11:26:10 AM] Request textDocument/inlayHint failed.
  Message: request handler panicked: index out of bounds: the len is 3 but the index is 5
  Code: -32603 
Panic context:
> 
version: 0.3.1591-standalone
request: textDocument/semanticTokens/range SemanticTokensRangeParams {
    work_done_progress_params: WorkDoneProgressParams {
        work_done_token: None,
    },
    partial_result_params: PartialResultParams {
        partial_result_token: None,
    },
    text_document: TextDocumentIdentifier {
        uri: Url {
            scheme: "file",
            cannot_be_a_base: false,
            username: "",
            password: None,
            host: None,
            port: None,
            path: "/src/service/ip_domain_service.rs",
            query: None,
            fragment: None,
        },
    },
    range: Range {
        start: Position {
            line: 0,
            character: 0,
        },
        end: Position {
            line: 41,
            character: 0,
        },
    },
}

thread 'Worker' panicked at 'index out of bounds: the len is 1 but the index is 1', crates/hir-def/src/nameres/path_resolution.rs:424:33
stack backtrace:
   0: rust_begin_unwind
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:67:14
   2: core::panicking::panic_bounds_check
             at /rustc/8ede3aae28fe6e4d52b38157d7bfe0d3bceef225/library/core/src/panicking.rs:162:5
   3: hir_def::nameres::path_resolution::<impl hir_def::nameres::DefMap>::resolve_path_fp_with_macro_single
   4: hir_def::resolver::ModuleItemMap::resolve_path_in_type_ns
   5: hir_def::resolver::Resolver::resolve_path_in_type_ns
   6: hir_ty::lower::TyLoweringContext::lower_ty_ext
   7: hir_ty::lower::impl_self_ty_query
   8: salsa::runtime::Runtime::execute_query_implementation
   9: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  10: salsa::derived::slot::Slot<Q,MP>::maybe_changed_since
  11: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::maybe_changed_since
  12: salsa::derived::slot::MemoRevisions::validate_memoized_value
  13: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  14: salsa::derived::slot::Slot<Q,MP>::read
  15: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  16: <DB as hir_ty::db::HirDatabase>::inherent_impls_in_crate::__shim
  17: hir_ty::method_resolution::incoherent_inherent_impl_crates
  18: salsa::runtime::Runtime::execute_query_implementation
  19: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  20: salsa::derived::slot::Slot<Q,MP>::read
  21: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  22: <DB as hir_ty::db::HirDatabase>::incoherent_inherent_impl_crates::__shim
  23: <DB as hir_ty::db::HirDatabase>::incoherent_inherent_impl_crates
  24: hir_ty::method_resolution::def_crates
  25: hir_ty::method_resolution::iterate_method_candidates_with_autoref::{{closure}}
  26: hir_ty::method_resolution::iterate_method_candidates_dyn
  27: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  28: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr
  29: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_overloadable_binop
  30: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  31: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce_never
  32: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  33: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_coerce
  34: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_block
  35: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_expr_inner
  36: hir_ty::infer::expr::<impl hir_ty::infer::InferenceContext>::infer_return
  37: hir_ty::infer::infer_query
  38: salsa::runtime::Runtime::execute_query_implementation
  39: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  40: salsa::derived::slot::Slot<Q,MP>::read
  41: <salsa::derived::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::try_fetch
  42: <DB as hir_ty::db::HirDatabase>::infer_query::__shim
  43: <DB as hir_ty::db::HirDatabase>::infer_query
  44: hir_ty::db::infer_wait
  45: <DB as hir_ty::db::HirDatabase>::infer
  46: hir::source_analyzer::SourceAnalyzer::new_for_body
  47: hir::semantics::SemanticsImpl::analyze_impl
  48: ide_db::defs::NameClass::classify
  49: ide::syntax_highlighting::highlight::name_like
  50: ide::syntax_highlighting::highlight
  51: std::panicking::try
  52: rust_analyzer::handlers::request::handle_semantic_tokens_range
  53: core::ops::function::FnOnce::call_once{{vtable.shim}}
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
[Error - 11:26:10 AM] Request textDocument/semanticTokens/range failed.
  Message: request handler panicked: index out of bounds: the len is 1 but the index is 1
  Code: -32603 

How can I fix these errors? - I know that these are errors from compiling a crate but the program can execute without any errors.

@EvilWatermelon EvilWatermelon added the C-support Category: support questions label Jul 21, 2023
@lnicola
Copy link
Member

lnicola commented Jul 21, 2023

  CMAKE = None

Maybe you need to install CMake? Without it, I get:

  Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
  thread 'main' panicked at '
  failed to execute command: No such file or directory (os error 2)
  is `cmake` not installed?

Except for the last one, those errors come from the paho-mqtt-sys build script, not from us. I suspect a plain cargo check will fail for you just as well.

@EvilWatermelon
Copy link
Author

Ok, the messages are gone now. I ran a cargo check and it seemed that I had to restart my computer.

@lnicola
Copy link
Member

lnicola commented Jul 21, 2023

Toll!

As for the last error, it looks like #5366.

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

No branches or pull requests

2 participants