Skip to content

Latest commit

 

History

History
67 lines (41 loc) · 2.21 KB

File metadata and controls

67 lines (41 loc) · 2.21 KB

Readme

Build targetting windows platform via rustup / rustc

Statically linked to libc via cargo

This is similar to hello-static-rustup-target-windows but this time, we experiment with a non trivial project that has dependencies (in this case the clap cli parser lib).

Build and run:

$ cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s

$ cargo run 
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `/nix/store/5nz0dnmfn70gjl15srmn8wyqqmhsynpw-wine-wow-6.0/bin/wine64 target/x86_64-pc-windows-gnu/debug/simple-static-rustup-target-windows.exe`
error: The following required arguments were not provided:
    <INPUT>

USAGE:
    simple-static-rustup-target-windows.exe [FLAGS] [OPTIONS] <INPUT> [SUBCOMMAND]

For more information try --help

Note how we weren't force to invoke rustup target add $TARGET_TRIPLE as our nix env shell hook did that for us.

Note how cargo run has configured by our nix env to use wine to run our program.

Validate that we're still free of dynamic dependencies:

$ winedump -j export ./target/x86_64-pc-windows-gnu/debug/simple-static-rustup-target-windows.exe 
Contents of ./target/x86_64-pc-windows-gnu/debug/simple-static-rustup-target-windows.exe: 14574056 bytes

Done dumping ./target/x86_64-pc-windows-gnu/debug/simple-static-rustup-target-windows.exe

References