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

Try mustang on real-world programs! #22

Open
sunfishcode opened this issue Sep 19, 2021 · 40 comments
Open

Try mustang on real-world programs! #22

sunfishcode opened this issue Sep 19, 2021 · 40 comments
Labels
good first issue Good for newcomers

Comments

@sunfishcode
Copy link
Owner

sunfishcode commented Sep 19, 2021

Mustang is now complete enough to support the current directory, command-line arguments, environment variables, std::fs, std::net, std::thread, std::time,std::alloc, and everything in the standard library that doesn't involve I/O too. It can now run some real-world programs! To try it:

  • Identify a program to try. Ideally avoid the known limitations, however reports confirming the known limitations are still useful.

  • Follow the usage instructions in the README.

  • Post a comment here about whatever happens—success, failure of any kind, or something was unclear.

@jplatte
Copy link
Contributor

jplatte commented Oct 8, 2021

I tried to run an async web app using tokio, it failed in tokio initialization because sched_getaffinity (used by num_cpus) is not implemented 🙁

What the error looks like
thread 'main' panicked at 'not implemented: sched_getaffinity', /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/c-scape-0.0.0/src/lib.rs:2289:5
stack backtrace:
   0: rust_begin_unwind
             at /home/jplatte/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:517:5
   1: core::panicking::panic_fmt
             at /home/jplatte/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:100:14
   2: sched_getaffinity
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/c-scape-0.0.0/src/lib.rs:2289:5
   3: num_cpus::linux::logical_cpus
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/num_cpus-1.13.0/src/linux.rs:41:17
   4: num_cpus::linux::get_num_cpus
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/num_cpus-1.13.0/src/linux.rs:35:17
   5: num_cpus::get
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/num_cpus-1.13.0/src/lib.rs:73:5
   6: tokio::loom::std::sys::num_cpus
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.11.0/src/loom/std/mod.rs:87:23
   7: core::ops::function::FnOnce::call_once
             at /home/jplatte/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
   8: core::option::Option<T>::unwrap_or_else
             at /home/jplatte/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/option.rs:784:21
   9: tokio::runtime::builder::Builder::build_threaded_runtime
             at /home/jplatte/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.11.0/src/runtime/builder.rs:545:32
   [...]

When using the current_thread runtime instead, it doesn't fail to initialize but still doesn't work (worker threads panic and new ones are started constantly when trying to connect to the app AFAICT), due to unimplemented condvar stuff mentioned in the readme.

Also, nm -u does return some output for the binary:

                 U epoll_create1@GLIBC_2.9
                 U epoll_ctl@GLIBC_2.3.2
                 U epoll_wait@GLIBC_2.3.2
                 U eventfd@GLIBC_2.7

@jplatte
Copy link
Contributor

jplatte commented Oct 8, 2021

I found an application I wrote that works with mustang: https://github.com/jplatte/i3-workspace-scroll

It's < 50 LOC but it uses command line arguments and some IPC through a socket file.

One thing I was curious about was file sizes. Here's a comparison:

Debug Release Mustang+Debug Mustang+Release
Original 7.1M 3.7M 25.3M 2.0M
Stripped 691K 447K 4.6M 1.4M

The sizes of the .so files the application links against w/o mustang (libc, libdl, libgcc_s, libm, ld-linux-x86-64) add up to about 4.1M.

@sunfishcode
Copy link
Owner Author

Thanks for trying it out! I believe you're the first person to have tried anything with async 😄 . Fortunately, I expect sched_getaffinity, epoll_* and eventfd will be pretty straightforward.

Concerning code size, mustang currently forces its entire libc to be statically linked in, in order to prevent the linker from satisfying any symbol references with the platform libc. I'm hoping to find a better approach there.

@sunfishcode
Copy link
Owner Author

With #45, mustang no longer forces its entire libc to be statically linked in, and file sizes are much smaller. For example, unstripped release hello world on x86_64 went from 1.8M to 640K.

@tshepang
Copy link
Contributor

tshepang commented Oct 26, 2021

Using latest (main) of mustang and rsix, here's what I get when running ripgrep:

...
     Running `target/x86_64-mustang-linux-gnu/debug/rg foo`
thread '<unnamed>' panicked at 'assertion failed: page_size != 0', /home/tshepang/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/thread.rs:465:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'attempt to create unaligned or null slice', /home/tshepang/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/slice/raw.rs:89:5
stack backtrace:
thread panicked while processing panic. aborting.

@sunfishcode
Copy link
Owner Author

@tshepang Ooh, good idea trying ripgrip :-). It looks like one thing ripgrep needs is sched_getaffinity, which should help tokio too. I've now filed #56 to track that.

@sunfishcode
Copy link
Owner Author

sunfishcode commented Nov 10, 2021

Thanks to @nivkner implementing sched_getaffinity, ripgrip kind of runs now!

When ripgrep runs on a single file, instead of on a directory, it uses mmap via the memmap2 crate, which calls libc::fstat, which isn't implemented yet (#71).

When ripgrip runs on directories, it appears to run successfully, but it also prints out several messages about unimplemented pthread_cond* functions:

unimplemented: pthread_condattr_init
unimplemented: pthread_condattr_setclock
unimplemented: pthread_cond_init
unimplemented: pthread_condattr_destroy
unimplemented: pthread_cond_broadcast
unimplemented: pthread_cond_destroy

This is #40.

@antonok-edm
Copy link

I tried running bat with mustang. Following the README, I installed rust-src, set RUST_TARGET_PATH, added mustang = "0.3.0" to bat's dependencies, added mustang::can_run_this!(); to src/bin/bat/main.rs, and built with cargo build --release -Z build-std --target=x86_64-mustang-linux-gnu.

indexmap appears multiple times in bat's dependency tree, and has #[cfg(has_std)] attributes that don't work correctly with mustang. This issue has more info on how it works. I was able to fix it by adding this to [dependencies]:

indexmap = { version = "*", features = ["std"] }

I also ran into an an unrelated regression on Nightly which was easy enough to work around.

After the above modifications, it successfully passed the compilation step, but failed during linking. The traceback is ~1200 lines long; I'm happy to post it if it's helpful, but it looks generally like this:

error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-nostartfiles" "-Wl,--undefined=_Unwind_Backtrace" <...extremely long list of .o files, -L, .rlib files, etc.>
  = note: /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/debug/deps/liblibgit2_sys-e0d42202f97337e4.rlib(attr.o): in function `git_attr_get_many_with_session':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.12.21+1.1.0/libgit2/src/attr.c:183: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/debug/deps/liblibgit2_sys-e0d42202f97337e4.rlib(attr.o): in function `preload_attr_file':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/libgit2-sys-0.12.21+1.1.0/libgit2/src/attr.c:274: undefined reference to `__stack_chk_fail'
          <...many more undefined references to __stack_chk_fail, strcmp, strcasecmp, strrchr, strncmp, vsnprintf, etc.>
          collect2: error: ld returned 1 exit status

  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

