Skip to content

remap-path-prefix will not re-compile properly in dev build #66955

Closed

Description

@daxpedda
Old post

Using remap-path-prefix in development builds has no effect.
I'm not sure if this is intended or not, but it's not documented.
Would write a documentation PR if this is intended.

Changing remap-path-prefix in dev mode will not properly cause re-compilation and the debug info will not change.
In release mode changing the flag will always cause proper re-compilation and update the debug info accordingly.

Meta

rustc 1.41.0-nightly (412f43ac5 2019-11-24)
binary: rustc
commit-hash: 412f43ac5b4ae8c3599e71c6972112e9be4758fa
commit-date: 2019-11-24
host: x86_64-pc-windows-msvc
release: 1.41.0-nightly
LLVM version: 9.0

Activity

  1. added
    A-reproducibilityArea: Reproducible / deterministic builds
    C-bugCategory: This is a bug.
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Dec 2, 2019
  2. jonas-schievink commented on Dec 2, 2019

    @jonas-schievink
    Contributor

    Can you provide an example of this? Is this due to debuginfo included in the binary?

  3. daxpedda commented on Dec 2, 2019

    @daxpedda
    ContributorAuthor

    😞, I was just trying to reproduce it again, but couldn't.
    Apparently the issue was that changing the flag wouldn't cause proper re-compilation, so cargo clean solved the problem.

    Sorry!

    So this is now a re-compilation issue!
    For some reason in release it would always re-compile properly when changing this flag, but in development it wouldn't.

    Is this due to debuginfo included in the binary?

    I'm not sure how it behaves on other operating systems, but in windows both dev and release builds produce the debug info as a seperate file.
    Obviously in release mode we have to define debug = true, otherwise there won't be any debuginfo to begin with.

    Cargo.toml:

    [profile.release]
    debug = true

    main.rs:

    fn main() {
        panic!("test");
    }

    Both commands run with:
    RUSTFLAGS = "--remap-path-prefix WORKING_DIRECTORY="
    RUST_BACKTRACE = "full"

    cargo run:

    thread 'main' panicked at 'test', src\main.rs:2:5
    stack backtrace:
       0:     0x7ff74bf77bb9 - backtrace::backtrace::trace_unsynchronized
                                   at C:\Users\VssAdministrator\.cargo\registry\src\github.life-white.uk-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
       1:     0x7ff74bf77bb9 - std::sys_common::backtrace::_print_fmt
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:84
       2:     0x7ff74bf77bb9 - std::sys_common::backtrace::_print::{{impl}}::fmt
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:61
       3:     0x7ff74bf86e8b - core::fmt::write
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libcore\fmt\mod.rs:1030
       4:     0x7ff74bf75b94 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\io\mod.rs:1412
       5:     0x7ff74bf7a269 - std::sys_common::backtrace::_print
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:65
       6:     0x7ff74bf7a269 - std::sys_common::backtrace::print
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:50
       7:     0x7ff74bf7a269 - std::panicking::default_hook::{{closure}}
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:188
       8:     0x7ff74bf79ebc - std::panicking::default_hook
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:205
       9:     0x7ff74bf7a99c - std::panicking::rust_panic_with_hook
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:464
      10:     0x7ff74bf71ef1 - std::panicking::begin_panic<str*>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\panicking.rs:400
      11:     0x7ff74bf71e4c - test-remap::main
                                   at C:\Users\User\Documents\rust\test-remap\src\main.rs:2
      12:     0x7ff74bf716d0 - std::rt::lang_start::{{closure}}<()>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
      13:     0x7ff74bf7a3e7 - std::rt::lang_start_internal::{{closure}}
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:48
      14:     0x7ff74bf7a3e7 - std::panicking::try::do_call<closure-0,i32>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:287
      15:     0x7ff74bf7cd72 - panic_unwind::__rust_maybe_catch_panic
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libpanic_unwind\lib.rs:81
      16:     0x7ff74bf7abc2 - std::panicking::try
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:265
      17:     0x7ff74bf7abc2 - std::panic::catch_unwind
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panic.rs:395
      18:     0x7ff74bf7abc2 - std::rt::lang_start_internal
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:47
      19:     0x7ff74bf716ab - std::rt::lang_start<()>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
      20:     0x7ff74bf71e70 - main
      21:     0x7ff74bf89790 - invoke_main
                                   at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
      22:     0x7ff74bf89790 - __scrt_common_main_seh
                                   at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
      23:     0x7ff99d497974 - BaseThreadInitThunk
      24:     0x7ff99f98a271 - RtlUserThreadStart
    

    cargo run --release:

    thread 'main' panicked at 'test', src\main.rs:2:5
    stack backtrace:
       0:     0x7ff797ab6959 - backtrace::backtrace::trace_unsynchronized
                                   at C:\Users\VssAdministrator\.cargo\registry\src\github.life-white.uk-1ecc6299db9ec823\backtrace-0.3.40\src\backtrace\mod.rs:66
       1:     0x7ff797ab6959 - std::sys_common::backtrace::_print_fmt
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:84
       2:     0x7ff797ab6959 - std::sys_common::backtrace::_print::{{impl}}::fmt
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:61
       3:     0x7ff797ac5afb - core::fmt::write
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libcore\fmt\mod.rs:1030
       4:     0x7ff797ab4934 - std::io::Write::write_fmt<std::sys::windows::stdio::Stderr>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\io\mod.rs:1412
       5:     0x7ff797ab9009 - std::sys_common::backtrace::_print
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:65
       6:     0x7ff797ab9009 - std::sys_common::backtrace::print
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\sys_common\backtrace.rs:50
       7:     0x7ff797ab9009 - std::panicking::default_hook::{{closure}}
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:188
       8:     0x7ff797ab8c5c - std::panicking::default_hook
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:205
       9:     0x7ff797ab973c - std::panicking::rust_panic_with_hook
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:464
      10:     0x7ff797ab1025 - std::panicking::begin_panic<str*>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\panicking.rs:400
      11:     0x7ff797ab111c - test-remap::main
                                   at \src\main.rs:2
      12:     0x7ff797ab10d6 - std::rt::lang_start::{{closure}}<()>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\src\libstd\rt.rs:61
      13:     0x7ff797ab9187 - std::rt::lang_start_internal::{{closure}}
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:48
      14:     0x7ff797ab9187 - std::panicking::try::do_call<closure-0,i32>
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:287
      15:     0x7ff797abbb12 - panic_unwind::__rust_maybe_catch_panic
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libpanic_unwind\lib.rs:81
      16:     0x7ff797ab9962 - std::panicking::try
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panicking.rs:265
      17:     0x7ff797ab9962 - std::panic::catch_unwind
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\panic.rs:395
      18:     0x7ff797ab9962 - std::rt::lang_start_internal
                                   at /rustc/412f43ac5b4ae8c3599e71c6972112e9be4758fa\/src\libstd\rt.rs:47
      19:     0x7ff797ab1147 - main
      20:     0x7ff797ac8400 - invoke_main
                                   at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:78
      21:     0x7ff797ac8400 - __scrt_common_main_seh
                                   at d:\agent\_work\3\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288
      22:     0x7ff99d497974 - BaseThreadInitThunk
      23:     0x7ff99f98a271 - RtlUserThreadStart
    
  4. changed the title [-]`remap-path-prefix` only effective in release builds[/-] [+]`remap-path-prefix` will not re-compile properly in `dev` build[/+] on Dec 2, 2019
  5. jonas-schievink commented on Dec 2, 2019

    @jonas-schievink
    Contributor

    Perhaps the option needs to be TRACKED instead of UNTRACKED here?

    remap_path_prefix: Vec<(PathBuf, PathBuf)> [UNTRACKED],

  6. daxpedda commented on Dec 2, 2019

    @daxpedda
    ContributorAuthor

    I wanted to try it out, but I'm kinda having trouble building rustc it seems. So feel free to check it out.

  7. jgalenson commented on Feb 6, 2020

    @jgalenson

    I haven't tested it out, but I believe changing remap_path_prefix to TRACKED will cause other problems, as it means the argument's value will be hashed. Then two builds in different directories that try to use that flag to get the same output will differ as they have different values for that argument.

  8. jyn514 commented on Apr 15, 2021

    @jyn514
    Member

    Then two builds in different directories that try to use that flag to get the same output will differ as they have different values for that argument.

    Well yes, that's the whole point. Their inputs are different so the outputs need to be recomputed. Otherwise it will end up caching the wrong values.

    Note that TRACKED can never break builds, or change the output compared to a non-incremental build, it can only make them slower.

  9. added 2 commits that reference this issue on Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-incr-compArea: Incremental compilationA-reproducibilityArea: Reproducible / deterministic buildsC-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions