sidkshatriya / rd

rd is a record/replay debugger written in rust
Other
957 stars 14 forks source link

WSL 2 build issues #6

Closed pcbeard closed 3 years ago

pcbeard commented 3 years ago

Not sure if this is expected to work. I installed rust via rustup-init, and noticed that you're using cargo features that require nightly, so I made the nightly toolchain default in the rr project:

rustup override set nightly

When I run rustup build it first complained about not having a 32-bit cross compilation:

CMake Error at CMakeLists.txt:106 (message):
    Your toolchain doesn't support 32-bit cross-compilation.  Install the
    required packages or pass -Ddisable32bit=ON to cmake.

I fixed this by adding:

     Config::new(".")
+        .define("disable32bit", "ON")
         .define("CMAKE_BUILD_TYPE", "Release")
         .define("CMAKE_INSTALL_PREFIX", target_dir)
         .build();

Finally, the build fails at this point with the error message:

 RUST_BACKTRACE=full cargo build
  /usr/include/x86_64-linux-gnu/bits/statx.h:25:8: error: redefinition of 'statx_timestamp'
  /usr/include/linux/stat.h:56:8: note: previous definition is here
  /usr/include/x86_64-linux-gnu/bits/statx.h:36:8: error: redefinition of 'statx'
  /usr/include/linux/stat.h:99:8: note: previous definition is here
  /usr/include/x86_64-linux-gnu/bits/statx.h:25:8: error: redefinition of 'statx_timestamp', err: true
  /usr/include/x86_64-linux-gnu/bits/statx.h:36:8: error: redefinition of 'statx', err: true
  thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ()', build.rs:142:10
  stack backtrace:
     0:     0x55b86f5e35a0 - std::backtrace_rs::backtrace::libunwind::trace::hdcf4f90f85129e83
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
     1:     0x55b86f5e35a0 - std::backtrace_rs::backtrace::trace_unsynchronized::h2669e30cb82f6732
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
     2:     0x55b86f5e35a0 - std::sys_common::backtrace::_print_fmt::hfbda19e17f6db318
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:67:5
     3:     0x55b86f5e35a0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1a8751bf59281272
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:46:22
     4:     0x55b86f60b46f - core::fmt::write::h7aa6cd0067dca82a
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/fmt/mod.rs:1094:17
     5:     0x55b86f5dfa65 - std::io::Write::write_fmt::hd7dd3a1df9b6befb
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/io/mod.rs:1584:15
     6:     0x55b86f5e5f5b - std::sys_common::backtrace::_print::h551e9ec8a9fa8106
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:49:5
     7:     0x55b86f5e5f5b - std::sys_common::backtrace::print::ha4b1c5e95fa040b3
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:36:9
     8:     0x55b86f5e5f5b - std::panicking::default_hook::{{closure}}::h0b34c9ab7fb9f857
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:208:50
     9:     0x55b86f5e5a3d - std::panicking::default_hook::h3067e8318decd17a
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:225:9
    10:     0x55b86f5e6530 - std::panicking::rust_panic_with_hook::h81b8facc50f34daa
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:595:17
    11:     0x55b86f5e6107 - std::panicking::begin_panic_handler::{{closure}}::ha376ab85d95a000e
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:497:13
    12:     0x55b86f5e3a5c - std::sys_common::backtrace::__rust_end_short_backtrace::h6795c8afdd1a77e6
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:141:18
    13:     0x55b86f5e6069 - rust_begin_unwind
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:493:5
    14:     0x55b86ef879b1 - core::panicking::panic_fmt::hbe99dddd3092ba3c
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/panicking.rs:92:14
    15:     0x55b86ef87aa3 - core::result::unwrap_failed::hf79563fef9d11ab8
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/result.rs:1355:5
    16:     0x55b86ef88de2 - core::result::Result<T,E>::unwrap::h3de4c0cfbc3f2eb3
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/result.rs:1037:23
    17:     0x55b86ef8ac2b - build_script_build::main::h524a69ec66303409
                                 at /home/pcbeard/rd/build.rs:136:31
    18:     0x55b86ef8bf2b - core::ops::function::FnOnce::call_once::hfc0c39065fe0f54a
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/ops/function.rs:227:5
    19:     0x55b86ef8828e - std::sys_common::backtrace::__rust_begin_short_backtrace::he78835f3afb121b3
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/sys_common/backtrace.rs:125:18
    20:     0x55b86ef8cac1 - std::rt::lang_start::{{closure}}::hab57f4735b86f87f
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/rt.rs:49:18
    21:     0x55b86f5e6a0a - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h3b8c329143d7638a
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/core/src/ops/function.rs:259:13
    22:     0x55b86f5e6a0a - std::panicking::try::do_call::h4b72c261b4eefc1b
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:379:40
    23:     0x55b86f5e6a0a - std::panicking::try::h703d31b7896cbd49
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panicking.rs:343:19
    24:     0x55b86f5e6a0a - std::panic::catch_unwind::h37cad9b35388a915
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/panic.rs:431:14
    25:     0x55b86f5e6a0a - std::rt::lang_start_internal::hab5a8a909af4f90e
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/rt.rs:34:21
    26:     0x55b86ef8caa0 - std::rt::lang_start::h1edf0894d3efe9f6
                                 at /rustc/5c029265465301fe9cb3960ce2a5da6c99b8dcf2/library/std/src/rt.rs:48:5
    27:     0x55b86ef8bbac - main
    28:     0x7f87c356d09b - __libc_start_main
    29:     0x55b86ef8814a - _start
    30:                0x0 - <unknown>
pcbeard commented 3 years ago

This is using the Debian distribution of WSL 2.

sidkshatriya commented 3 years ago

rd should be able to build on debian on WSL 2. The fact that you're getting some build errors is something that needs to be looked into.

did you do:

$ sudo apt install cmake make capnproto libcapnp-dev gdb g++-multilib libclang-11-dev

in your debian installation before trying to build? What version of debian are your using?

But the main problem is that even if it did build properly it won't work. See an issue regarding rr and WSL 2.

https://github.com/rr-debugger/rr/issues/2506

So in other words rr wont work on WSL 2. Since rd is a port and uses the same performance counters I'm fairly certain that rd wont work on WSL 2 also.

Closing this ticket. We can try figuring build issues though..

sidkshatriya commented 3 years ago

(after installing the above packages on debian and removing your modification to build.rs, please let me know what error you get...)

pcbeard commented 3 years ago

After installing those packages, stashing my changes, I was able to get past the 32-bit issues, but when the build finishes, it still fails with the same error message:

--- stderr /usr/include/x86_64-linux-gnu/bits/statx.h:25:8: error: redefinition of 'statx_timestamp' /usr/include/linux/stat.h:56:8: note: previous definition is here /usr/include/x86_64-linux-gnu/bits/statx.h:36:8: error: redefinition of 'statx' /usr/include/linux/stat.h:99:8: note: previous definition is here /usr/include/x86_64-linux-gnu/bits/statx.h:25:8: error: redefinition of 'statx_timestamp', err: true /usr/include/x86_64-linux-gnu/bits/statx.h:36:8: error: redefinition of 'statx', err: true thread 'main' panicked at 'called Result::unwrap() on an Err value: ()', build.rs:141:10

sidkshatriya commented 3 years ago

What exact version of debian are you using?

pcbeard commented 3 years ago

uname -sr Linux 4.19.128-microsoft-standard

sidkshatriya commented 3 years ago

Thanks -- What does cat /etc/issue output when you run on command line?