It seems like I must have configured something incorrectly, but I can't tell from the README.

@sunfishcode
Copy link
Owner Author

Cool, thanks for trying bat, that's a fun idea! It looks like you've configured everything correctly; the errors you're seeing there are bugs in mustang.

Specifically, mustang so far has focused on running Rust code, and bat uses libgit2 written in C. Mustang's libc support so far only covers things used by Rust, so it doesn't yet have all the things that are common to use in C programs. #69 is a PR to add a note about this to the README.md.

A possible workaround might be to disable the git feature when building bat. I don't know if there is other C code in bat's dependency tree though.

@antonok-edm
Copy link

antonok-edm commented Nov 30, 2021

Neat! That makes sense, I see liblibgit2 in the errors above now. Disabling the git feature helped, then it turns out regex-onig uses C code so I had to swap it out for the pure-Rust regex-fancy feature instead.

That narrowed the errors down to just this one:

  = note: /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/debug/deps/libstd-e475f264d98f5821.rlib(std-e475f264d98f5821.std.a79cc641-cgu.2.rcgu.o): in function `std::sys::unix::os::glibc_version':
          /home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/os.rs:644: undefined reference to `gnu_get_libc_version'

That's in the standard library, so I went ahead and manually modified that sys/unix/os.rs in my toolchain directory:

 #[cfg(all(target_os = "linux", target_env = "gnu"))]
 pub fn glibc_version() -> Option<(usize, usize)> {
+    None
-    extern "C" {
-        fn gnu_get_libc_version() -> *const libc::c_char;
-    }
-    let version_cstr = unsafe { CStr::from_ptr(gnu_get_libc_version()) };
-    if let Ok(version_str) = version_cstr.to_str() {
-        parse_glibc_version(version_str)
-    } else {
-        None
-    }
}

After a clean rebuild, it successfully compiled!

It panics when running, which I guess is the point of this issue 😄

