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

No errors reported when custom build command failed #3155

Closed
bjorn3 opened this issue Feb 15, 2020 · 11 comments
Closed

No errors reported when custom build command failed #3155

bjorn3 opened this issue Feb 15, 2020 · 11 comments
Labels
Broken Window Bugs / technical debt to be addressed immediately S-actionable Someone could pick this issue up and work on it right now

Comments

@bjorn3
Copy link
Member

bjorn3 commented Feb 15, 2020

$ git clone https://github.com/rust-lang/backtrace-rs.git
$ cd backtrace-rs
backtrace-rs $ cargo check
   Compiling backtrace-sys v0.1.32 (/Users/bjorn/Documents/backtrace-rs/crates/backtrace-sys)
error: failed to run custom build command for `backtrace-sys v0.1.32 (/Users/bjorn/Documents/backtrace-rs/crates/backtrace-sys)`

Caused by:
  process didn't exit successfully: `/Users/bjorn/Documents/backtrace-rs/target/debug/build/backtrace-sys-1f016f2963ab0034/build-script-build` (exit code: 1)
--- stdout
[...]

When opening in VSCode, it doesn't show any error however.

(By the way the error was because I didn't run git submodule update --init)

@kiljacken
Copy link
Contributor

Could you share the output of cargo check --message-format=json in a repo with that error?

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 16, 2020

$ cargo check --message-format=json
{"reason":"compiler-artifact","package_id":"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"cc","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.50/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcc-00c5030842a6bd67.rlib","/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcc-00c5030842a6bd67.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/build.rs","edition":"2015","doctest":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/build/libc-58f311a9c2a2a7c7/build-script-build"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"cfg-if","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.10/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcfg_if-514b72ccd8f7fad1.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"rustc-demangle","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.16/src/lib.rs","edition":"2015","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/librustc_demangle-1bc382716446cdbd.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"backtrace-sys 0.1.32 (path+file:///home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys)","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys/build.rs","edition":"2015","doctest":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-c60479aaa6c68a55/build-script-build"],"executable":null,"fresh":true}
{"reason":"build-script-executed","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","linked_libs":[],"linked_paths":[],"cfgs":["freebsd11","libc_priv_mod_use","libc_union","libc_const_size_of","libc_align","libc_core_cvoid","libc_packedN"],"env":[]}
   Compiling backtrace-sys v0.1.32 (/home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys)
{"reason":"compiler-artifact","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"libc","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/src/lib.rs","edition":"2015","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/liblibc-a74ecc186e44779d.rmeta"],"executable":null,"fresh":true}
error: failed to run custom build command for `backtrace-sys v0.1.32 (/home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys)`

Caused by:
  process didn't exit successfully: `/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-c60479aaa6c68a55/build-script-build` (exit code: 1)
--- stdout
cargo:rustc-cfg=rbt
TARGET = Some("x86_64-unknown-linux-gnu")
OPT_LEVEL = Some("0")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-unknown-linux-gnu = None
CC_x86_64_unknown_linux_gnu = None
HOST_CC = None
CC = None
CFLAGS_x86_64-unknown-linux-gnu = None
CFLAGS_x86_64_unknown_linux_gnu = None
HOST_CFLAGS = None
CFLAGS = None
CRATE_CC_NO_DEFAULTS = None
CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
running: "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-f1dc3b99f500d44a/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-Dmacho_get_view=__rbt_macho_get_view" "-Dmacho_symbol_type_relevant=__rbt_macho_symbol_type_relevant" "-Dmacho_get_commands=__rbt_macho_get_commands" "-Dmacho_try_dsym=__rbt_macho_try_dsym" "-Dmacho_try_dwarf=__rbt_macho_try_dwarf" "-Dmacho_get_addr_range=__rbt_macho_get_addr_range" "-Dmacho_get_uuid=__rbt_macho_get_uuid" "-Dmacho_add=__rbt_macho_add" "-Dmacho_add_symtab=__rbt_macho_add_symtab" "-Dmacho_file_to_host_u64=__rbt_macho_file_to_host_u64" "-Dmacho_file_to_host_u32=__rbt_macho_file_to_host_u32" "-Dmacho_file_to_host_u16=__rbt_macho_file_to_host_u16" "-o" "/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-f1dc3b99f500d44a/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c"
cargo:warning=cc: error: src/libbacktrace/alloc.c: Bestand of map bestaat niet
cargo:warning=cc: fatal error: no input files
cargo:warning=compilation terminated.
exit code: 1

--- stderr


error occurred: Command "cc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-I" "src/libbacktrace" "-I" "/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-f1dc3b99f500d44a/out" "-fvisibility=hidden" "-DBACKTRACE_ELF_SIZE=64" "-DBACKTRACE_SUPPORTED=1" "-DBACKTRACE_USES_MALLOC=1" "-DBACKTRACE_SUPPORTS_THREADS=0" "-DBACKTRACE_SUPPORTS_DATA=0" "-DHAVE_DL_ITERATE_PHDR=1" "-D_GNU_SOURCE=1" "-D_LARGE_FILES=1" "-Dbacktrace_full=__rbt_backtrace_full" "-Dbacktrace_dwarf_add=__rbt_backtrace_dwarf_add" "-Dbacktrace_initialize=__rbt_backtrace_initialize" "-Dbacktrace_pcinfo=__rbt_backtrace_pcinfo" "-Dbacktrace_syminfo=__rbt_backtrace_syminfo" "-Dbacktrace_get_view=__rbt_backtrace_get_view" "-Dbacktrace_release_view=__rbt_backtrace_release_view" "-Dbacktrace_alloc=__rbt_backtrace_alloc" "-Dbacktrace_free=__rbt_backtrace_free" "-Dbacktrace_vector_finish=__rbt_backtrace_vector_finish" "-Dbacktrace_vector_grow=__rbt_backtrace_vector_grow" "-Dbacktrace_vector_release=__rbt_backtrace_vector_release" "-Dbacktrace_close=__rbt_backtrace_close" "-Dbacktrace_open=__rbt_backtrace_open" "-Dbacktrace_print=__rbt_backtrace_print" "-Dbacktrace_simple=__rbt_backtrace_simple" "-Dbacktrace_qsort=__rbt_backtrace_qsort" "-Dbacktrace_create_state=__rbt_backtrace_create_state" "-Dbacktrace_uncompress_zdebug=__rbt_backtrace_uncompress_zdebug" "-Dmacho_get_view=__rbt_macho_get_view" "-Dmacho_symbol_type_relevant=__rbt_macho_symbol_type_relevant" "-Dmacho_get_commands=__rbt_macho_get_commands" "-Dmacho_try_dsym=__rbt_macho_try_dsym" "-Dmacho_try_dwarf=__rbt_macho_try_dwarf" "-Dmacho_get_addr_range=__rbt_macho_get_addr_range" "-Dmacho_get_uuid=__rbt_macho_get_uuid" "-Dmacho_add=__rbt_macho_add" "-Dmacho_add_symtab=__rbt_macho_add_symtab" "-Dmacho_file_to_host_u64=__rbt_macho_file_to_host_u64" "-Dmacho_file_to_host_u32=__rbt_macho_file_to_host_u32" "-Dmacho_file_to_host_u16=__rbt_macho_file_to_host_u16" "-o" "/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-f1dc3b99f500d44a/out/src/libbacktrace/alloc.o" "-c" "src/libbacktrace/alloc.c" with args "cc" did not execute successfully (status code exit code: 1).



$ cargo check --message-format 2>/dev/null
{"reason":"compiler-artifact","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/build.rs","edition":"2015","doctest":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/build/libc-58f311a9c2a2a7c7/build-script-build"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"cc 1.0.50 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"cc","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.50/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcc-00c5030842a6bd67.rlib","/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcc-00c5030842a6bd67.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"rustc-demangle 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"rustc-demangle","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/rustc-demangle-0.1.16/src/lib.rs","edition":"2015","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/librustc_demangle-1bc382716446cdbd.rmeta"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"cfg-if","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/cfg-if-0.1.10/src/lib.rs","edition":"2018","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/libcfg_if-514b72ccd8f7fad1.rmeta"],"executable":null,"fresh":true}
{"reason":"build-script-executed","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","linked_libs":[],"linked_paths":[],"cfgs":["freebsd11","libc_priv_mod_use","libc_union","libc_const_size_of","libc_align","libc_core_cvoid","libc_packedN"],"env":[]}
{"reason":"compiler-artifact","package_id":"backtrace-sys 0.1.32 (path+file:///home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys)","target":{"kind":["custom-build"],"crate_types":["bin"],"name":"build-script-build","src_path":"/home/bjorn/Documenten/backtrace-rs/crates/backtrace-sys/build.rs","edition":"2015","doctest":false},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/build/backtrace-sys-c60479aaa6c68a55/build-script-build"],"executable":null,"fresh":true}
{"reason":"compiler-artifact","package_id":"libc 0.2.66 (registry+https://github.com/rust-lang/crates.io-index)","target":{"kind":["lib"],"crate_types":["lib"],"name":"libc","src_path":"/home/bjorn/.cargo/registry/src/github.com-1ecc6299db9ec823/libc-0.2.66/src/lib.rs","edition":"2015","doctest":true},"profile":{"opt_level":"0","debuginfo":2,"debug_assertions":true,"overflow_checks":true,"test":false},"features":[],"filenames":["/home/bjorn/Documenten/backtrace-rs/target/debug/deps/liblibc-a74ecc186e44779d.rmeta"],"executable":null,"fresh":true}

@bjorn3
Copy link
Member Author

bjorn3 commented Feb 16, 2020

The error seems to end up on stderr.

@lnicola
Copy link
Member

lnicola commented Jan 22, 2021

Triage: still happens.

@lnicola lnicola added the Broken Window Bugs / technical debt to be addressed immediately label Apr 1, 2021
matklad added a commit to matklad/rust-analyzer that referenced this issue Apr 5, 2021
matklad added a commit to matklad/rust-analyzer that referenced this issue Apr 6, 2021
bors bot added a commit that referenced this issue Apr 6, 2021
8355: internal: do not drop errors from cargo metadata/check r=matklad a=matklad

Work towards #3155

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
bors bot added a commit that referenced this issue Apr 6, 2021
8355: internal: do not drop errors from cargo metadata/check r=matklad a=matklad

Work towards #3155

Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
@bors bors bot closed this as completed in de33702 Apr 6, 2021
@matklad
Copy link
Member

matklad commented Apr 6, 2021

Thanks for marking this as a broken window @lnicola !

@mareq
Copy link

mareq commented Apr 12, 2021

I am getting the following when opening a source file with intentionally introduced error (commented out use, so that there is undefined symbol):

[Error  - 01:09:16] Request textDocument/codeLens failed.
  Message: content modified
  Code: -32801 
[ERROR rust_analyzer::reload] failed to switch build data: cargo check failed:
    Checking data-analytics-backend v0.1.0 (/home/mareq/work/projects/sandbox/data-analytics/backend)
error: could not compile `data-analytics-backend`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

[ERROR rust_analyzer::reload] failed to switch build data: cargo check failed:
    Checking data-analytics-backend v0.1.0 (/home/mareq/work/projects/sandbox/data-analytics/backend)
error: could not compile `data-analytics-backend`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

[ERROR rust_analyzer::reload] failed to switch build data: cargo check failed:
    Checking data-analytics-backend v0.1.0 (/home/mareq/work/projects/sandbox/data-analytics/backend)
error: could not compile `data-analytics-backend`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

I do not seem to be able to pass --verbose as the message suggests, but it looks like it is coming from here.

Not sure if that is relevant, but I am using NeoVim (see below) with CoC plugin (d3e40cea) and up-to-date nightly Rust toolchain (including rust-analyzer).

NVIM v0.5.0-dev+1236-g1b030f889
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3

Am I missing something, is there something more than just simple commented-out use statement, or is it just uninformative message? I think I have seen similar thing on different toy-project two days ago, which was provoked by building it from command line and then having rust-analyzer to have its go (cargo clean did reliably "resolve" that problem) - unfortunately I do not have that toy-project any more, but if needed, I may be able to re-create it.

Btw, thanks for adding the error log there - I am not sure what would have been the behaviour without it, but it would probably be much more difficult to figure out where it fails without this recently added log message. 👍

@matklad
Copy link
Member

matklad commented Apr 12, 2021 via email

@mareq
Copy link

mareq commented Apr 12, 2021

@matklad Thanks, that starts to make sense then. Do you thing that it would be possible to somehow prevent this problem? (That is my primary motivation behind asking the above question.)

@matklad
Copy link
Member

matklad commented Apr 12, 2021

Yeah, that's a bug on our side, impacted reduced in #8476 and the culprit fixed in #8478.

@mareq
Copy link

mareq commented Apr 12, 2021

Nice, thank you Mr.! 👍

EDIT: I have compiled rust-analyzer from the current master (cae920a1b) and can confirm that the problem is indeed resolved.

@matklad
Copy link
Member

matklad commented Apr 12, 2021

Thanks for verifying that it works and reporting back @mareq !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Broken Window Bugs / technical debt to be addressed immediately S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

No branches or pull requests

5 participants