RUST_BACKTRACE=1 cargo run -Z build-std --target=x86_64-mustang-linux-gnu -- LICENSE-APACHE
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/x86_64-mustang-linux-gnu/debug/bat LICENSE-APACHE`
thread 'main' panicked at 'unrecognized ioctl(21523)', /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/c-scape-0.3.0/src/lib.rs:1512:14
stack backtrace:
   0: rust_begin_unwind
             at /home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/panicking.rs:498:5
   1: core::panicking::panic_fmt
             at /home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/panicking.rs:107:14
   2: ioctl
             at /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/c-scape-0.3.0/src/lib.rs:1512:14
   3: terminal_size::unix::terminal_size_using_fd
             at /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/terminal_size-0.1.16/src/unix.rs:31:17
   4: console::unix_term::terminal_size
             at /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/console-0.15.0/src/unix_term.rs:47:5
   5: console::term::Term::size_checked
             at /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/console-0.15.0/src/term.rs:392:9
   6: console::term::Term::size
             at /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/console-0.15.0/src/term.rs:384:9
   7: bat::app::App::config
             at ./src/bin/bat/app.rs:182:52
   8: bat::run
             at ./src/bin/bat/main.rs:303:26
   9: bat::main
             at ./src/bin/bat/main.rs:337:18
  10: core::ops::function::FnOnce::call_once
             at /home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

So that's coming from https://github.com/eminence/terminal-size/blob/master/src/unix.rs#L31:

ioctl(fd, TIOCGWINSZ.into(), &mut winsize)

On the other hand, if I prevent that code from getting run with a small patch:

diff --git a/src/bin/bat/app.rs b/src/bin/bat/app.rs
index 842eec6..b60276f 100644
--- a/src/bin/bat/app.rs
+++ b/src/bin/bat/app.rs
@@ -179,7 +179,7 @@ impl App {
                     _ => unreachable!("other values for --color are not allowed"),
                 },
             paging_mode,
-            term_width: maybe_term_width.unwrap_or(Term::stdout().size().1 as usize),
+            term_width: maybe_term_width.unwrap_or_else(|| Term::stdout().size().1 as usize),
             loop_through: !(self.interactive_output
                 || self.matches.value_of("color") == Some("always")
                 || self.matches.value_of("decorations") == Some("always")

...and pass the --terminal-width argument manually on the command line, I can actually view all sorts of files with correct syntax highlighting and paging interactions!

It's very slow though, and I still can't get it to link in Release mode. I get ~250 lines of undefined reference errors, which appear to all be originating from c-scape. Some random examples, happy to post a full log if that's helpful as well:

  = note: /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-2f6985a442db2685.rlib(c_scape-2f6985a442db2685.c_scape.e6de75ef-cgu.0.rcgu.o): in function `<&T as core::fmt::Debug>::fmt':
          c_scape.e6de75ef-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h184ef3cd73ec6070E+0xf): undefined reference to `core::fmt::Formatter::debug_lower_hex'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h184ef3cd73ec6070E+0x26): undefined reference to `core::fmt::num::<impl core::fmt::LowerHex for usize>::fmt'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h184ef3cd73ec6070E+0x2f): undefined reference to `core::fmt::Formatter::debug_upper_hex'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h184ef3cd73ec6070E+0x46): undefined reference to `core::fmt::num::<impl core::fmt::UpperHex for usize>::fmt'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h184ef3cd73ec6070E+0x4f): undefined reference to `core::fmt::num::imp::<impl core::fmt::Display for usize>::fmt'
          ...
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17hbd196bcaed0b3fbcE+0xca): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-2f6985a442db2685.rlib(c_scape-2f6985a442db2685.c_scape.e6de75ef-cgu.0.rcgu.o): in function `origin::program::exit_immediately':
          c_scape.e6de75ef-cgu.0:(.text._ZN6origin7program16exit_immediately17h8677a8b25e83e50cE+0xa): undefined reference to `log::MAX_LOG_LEVEL_FILTER'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text._ZN6origin7program16exit_immediately17h8677a8b25e83e50cE+0x5a): undefined reference to `log::__private_api_log'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-2f6985a442db2685.rlib(c_scape-2f6985a442db2685.c_scape.e6de75ef-cgu.0.rcgu.o): in function `__xpg_strerror_r':
          c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x19): undefined reference to `rustix::imp::linux_raw::io::error::Error::from_errno'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x4df): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x556): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x5f5): undefined reference to `core::fmt::num::imp::<impl core::fmt::Display for i32>::fmt'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x63b): undefined reference to `alloc::fmt::format'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x66f): undefined reference to `core::slice::<impl [T]>::copy_from_slice::len_mismatch_fail'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x683): undefined reference to `core::panicking::panic_bounds_check'
          /usr/bin/ld: c_scape.e6de75ef-cgu.0:(.text.__xpg_strerror_r+0x693): undefined reference to `alloc::alloc::handle_alloc_error'
          ...

@sunfishcode
Copy link
Owner Author

Cool! #68 adds gnu_get_libc_version and #70 adds the TIOCGWINSZ ioctl.

I don't know what's going on with those release mode link errors yet though. Could you post the full log? You can use <details> and </details> tags to hide the log behind a click in a github comment. Also, would you be able to try running mustang's hello example in --release mode?

@antonok-edm
Copy link

Those two PRs work great! I was able to remove the workarounds for them.

Full log from bat in release mode:
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "-nostartfiles" "-Wl,--undefined=_Unwind_Backtrace" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/bat-ec8e91af3f6a95ff.bat.f3711392-cgu.0.rcgu.o" "-Wl,--as-needed" "-L" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/deps" "-L" "/tmp/bat/target/release/deps" "-L" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/build/ansi_colours-86c9cbf794f4a08c/out" "-L" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/build/sys-info-edf9d90becd4c67b/out" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.config/cargo/git/checkouts/mustang-602e93abf7520381/1cf3702/mustang/empty/x86_64" "-L" "/home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-mustang-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/rustcQBFN4e/libmustang-9647933cd048a944.rlib" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib" "/tmp/rustcQBFN4e/libsys_info-1cdbc8a9cf094753.rlib" "/tmp/rustcQBFN4e/libansi_colours-e2941a831c6a06c0.rlib" "-Wl,--start-group" "-Wl,--end-group" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libcompiler_builtins-5ef97cc642839815.rlib" "-Wl,-Bdynamic" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/home/antonok/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-mustang-linux-gnu/lib" "-o" "/tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/bat-ec8e91af3f6a95ff" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `<&T as core::fmt::Debug>::fmt':
          c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h1a443e9d9e31f818E+0xf): undefined reference to `core::fmt::Formatter::debug_lower_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h1a443e9d9e31f818E+0x26): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h1a443e9d9e31f818E+0x2f): undefined reference to `core::fmt::Formatter::debug_upper_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h1a443e9d9e31f818E+0x46): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h1a443e9d9e31f818E+0x4f): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `<&T as core::fmt::Debug>::fmt':
          c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h219aa351b5c63e90E+0xf): undefined reference to `core::fmt::Formatter::debug_lower_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h219aa351b5c63e90E+0x26): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h219aa351b5c63e90E+0x2f): undefined reference to `core::fmt::Formatter::debug_upper_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h219aa351b5c63e90E+0x46): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN42_$LT$$RF$T$u20$as$u20$core..fmt..Debug$GT$3fmt17h219aa351b5c63e90E+0x4f): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::fmt::num::::fmt':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3fmt3num50_$LT$impl$u20$core..fmt..Debug$u20$for$u20$i64$GT$3fmt17h353cf0d4376ab5b3E+0xf): undefined reference to `core::fmt::Formatter::debug_lower_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN4core3fmt3num50_$LT$impl$u20$core..fmt..Debug$u20$for$u20$i64$GT$3fmt17h353cf0d4376ab5b3E+0x26): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN4core3fmt3num50_$LT$impl$u20$core..fmt..Debug$u20$for$u20$i64$GT$3fmt17h353cf0d4376ab5b3E+0x2f): undefined reference to `core::fmt::Formatter::debug_upper_hex'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN4core3fmt3num50_$LT$impl$u20$core..fmt..Debug$u20$for$u20$i64$GT$3fmt17h353cf0d4376ab5b3E+0x46): undefined reference to `core::fmt::num::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN4core3fmt3num50_$LT$impl$u20$core..fmt..Debug$u20$for$u20$i64$GT$3fmt17h353cf0d4376ab5b3E+0x4f): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr39drop_in_place$LT$std..path..PathBuf$GT$17h6e8e105559fed4c0E+0x18): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr42drop_in_place$LT$alloc..string..String$GT$17h181be0a18533c207E+0x18): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr42drop_in_place$LT$core..ffi..VaListImpl$GT$17h5d1b38e5d25d9ccaE+0x2): undefined reference to `::drop'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr45drop_in_place$LT$std..ffi..c_str..CString$GT$17h2c2542beed811823E+0x19): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place>':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr46drop_in_place$LT$alloc..vec..Vec$LT$u8$GT$$GT$17h8aa4b43e5931e992E+0x18): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr62drop_in_place$LT$rustix..imp..linux_raw..fs..dir..DirEntry$GT$17h872639da79e9d8d3E+0x1b): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place>':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr68drop_in_place$LT$alloc..borrow..Cow$LT$std..ffi..c_str..CStr$GT$$GT$17hed8706970577ba7dE+0x21): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::ptr::drop_in_place>':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr69drop_in_place$LT$alloc..vec..Vec$LT$$RF$std..ffi..c_str..CStr$GT$$GT$17h7fc93c40775febc4E+0x1e): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o):c_scape.77e7b1bb-cgu.0:(.text._ZN4core3ptr91drop_in_place$LT$alloc..vec..Vec$LT$alloc..borrow..Cow$LT$std..ffi..c_str..CStr$GT$$GT$$GT$17h56257609118788cfE+0x25): more undefined references to `__rust_dealloc' follow
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::iter::traits::iterator::Iterator::collect':
          c_scape.77e7b1bb-cgu.0:(.text._ZN4core4iter6traits8iterator8Iterator7collect17hb1c4adfe983e4e74E+0x33): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN4core4iter6traits8iterator8Iterator7collect17hb1c4adfe983e4e74E+0x146): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::panicking::assert_failed':
          c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN4core9panicking13assert_failed17h5a4e33f9d95cfe1dE+0x49): undefined reference to `core::panicking::assert_failed_inner'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `core::panicking::assert_failed':
          c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN4core9panicking13assert_failed17hd78d1757a85ee1faE+0x49): undefined reference to `core::panicking::assert_failed_inner'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `alloc::raw_vec::finish_grow':
          c_scape.77e7b1bb-cgu.0:(.text._ZN5alloc7raw_vec11finish_grow17h3fe6418fcfbc6480E+0x2c): undefined reference to `__rust_realloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN5alloc7raw_vec11finish_grow17h3fe6418fcfbc6480E+0x50): undefined reference to `__rust_alloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `alloc::raw_vec::RawVec::reserve::do_reserve_and_handle':
          c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h256209b50c6fc8b8E+0xaf): undefined reference to `alloc::raw_vec::capacity_overflow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h256209b50c6fc8b8E+0xbc): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `alloc::raw_vec::RawVec::reserve::do_reserve_and_handle':
          c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h58c0cd5be1a66009E+0x84): undefined reference to `alloc::raw_vec::capacity_overflow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h58c0cd5be1a66009E+0x91): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `alloc::raw_vec::RawVec::reserve::do_reserve_and_handle':
          c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h8c996eb38519f8d7E+0xbd): undefined reference to `alloc::raw_vec::capacity_overflow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.unlikely._ZN5alloc7raw_vec19RawVec$LT$T$C$A$GT$7reserve21do_reserve_and_handle17h8c996eb38519f8d7E+0xca): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `origin::program::exit_immediately':
          c_scape.77e7b1bb-cgu.0:(.text._ZN6origin7program16exit_immediately17h0ecd7018bc817c7eE+0xa): undefined reference to `log::MAX_LOG_LEVEL_FILTER'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN6origin7program16exit_immediately17h0ecd7018bc817c7eE+0x5a): undefined reference to `log::__private_api_log'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `__xpg_strerror_r':
          c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x19): undefined reference to `rustix::imp::linux_raw::io::error::Error::from_errno'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x4df): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x556): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x5f5): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x63b): undefined reference to `alloc::fmt::format'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x66f): undefined reference to `core::slice::::copy_from_slice::len_mismatch_fail'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x683): undefined reference to `core::panicking::panic_bounds_check'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__xpg_strerror_r+0x693): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `open64':
          c_scape.77e7b1bb-cgu.0:(.text.open64+0x3d): undefined reference to `rustix::imp::linux_raw::conv::oflags_bits'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.open64+0xa4): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `open':
          c_scape.77e7b1bb-cgu.0:(.text.open+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.open+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `readlink':
          c_scape.77e7b1bb-cgu.0:(.text.readlink+0x57): undefined reference to `rustix::fs::at::_readlinkat'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.readlink+0xce): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.readlink+0xf2): undefined reference to `core::slice::::copy_from_slice::len_mismatch_fail'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `statx':
          c_scape.77e7b1bb-cgu.0:(.text.statx+0x204): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `realpath':
          c_scape.77e7b1bb-cgu.0:(.text.realpath+0x3f): undefined reference to `realpath_ext::util::zeroed_vec'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x5e): undefined reference to `realpath_ext::realpath_raw'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x82): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0xdb): undefined reference to `::from_vec'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x132): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x19e): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x1c1): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.realpath+0x225): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `fcntl':
          c_scape.77e7b1bb-cgu.0:(.text.fcntl+0x1a4): undefined reference to `::drop'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.fcntl+0x1c4): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.fcntl+0x20c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.fcntl+0x227): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `mkdir':
          c_scape.77e7b1bb-cgu.0:(.text.mkdir+0x76): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `lseek64':
          c_scape.77e7b1bb-cgu.0:(.text.lseek64+0x6c): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.lseek64+0xb4): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `opendir':
          c_scape.77e7b1bb-cgu.0:(.text.opendir+0x20): undefined reference to `rustix::imp::linux_raw::conv::oflags_bits'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.opendir+0x51): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.opendir+0x98): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `readdir64_r':
          c_scape.77e7b1bb-cgu.0:(.text.readdir64_r+0x21): undefined reference to `rustix::imp::linux_raw::fs::dir::Dir::read'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.readdir64_r+0x1fd): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.readdir64_r+0x236): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.readdir64_r+0x24b): undefined reference to `core::slice::::copy_from_slice::len_mismatch_fail'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `closedir':
          c_scape.77e7b1bb-cgu.0:(.text.closedir+0x26): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.closedir+0x39): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `readv':
          c_scape.77e7b1bb-cgu.0:(.text.readv+0xc): undefined reference to `rustix::imp::linux_raw::syscalls::readv'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `poll':
          c_scape.77e7b1bb-cgu.0:(.text.poll+0x67): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `ioctl':
          c_scape.77e7b1bb-cgu.0:(.text.ioctl+0x38c): undefined reference to `::drop'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.ioctl+0x3ab): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.ioctl+0x3f3): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pipe2':
          c_scape.77e7b1bb-cgu.0:(.text.pipe2+0x83): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `free':
          c_scape.77e7b1bb-cgu.0:(.text.free+0x59): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `memchr':
          c_scape.77e7b1bb-cgu.0:(.text.memchr+0xc): undefined reference to `memchr::memchr::x86::memchr::FN'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `memrchr':
          c_scape.77e7b1bb-cgu.0:(.text.memrchr+0xc): undefined reference to `memchr::memchr::x86::memrchr::FN'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `mmap':
          c_scape.77e7b1bb-cgu.0:(.text.mmap+0xb3): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `mremap':
          c_scape.77e7b1bb-cgu.0:(.text.mremap+0x128): undefined reference to `::drop'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.mremap+0x150): undefined reference to `core::panicking::panic'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.mremap+0x16b): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `mprotect':
          c_scape.77e7b1bb-cgu.0:(.text.mprotect+0x4e): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `getrandom':
          c_scape.77e7b1bb-cgu.0:(.text.getrandom+0x5b): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `sysconf':
          c_scape.77e7b1bb-cgu.0:(.text.sysconf+0x3d): undefined reference to `rustix::imp::linux_raw::process::auxv::AUXV'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.sysconf+0x60): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.sysconf+0xa8): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `getcwd':
          c_scape.77e7b1bb-cgu.0:(.text.getcwd+0x31): undefined reference to `rustix::process::chdir::_getcwd'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.getcwd+0xc5): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `dl_iterate_phdr':
          c_scape.77e7b1bb-cgu.0:(.text.dl_iterate_phdr+0xa): undefined reference to `rustix::imp::linux_raw::process::auxv::AUXV'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.dl_iterate_phdr+0x7b): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.dl_iterate_phdr+0x96): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `__tls_get_addr':
          c_scape.77e7b1bb-cgu.0:(.text.__tls_get_addr+0x21): undefined reference to `origin::threads::STARTUP_TLS_INFO'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `setgid':
          c_scape.77e7b1bb-cgu.0:(.text.setgid+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.setgid+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `setgroups':
          c_scape.77e7b1bb-cgu.0:(.text.setgroups+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.setgroups+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `setuid':
          c_scape.77e7b1bb-cgu.0:(.text.setuid+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.setuid+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `getpwuid_r':
          c_scape.77e7b1bb-cgu.0:(.text.getpwuid_r+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.getpwuid_r+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `abort':
          c_scape.77e7b1bb-cgu.0:(.text.abort+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.abort+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `syscall':
          c_scape.77e7b1bb-cgu.0:(.text.syscall+0x461): undefined reference to `::drop'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x4c8): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x522): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x540): undefined reference to `core::panicking::panic'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x556): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x59d): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.syscall+0x5f7): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `posix_spawnp':
          c_scape.77e7b1bb-cgu.0:(.text.posix_spawnp+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.posix_spawnp+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `posix_spawnattr_setflags':
          c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setflags+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setflags+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `posix_spawnattr_setsigdefault':
          c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setsigdefault+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setsigdefault+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `posix_spawnattr_setsigmask':
          c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setsigmask+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.posix_spawnattr_setsigmask+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `posix_spawn_file_actions_adddup2':
          c_scape.77e7b1bb-cgu.0:(.text.posix_spawn_file_actions_adddup2+0x44): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.posix_spawn_file_actions_adddup2+0x8c): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `clock_gettime':
          c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0x1c): undefined reference to `rustix::imp::linux_raw::vdso_wrappers::CLOCK_GETTIME'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0x2a): undefined reference to `rustix::imp::linux_raw::vdso_wrappers::init_clock_gettime'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0x40): undefined reference to `rustix::imp::linux_raw::vdso_wrappers::CLOCK_GETTIME'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0x4e): undefined reference to `rustix::imp::linux_raw::vdso_wrappers::init_clock_gettime'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0xb4): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.clock_gettime+0xfc): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `c_scape::null_terminated_array':
          c_scape.77e7b1bb-cgu.0:(.text._ZN7c_scape21null_terminated_array17h936ca5d9dcb302c6E+0x61): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN7c_scape21null_terminated_array17h936ca5d9dcb302c6E+0x116): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text._ZN7c_scape21null_terminated_array17h936ca5d9dcb302c6E+0x11e): undefined reference to `alloc::raw_vec::capacity_overflow'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `execvp':
          c_scape.77e7b1bb-cgu.0:(.text.execvp+0xce): undefined reference to `core::slice::memchr::memchr_general_case'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x21b): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x31a): undefined reference to `std::ffi::c_str::CString::_new'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x348): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x389): undefined reference to `rustix::imp::linux_raw::fs::syscalls::accessat'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x3ac): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x49f): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x55e): undefined reference to `rustix::runtime::_execve'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x58a): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x5a4): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x607): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x638): undefined reference to `__rust_dealloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.execvp+0x665): undefined reference to `__rust_dealloc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o):c_scape.77e7b1bb-cgu.0:(.text.execvp+0x680): more undefined references to `__rust_dealloc' follow
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `execvp':
          c_scape.77e7b1bb-cgu.0:(.text.execvp+0x789): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `fork':
          c_scape.77e7b1bb-cgu.0:(.text.fork+0x3): undefined reference to `origin::program::fork'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `waitpid':
          c_scape.77e7b1bb-cgu.0:(.text.waitpid+0x166): undefined reference to `core::panicking::panic'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `floor':
          c_scape.77e7b1bb-cgu.0:(.text.floor+0x2): undefined reference to `libm::math::floor::floor'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `ldexp':
          c_scape.77e7b1bb-cgu.0:(.text.ldexp+0x2): undefined reference to `libm::math::ldexp::ldexp'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `trunc':
          c_scape.77e7b1bb-cgu.0:(.text.trunc+0x2): undefined reference to `libm::math::trunc::trunc'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_mutex_destroy':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_destroy+0x65): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_destroy+0xbc): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_destroy+0x103): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_destroy+0x14e): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_mutex_init':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_init+0x86): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_init+0xdd): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_init+0x124): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_init+0x16f): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_mutex_lock':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x70): undefined reference to `parking_lot::raw_mutex::RawMutex::lock_slow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0xae): undefined reference to `parking_lot::raw_mutex::RawMutex::lock_slow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0xfd): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x164): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x17b): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x1c2): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x20d): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_lock+0x228): undefined reference to `core::option::expect_failed'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_mutex_trylock':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0xec): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0x153): undefined reference to `core::result::unwrap_failed'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0x16a): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0x1b1): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0x1fc): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_trylock+0x217): undefined reference to `core::option::expect_failed'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_mutex_unlock':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_unlock+0x4f): undefined reference to `parking_lot::raw_mutex::RawMutex::unlock_slow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_unlock+0xa6): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_unlock+0xfd): undefined reference to `core::fmt::num::imp::::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_unlock+0x144): undefined reference to `::fmt'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_mutex_unlock+0x18f): undefined reference to `core::panicking::panic_fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_rwlock_rdlock':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_rwlock_rdlock+0x41): undefined reference to `parking_lot::raw_rwlock::RawRwLock::lock_shared_slow'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `pthread_rwlock_unlock':
          c_scape.77e7b1bb-cgu.0:(.text.pthread_rwlock_unlock+0x32): undefined reference to `parking_lot::raw_rwlock::RawRwLock::unlock_shared_slow'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.pthread_rwlock_unlock+0x3e): undefined reference to `parking_lot::raw_rwlock::RawRwLock::unlock_exclusive_slow'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `__cxa_thread_atexit_impl':
          c_scape.77e7b1bb-cgu.0:(.text.__cxa_thread_atexit_impl+0x16): undefined reference to `__rust_alloc'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__cxa_thread_atexit_impl+0x32): undefined reference to `origin::threads::at_thread_exit'
          /usr/bin/ld: c_scape.77e7b1bb-cgu.0:(.text.__cxa_thread_atexit_impl+0x4c): undefined reference to `alloc::alloc::handle_alloc_error'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o): in function `exit':
          c_scape.77e7b1bb-cgu.0:(.text.exit+0x3): undefined reference to `origin::program::exit'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o):(.data.rel.ro..Lanon.ff71a27d96c0edfd7325dd87b4ef374e.9+0x18): undefined reference to `::fmt'
          /usr/bin/ld: /tmp/bat/target/x86_64-mustang-linux-gnu/release/deps/libc_scape-258bf832e1d66db5.rlib(c_scape-258bf832e1d66db5.c_scape.77e7b1bb-cgu.0.rcgu.o):(.data.rel.ro..Lanon.ff71a27d96c0edfd7325dd87b4ef374e.11+0x18): undefined reference to `::fmt'
          collect2: error: ld returned 1 exit status

= help: some extern functions couldn't be found; some native libraries may need to be installed or have their path specified
= note: use the -l flag to specify native libraries to link
= note: use the cargo:rustc-link-lib directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile bat due to previous error

The hello example works fine in debug and release mode.

@sunfishcode
Copy link
Owner Author

Could you try commenting out the lto = true in bat's Cargo.toml? It looks like mustang may not work with lto yet.

@antonok-edm
Copy link

That did the trick!

@antonok-edm
Copy link

I also tried cargo-watch. It doesn't appear to need any extra modification for debug mode beyond adding the mustang dependency and can_run_this! macro, but there are some undefined references during linking.

Linker errors:

  = note: /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libpolling-31a2aec96d0b6c5b.rlib(polling-31a2aec96d0b6c5b.polling.a8c404e5-cgu.0.rcgu.o): in function `polling::epoll::Poller::new::{{closure}}':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/polling-2.2.0/src/epoll.rs:38: undefined reference to `epoll_create'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libcommand_group-63ab48226defceab.rlib(command_group-63ab48226defceab.command_group.9645ae60-cgu.12.rcgu.o): in function `nix::unistd::setsid':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.22.0/src/unistd.rs:290: undefined reference to `setsid'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libcommand_group-63ab48226defceab.rlib(command_group-63ab48226defceab.command_group.9645ae60-cgu.14.rcgu.o): in function `nix::sys::signal::killpg':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.22.0/src/sys/signal.rs:775: undefined reference to `killpg'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libnix-31eb011f1835f430.rlib(nix-31eb011f1835f430.nix.d2ab827a-cgu.8.rcgu.o): in function `nix::sys::signal::SigSet::wait':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.22.0/src/sys/signal.rs:491: undefined reference to `sigwait'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libnotify-3436058ff2beca65.rlib(notify-3436058ff2beca65.notify.c722c544-cgu.9.rcgu.o): in function `inotify::inotify::Inotify::add_watch':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/inotify-0.7.1/src/inotify.rs:194: undefined reference to `inotify_add_watch'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libinotify-894edffb26bc103f.rlib(inotify-894edffb26bc103f.inotify.946dde7f-cgu.3.rcgu.o): in function `inotify::inotify::Inotify::init':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/inotify-0.7.1/src/inotify.rs:104: undefined reference to `inotify_init'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libinotify-894edffb26bc103f.rlib(inotify-894edffb26bc103f.inotify.946dde7f-cgu.3.rcgu.o): in function `inotify::inotify::Inotify::rm_watch':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/inotify-0.7.1/src/inotify.rs:266: undefined reference to `inotify_rm_watch'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libmio-972309a7a773b3bb.rlib(mio-972309a7a773b3bb.mio.354b742d-cgu.5.rcgu.o): in function `mio::sys::unix::epoll::Selector::new':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.23/src/sys/unix/epoll.rs:43: undefined reference to `epoll_create'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libmio-972309a7a773b3bb.rlib(mio-972309a7a773b3bb.mio.354b742d-cgu.7.rcgu.o): in function `mio::sys::unix::pipe':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/mio-0.6.23/src/sys/unix/mod.rs:71: undefined reference to `pipe'
          /usr/bin/ld: /tmp/cargo-watch/target/x86_64-mustang-linux-gnu/debug/deps/libchrono-902c570d135cc492.rlib(chrono-902c570d135cc492.chrono.6d6b6782-cgu.8.rcgu.o): in function `chrono::sys::inner::time_to_local_tm':
          /home/antonok/.config/cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/sys/unix.rs:84: undefined reference to `localtime_r'
          collect2: error: ld returned 1 exit status

Compiling in release mode fails with error[E0463]: can't find crate for panic_abort. This appears to be related to the release profile settings in Cargo.toml:

[profile.release]
lto = true
panic = "abort"
codegen-units = 1

Seems like panic = "abort" is also not supported somehow.

@sunfishcode
Copy link
Owner Author

@antonok-edm Thanks for the report! I've now filed several mustang bugs for the various undefined symbols there: #85, #86, #87, and #88.

lto = true is known to not work yet; would you be able to try it with that line commented out? panic = "abort" works for me in simple cases, so it's possible the problem you're seeing there is actually coming from the lto issue.

The one symbol I didn't file a bug about yet is localtime_r from within chrono. We have plenty of other work to do before this is the thing that blocks cargo-watch, on one hand. And on the other, because of this issue, it's possible that there will be ecosystem changes in this space, so we'll see what happens there.

@antonok-edm
Copy link

@sunfishcode I can't get panic = "abort" to work even in simple cases, either. For example I get the same error on my machine with this setup:

Cargo.toml

[package]
name = "testing"
version = "0.1.0"
edition = "2021"

[dependencies]
mustang = { path = "/path/to/latest/mustang" }

[profile.dev]
panic = "abort"

src/main.rs

mustang::can_run_this!();
fn main() {}
cargo run -Z build-std --target=x86_64-mustang-linux-gnu

@sunfishcode
Copy link
Owner Author

Ah, thanks. It looks like the panic_abort issue might be an issue in -Zbuild-std.

@eHammarstrom
Copy link

eHammarstrom commented Jan 5, 2022

Tried compiling one of my own apps with mustang and failed to link splice@@GLIBC_2.5, but that seems to be about it for now =)

  = note: /usr/bin/ld: /home/estrom/coalmine/auto-display/target/x86_64-mustang-linux-gnu/debug/deps/libstd-208577500796eba1.rlib(std-208577500796eba1.std.2946fd32-cgu.8.rcgu.o): undefined reference to symbol 'splice@@GLIBC_2.5'
          /usr/bin/ld: /lib/x86_64-linux-gnu/libc.so.6: error adding symbols: DSO missing from command line
          collect2: error: ld returned 1 exit status

edit: I am unsure why I am getting the missing DSO error since I have a build.rs file linking to some libs, it's as if the build.rs is not executed when running RUST_LOG=trace cargo +nightly run -Z build-std --target=../mustang/specs/x86_64-mustang-linux-gnu.json

@sunfishcode
Copy link
Owner Author

I haven't seen DSO errors like that yet, so I don't have any guesses there. Would you be able to provide a link to the source code?

Also, I filed #91 to track splice. Thanks for trying Mustang!

@eHammarstrom
Copy link

Sure, here you go.

Thanks for working towards a libc-free Rust option =)

@sunfishcode sunfishcode pinned this issue Jan 24, 2022
@Gaelan
Copy link

Gaelan commented Feb 23, 2022

Just tried uutils/coreutils (which, compiled with Mustang, would go a long way to a pure-Rust Linux userspace). Failed with a bunch of linker errors:

Full linker output
  = note: /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_date-7e8774767c77ce2e.rlib(uu_date-7e8774767c77ce2e.bilzgeeg2726m8c.rcgu.o): in function `uu_date::set_system_datetime':
          /home/arch/coreutils/src/uu/date/src/date.rs:388: undefined reference to `clock_settime'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_test-131b81c88d300307.rlib(uu_test-131b81c88d300307.15b4g6ud14u6ag85.rcgu.o): in function `uu_test::path::{{closure}}':
          /home/arch/coreutils/src/uu/test/src/test.rs:308: undefined reference to `geteuid'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_test-131b81c88d300307.rlib(uu_test-131b81c88d300307.15b4g6ud14u6ag85.rcgu.o): in function `uu_test::path::{{closure}}':
          /home/arch/coreutils/src/uu/test/src/test.rs:317: undefined reference to `getegid'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_df-af487dc561a0e8ef.rlib(uu_df-af487dc561a0e8ef.1sn6wsjgw9lnip5a.rcgu.o): in function `uu_df::Filesystem::new':
          /home/arch/coreutils/src/uu/df/src/df.rs:147: undefined reference to `statfs'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o): in function `string_cmp_ic':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:2458: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o): in function `backref_match_at_nested_level':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:2595: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o): in function `match_at':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:4433: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o): in function `search_in_range':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:5744: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o): in function `onig_builtin_error':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:6348: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regexec.o):/home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regexec.c:6414: more undefined references to `__stack_chk_fail' follow
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regerror.o): in function `sprint_byte':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regerror.c:209: undefined reference to `snprintf'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regerror.o): in function `sprint_byte_with_x':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regerror.c:214: undefined reference to `snprintf'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regerror.o): in function `onig_error_code_to_str':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regerror.c:348: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regerror.o): in function `onig_snprintf_with_pattern':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regerror.c:361: undefined reference to `vsnprintf'
          /usr/bin/ld: /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regerror.c:412: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regparse.o): in function `onig_st_lookup_strend':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regparse.c:601: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regparse.o): in function `onig_st_lookup_callout_name_table':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regparse.c:697: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regparse.o): in function `name_find':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regparse.c:831: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regparse.o): in function `callout_name_find':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regparse.c:1424: undefined reference to `__stack_chk_fail'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libonig_sys-3fae391231f1fd33.rlib(regparse.o):/home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/onig_sys-69.7.1/oniguruma/src/regparse.c:1724: more undefined references to `__stack_chk_fail' follow
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_cp-e7765213f714af8a.rlib(uu_cp-e7765213f714af8a.ifd3rgonv9fqlg2.rcgu.o): in function `uu_cp::preserve_hardlinks':
          /home/arch/coreutils/src/uu/cp/src/cp.rs:765: undefined reference to `lstat'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuu_cp-e7765213f714af8a.rlib(uu_cp-e7765213f714af8a.16x3thf414piy1gq.rcgu.o): in function `nix::sys::stat::lstat::{{closure}}':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/src/sys/stat.rs:113: undefined reference to `lstat'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libxattr-8ee1af6778cd2cf0.rlib(xattr-8ee1af6778cd2cf0.xattr.adac5fb6-cgu.0.rcgu.o): in function `xattr::sys::linux_macos::get_path::{{closure}}':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/xattr-0.2.2/src/sys/linux_macos/mod.rs:120: undefined reference to `lgetxattr'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libxattr-8ee1af6778cd2cf0.rlib(xattr-8ee1af6778cd2cf0.xattr.adac5fb6-cgu.0.rcgu.o): in function `xattr::sys::linux_macos::list_path::{{closure}}':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/xattr-0.2.2/src/sys/linux_macos/mod.rs:162: undefined reference to `llistxattr'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libxattr-8ee1af6778cd2cf0.rlib(xattr-8ee1af6778cd2cf0.xattr.adac5fb6-cgu.12.rcgu.o): in function `xattr::sys::linux_macos::linux::lsetxattr':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/xattr-0.2.2/src/sys/linux_macos/linux.rs:51: undefined reference to `lsetxattr'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libchrono-ddb5310879217578.rlib(chrono-ddb5310879217578.chrono.cbe7f02e-cgu.10.rcgu.o): in function `chrono::sys::inner::time_to_local_tm':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/sys/unix.rs:84: undefined reference to `localtime_r'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libchrono-ddb5310879217578.rlib(chrono-ddb5310879217578.chrono.cbe7f02e-cgu.10.rcgu.o): in function `chrono::sys::inner::utc_tm_to_time':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/sys/unix.rs:119: undefined reference to `timegm'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libchrono-ddb5310879217578.rlib(chrono-ddb5310879217578.chrono.cbe7f02e-cgu.10.rcgu.o): in function `chrono::sys::inner::local_tm_to_time':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/chrono-0.4.19/src/sys/unix.rs:125: undefined reference to `mktime'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libfiletime-8d5d1190dfcb6365.rlib(filetime-8d5d1190dfcb6365.filetime.c92c8628-cgu.0.rcgu.o): in function `filetime::imp::utimes::set_times':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.15/src/unix/utimes.rs:102: undefined reference to `lutimes'
          /usr/bin/ld: /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/filetime-0.2.15/src/unix/utimes.rs:104: undefined reference to `utimes'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuucore-64f687fcce5938ca.rlib(uucore-64f687fcce5938ca.3gd6fduxq9umd4wk.rcgu.o): in function `<uucore::features::entries::Passwd as uucore::features::entries::Locate<u32>>::locate':
          /home/arch/coreutils/src/uucore/src/lib/features/entries.rs:277: undefined reference to `getpwuid'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuucore-64f687fcce5938ca.rlib(uucore-64f687fcce5938ca.3gd6fduxq9umd4wk.rcgu.o): in function `<uucore::features::entries::Group as uucore::features::entries::Locate<u32>>::locate':
          /home/arch/coreutils/src/uucore/src/lib/features/entries.rs:277: undefined reference to `getgrgid'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libuucore-64f687fcce5938ca.rlib(uucore-64f687fcce5938ca.3s87udrgtxe68yjf.rcgu.o): in function `uucore::features::mode::get_umask':
          /home/arch/coreutils/src/uucore/src/lib/features/mode.rs:153: undefined reference to `umask'
          /usr/bin/ld: /home/arch/coreutils/src/uucore/src/lib/features/mode.rs:154: undefined reference to `umask'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libnix-2e60a8e16ad560ea.rlib(nix-2e60a8e16ad560ea.nix.d207753e-cgu.14.rcgu.o): in function `nix::unistd::pipe':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/src/unistd.rs:1065: undefined reference to `pipe'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libnix-2e60a8e16ad560ea.rlib(nix-2e60a8e16ad560ea.nix.d207753e-cgu.5.rcgu.o): in function `nix::fcntl::splice':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/src/fcntl.rs:569: undefined reference to `splice'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libnix-2e60a8e16ad560ea.rlib(nix-2e60a8e16ad560ea.nix.d207753e-cgu.5.rcgu.o): in function `nix::fcntl::vmsplice':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/nix-0.23.1/src/fcntl.rs:582: undefined reference to `vmsplice'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libtime-a0a4fb340b453f8f.rlib(time-a0a4fb340b453f8f.time.f48245f0-cgu.7.rcgu.o): in function `time::sys::inner::time_to_utc_tm':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/time-0.1.43/src/sys.rs:286: undefined reference to `gmtime_r'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libtime-a0a4fb340b453f8f.rlib(time-a0a4fb340b453f8f.time.f48245f0-cgu.7.rcgu.o): in function `time::sys::inner::time_to_local_tm':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/time-0.1.43/src/sys.rs:297: undefined reference to `localtime_r'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libtime-a0a4fb340b453f8f.rlib(time-a0a4fb340b453f8f.time.f48245f0-cgu.7.rcgu.o): in function `time::sys::inner::utc_tm_to_time':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/time-0.1.43/src/sys.rs:332: undefined reference to `timegm'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libtime-a0a4fb340b453f8f.rlib(time-a0a4fb340b453f8f.time.f48245f0-cgu.7.rcgu.o): in function `time::sys::inner::local_tm_to_time':
          /home/arch/.cargo/registry/src/github.com-1ecc6299db9ec823/time-0.1.43/src/sys.rs:338: undefined reference to `mktime'
          /usr/bin/ld: /home/arch/coreutils/target/x86_64-mustang-linux-gnu/debug/deps/libstd-237e1f59287854f6.rlib(std-237e1f59287854f6.std.2a92cf86-cgu.7.rcgu.o): in function `std::sys::unix::kernel_copy::sendfile_splice':
          /home/arch/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/std/src/sys/unix/kernel_copy.rs:654: undefined reference to `splice'

The missing symbols:

(Also, c-scape currently doesn't compile because of the signature changes in bytecodealliance/rustix@f020311; I've quickly attempted to fix this, although I haven't tested it at all.)

@sunfishcode
Copy link
Owner Author

@eHammarstrom Thanks! I haven't investigated it in detail, but my guess of what's going on is that these lines in auto-display's build.rs:

println!("cargo:rustc-link-lib=X11");
println!("cargo:rustc-link-lib=Xrandr");

transitively pull in libc.so.6, which is then not happy about sharing a process with mustang. As a workaround, would it be possible to try statically linking with the X11 and Xrandr libraries?

@Gaelan Cool, thanks for trying coreutils! Several of those functions are in the "top half" of libc, such as snprintf, getpwuid, mktime, and others, which mustang doesn't have much coverage for yet. It's possible that we could look at using relibc for these; I filed #100 to track that.

@sunfishcode
Copy link
Owner Author

@Gaelan Also, #101 should fix the signature mismatches in c-scape. Sorry for the breakage there!

@sunfishcode
Copy link
Owner Author

@carbotaniuman added fstat in #104, and now ripgrep appears to be fully working under Mustang!

@sunfishcode
Copy link
Owner Author

Epoll, eventfd, sched_getaffinity, and more are all implemented now, including patches from @notgull and @nivkner, and Web servers built on tokio and async-std appear to be fully working on Mustang!

@sunfishcode
Copy link
Owner Author

@Gaelan My coreutils branch at https://github.com/sunfishcode/coreutils/ now passes all the tests in the default feature set under mustang, except test_tmp_files_deleted_on_sigint because that needs a custom signal handler, which isn't supported yet.

@sunfishcode
Copy link
Owner Author

Custom signal handlers are now implemented and coreutils' test_tmp_files_deleted_on_sigint now passes. Also, more functions are now implemented, and everything in coreutils' default and "unix" feature sets now work.

@sunfishcode
Copy link
Owner Author

sunfishcode commented Apr 26, 2023

panic = "abort" now works in mustang. To use it, you need to also change the -Z build-std to -Z build-std=panic_abort,std.

Unless I've missed something, everything reported here so far except lto and auto-display is now working: panic = "abort", bat (including git2 support), ripgrep, coreutils (including the "unix" feature set), cargo-watch, tokio, async-std.

@estk
Copy link

estk commented Jun 7, 2023

I'm interested in building a shared library with mustang.
I'm sure there are many reasons why this would not work currently but just to verify it does not work out of the box i've built my lib with mustang, extracted the archive then re-linked with lld as a -shared lib. This resulted in the following error on load:

libmustang_test.so: undefined symbol: main

It then occurred to me that I had not seen any examples of using mustang to build a library, perhaps there is some fundamental issue there that I'm missing. (Like maybe the lack of a crt means we need to hook into the main function somehow?)

Also, obviously in the readme you've explicitly stated that mustang does not support dynamic linkage. Thats something I'd be interested in helping out with but would need mentoring.

@sunfishcode
Copy link
Owner Author

@estk Unfortunately, this activity is not among my own personal interests at this time, so I won't be able to be of much help. If you'd like though, you're welcome to file new issues in the issue tracker in this repo and describe what you're doing (ideally in as much detail as you can, eg: how are you expecting to load this library, is there another libc in the process, are there any threads anywhere, etc.) and what problems you're finding and ask questions, and perhaps there will be others interested in helping.

@estk
Copy link

estk commented Jun 8, 2023

@sunfishcode thank you so much for the super quick response on this!
Sorry to hear it's not something you'll be spending time on, I would have loved to collab on this. Also, I really appreciate the invitation to file some issues here and explain what we are trying to accomplish.

I've explained our situation a bit in the rust-lang issue but I'll file the relevant issues here and explain the situation in great (hopefully not painful) detail. 😄

Finally just an observation, I find it very surprising that the rustc team has not immediately co-opted this and run with it. (I was similarly surprised with the lukewarm reception of watt) I wonder if you can shed any light on the, from an outsider's perspective, lack of interest.

@lnicola
Copy link

lnicola commented Jun 8, 2023

I guess it's not much, but I was able to run rust-analyzer on mustang, after patching out a mallinfo call and disabling perf_event_open using an environment variable. I had some trouble with the build instructions, though.

It's about 23% slower, though, probably because of the allocator performance. I also tried jemalloc, but requires some unimplemented functions.

@sunfishcode
Copy link
Owner Author

@estk I expect it's just that for most users, Mustang doesn't have any practical advantages. It's less complete and less real-world tested than existing libc implementations.

@sunfishcode
Copy link
Owner Author

@lnicola Very cool! Could you say which unimplemented functions jemalloc needs?

@lnicola
Copy link

lnicola commented Jun 9, 2023

Could you say which unimplemented functions jemalloc needs?

@carbotaniuman
Copy link
Contributor

I can grind some of those out later today once I'm done with work. Not sure about the popcount one though, feels like we'd need another library off that...

@lnicola
Copy link

lnicola commented Jun 9, 2023

It's not very clear to me, but isn't count_ones available in libcore?

I was surprised that sbrk isn't implemented 😄.

@carbotaniuman
Copy link
Contributor

carbotaniuman commented Jun 9, 2023 via email

@sunfishcode
Copy link
Owner Author

All the functions needed for jemalloc here are now implemented, except __popcountdi2. I was able to port jemalloc to Eyra, and all the tests pass.

When I tried Mustang, I saw the undefined references to __popcountdi2. So there appears to be some problem arising from the way Mustang works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

10 participants