Forcing .rlib with Cargo

Newbie Question

Hi, I've cross posted this from the Rust Subreddit as well. I am new to Rust overall, so trying to cast a large net to see if what I'm looking for is even possible.

I've recently been trying to get a Rust Program on Github to compile on my local machine, its a Onion Vanity Address generator (for TOR Addresses). I've been able to get pretty far using the documentation that was provided, but it appears that I'm getting stuck at a certain point. I have experience with other languages, but not Rust.

The project is this: https://github.com/dr-bonez/tor-v3-vanity

I've been able to get to this point:

Caused by:
  process didn't exit successfully: `/home/ayka/tor-v3-vanity/target/release/build/tor-v3-vanity-0ee4631e169c1030/build-script-build` (exit status: 1)
  --- stdout
  cargo:rustc-link-search=native=/usr/local/cuda/lib64/

  --- stderr
  [PTX] Unable to build a PTX crate!
  [PTX] warning: unused manifest key: build
  [PTX] warning: unused manifest key: build
  [PTX]    Compiling tor-v3-vanity-core v0.1.0 (/home/ayka/tor-v3-vanity/core)
  [PTX] error: crate `rustacuda_core` required to be available in rlib format, but was not found in this form
  [PTX]
  [PTX] error: crate `byteorder` required to be available in rlib format, but was not found in this form
  [PTX]
  [PTX] error: crate `ed25519_compact` required to be available in rlib format, but was not found in this form
  [PTX]
  [PTX] error: could not compile `tor-v3-vanity-core` due to 3 previous errors
  [PTX]

Now I've been trying and trying to figure out how I can force Cargo to build those three dependencies as a .rlib, but I haven't been able to figure it out. There is mention of a workaround in the build.rs code that comes with the program:

    // Workaround for "crate required to be available in rlib format" bug
    std::env::set_var("CARGO_BUILD_PIPELINING", "false");

but it would appear that workaround no longer actually works.

I've tried also building this w/o the +nightly, but then get a separate error:

  [PTX] Unable to build a PTX crate!
  [PTX] warning: unused manifest key: build
  [PTX] warning: unused manifest key: build
  [PTX]    Compiling tor-v3-vanity-core v0.1.0 (/home/ayka/tor-v3-vanity/core)
  [PTX] error: the option `Z` is only accepted on the nightly compiler
  [PTX]
  [PTX] error: could not compile `tor-v3-vanity-core`
  [PTX]

I was able to find some examples where this was caused by that ``CARGO_BUILD_PIPELINE but I removed that from the build.rs and tried again to the same error. I've tried compiling this now on both Windows Native, as well as Ubuntu on WSL.

Does anyone have any pointers as to how I may resolve this? Is there a way for me to force these three crates to build as .rlibs?

Thank You!

CARGO_BUILD_PIPELINING is no longer read by cargo. It now always enables build pipelining.

The crates should be build as .rlib. Build pipelining just also builds them as .rmeta which is faster and allows compilation of dependent crates to start earlier.

Could you try looking for a .last-build-command file somewhere in target/release/build and then run the command in this file with the PTX_CRATE_BUILDING env var set to 1, the RUSTC_LOG env var set to rustc_metadata and -v as extra argument?

Hi Bjorn!

I've searched both Target Directories (for both the Windows and the Ubuntu-WSL builds, and I cant find a file that has *.last-build-command.

I have however swapped in the two ENV Variables and retried the cargo +nightly -v install --path . and this is the output from the Windows based compiler:

  Installing tor-v3-vanity v0.1.0 (C:\Windows\System32\tor-v3-vanity)
    Updating crates.io index
  Downloaded syn v1.0.89
  Downloaded 1 crate (236.0 KB) in 1.35s
       Fresh autocfg v1.1.0
       Fresh unicode-xid v0.2.2
   Compiling syn v1.0.89
       Fresh cc v1.0.73
       Fresh version_check v0.9.4
     Running `rustc --crate-name build_script_build --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\syn-1.0.89\build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off --cfg "feature=\"clone-impls\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"extra-traits\"" --cfg "feature=\"parsing\"" --cfg "feature=\"printing\"" --cfg "feature=\"proc-macro\"" --cfg "feature=\"quote\"" --cfg "feature=\"visit\"" -C metadata=dd861ce445cbb6cc -C extra-filename=-dd861ce445cbb6cc --out-dir C:\Windows\System32\tor-v3-vanity\target\release\build\syn-dd861ce445cbb6cc -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --cap-lints allow`
       Fresh cfg-if v1.0.0
       Fresh ucd-util v0.1.8
       Fresh block-padding v0.2.1
       Fresh utf8-ranges v1.0.4
       Fresh semver-parser v0.7.0
       Fresh byteorder v1.4.3
       Fresh ppv-lite86 v0.2.16
       Fresh gimli v0.26.1
       Fresh opaque-debug v0.3.0
       Fresh adler v1.0.2
       Fresh rustc-demangle v0.1.21
       Fresh lazy_static v1.4.0
       Fresh signature v1.5.0
       Fresh cpufeatures v0.2.1
       Fresh subtle v2.4.1
       Fresh unicode-width v0.1.9
       Fresh cfg-if v0.1.10
       Fresh keccak v0.1.0
       Fresh rustacuda_core v0.1.2
       Fresh vec_map v0.8.2
       Fresh strsim v0.8.0
       Fresh ed25519-compact v0.1.11
       Fresh bitflags v1.3.2
       Fresh base32 v0.4.0
       Fresh num_cpus v1.13.1
       Fresh getrandom v0.2.5
       Fresh thread_local v0.3.6
       Fresh regex-syntax v0.5.6
       Fresh semver v0.9.0
       Fresh addr2line v0.17.0
       Fresh ed25519 v1.4.0
       Fresh textwrap v0.11.0
       Fresh proc-macro2 v1.0.36
       Fresh typenum v1.15.0
       Fresh getrandom v0.1.16
       Fresh libc v0.2.120
       Fresh winapi v0.3.9
       Fresh memchr v2.4.1
       Fresh serde v1.0.136
       Fresh ed25519-compact v1.0.11
       Fresh quote v1.0.15
       Fresh generic-array v0.14.5
       Fresh aho-corasick v0.6.10
       Fresh miniz_oxide v0.4.4
       Fresh maybe-uninit v2.0.0
       Fresh rand_core v0.5.1
       Fresh toml v0.4.10
       Fresh num-traits v0.2.14
       Fresh crossbeam-utils v0.7.2
       Fresh time v0.1.44
       Fresh atty v0.2.14
       Fresh digest v0.9.0
       Fresh block-buffer v0.9.0
       Fresh colored v1.9.3
       Fresh regex v0.2.11
       Fresh object v0.27.1
       Fresh rand_chacha v0.2.2
       Fresh sha2 v0.9.9
       Fresh num-integer v0.1.44
       Fresh crossbeam-channel v0.4.4
       Fresh sha3 v0.9.1
       Fresh clap v2.34.0
       Fresh backtrace v0.3.64
       Fresh rand v0.7.3
       Fresh chrono v0.4.19
     Running `C:\Windows\System32\tor-v3-vanity\target\release\build\syn-dd861ce445cbb6cc\build-script-build`
     Running `rustc --crate-name syn --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\syn-1.0.89\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg "feature=\"clone-impls\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"extra-traits\"" --cfg "feature=\"parsing\"" --cfg "feature=\"printing\"" --cfg "feature=\"proc-macro\"" --cfg "feature=\"quote\"" --cfg "feature=\"visit\"" -C metadata=2814689d6d4956b6 -C extra-filename=-2814689d6d4956b6 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern proc_macro2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libproc_macro2-ba56a137caeb6f43.rmeta --extern quote=C:\Windows\System32\tor-v3-vanity\target\release\deps\libquote-5fcd2fbbbe33163c.rmeta --extern unicode_xid=C:\Windows\System32\tor-v3-vanity\target\release\deps\libunicode_xid-c5404e573edb1c5f.rmeta --cap-lints allow`
   Compiling synstructure v0.12.6
     Running `rustc --crate-name synstructure --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\synstructure-0.12.6\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg "feature=\"default\"" --cfg "feature=\"proc-macro\"" -C metadata=bec6a1447c6323eb -C extra-filename=-bec6a1447c6323eb --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern proc_macro2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libproc_macro2-ba56a137caeb6f43.rmeta --extern quote=C:\Windows\System32\tor-v3-vanity\target\release\deps\libquote-5fcd2fbbbe33163c.rmeta --extern syn=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsyn-2814689d6d4956b6.rmeta --extern unicode_xid=C:\Windows\System32\tor-v3-vanity\target\release\deps\libunicode_xid-c5404e573edb1c5f.rmeta --cap-lints allow`
   Compiling failure_derive v0.1.8
   Compiling zeroize_derive v1.3.2
   Compiling rustacuda_derive v0.1.2
     Running `rustc --crate-name failure_derive C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\failure_derive-0.1.8\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off -C metadata=8bec413ea318484d -C extra-filename=-8bec413ea318484d --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern proc_macro2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libproc_macro2-ba56a137caeb6f43.rlib --extern quote=C:\Windows\System32\tor-v3-vanity\target\release\deps\libquote-5fcd2fbbbe33163c.rlib --extern syn=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsyn-2814689d6d4956b6.rlib --extern synstructure=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsynstructure-bec6a1447c6323eb.rlib --extern proc_macro --cap-lints allow --cfg has_dyn_trait`
     Running `rustc --crate-name zeroize_derive --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\zeroize_derive-1.3.2\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off -C metadata=46ca0ebb94e412c4 -C extra-filename=-46ca0ebb94e412c4 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern proc_macro2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libproc_macro2-ba56a137caeb6f43.rlib --extern quote=C:\Windows\System32\tor-v3-vanity\target\release\deps\libquote-5fcd2fbbbe33163c.rlib --extern syn=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsyn-2814689d6d4956b6.rlib --extern synstructure=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsynstructure-bec6a1447c6323eb.rlib --extern proc_macro --cap-lints allow`
     Running `rustc --crate-name rustacuda_derive --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\rustacuda_derive-0.1.2\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type proc-macro --emit=dep-info,link -C prefer-dynamic -C embed-bitcode=no -C debug-assertions=off -C metadata=54427de96a8e8f49 -C extra-filename=-54427de96a8e8f49 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern proc_macro2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libproc_macro2-ba56a137caeb6f43.rlib --extern quote=C:\Windows\System32\tor-v3-vanity\target\release\deps\libquote-5fcd2fbbbe33163c.rlib --extern syn=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsyn-2814689d6d4956b6.rlib --extern proc_macro --cap-lints allow`
   Compiling tor-v3-vanity-core v0.1.0 (C:\Windows\System32\tor-v3-vanity\core)
     Running `rustc --crate-name tor_v3_vanity_core --edition=2018 core\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no -C metadata=e0c57114ce3d81fa -C extra-filename=-e0c57114ce3d81fa --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern byteorder=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbyteorder-e2f9c40fb54850d4.rmeta --extern ed25519_compact=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519_compact-00ec68d200d3656d.rmeta --extern rustacuda_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\librustacuda_core-d6350021729315d8.rmeta --extern rustacuda_derive=C:\Windows\System32\tor-v3-vanity\target\release\deps\rustacuda_derive-54427de96a8e8f49.dll`
   Compiling zeroize v1.3.0
     Running `rustc --crate-name zeroize --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\zeroize-1.3.0\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg "feature=\"alloc\"" --cfg "feature=\"zeroize_derive\"" -C metadata=291c62545089b55a -C extra-filename=-291c62545089b55a --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern zeroize_derive=C:\Windows\System32\tor-v3-vanity\target\release\deps\zeroize_derive-46ca0ebb94e412c4.dll --cap-lints allow`
   Compiling failure v0.1.8
     Running `rustc --crate-name failure C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\failure-0.1.8\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off --cfg "feature=\"backtrace\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"failure_derive\"" --cfg "feature=\"std\"" -C metadata=d4d7db600885e672 -C extra-filename=-d4d7db600885e672 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern backtrace=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbacktrace-6be8d861b35e4e22.rmeta --extern failure_derive=C:\Windows\System32\tor-v3-vanity\target\release\deps\failure_derive-8bec413ea318484d.dll --cap-lints allow`
     Running `rustc --crate-name failure C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\failure-0.1.8\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg "feature=\"backtrace\"" --cfg "feature=\"default\"" --cfg "feature=\"derive\"" --cfg "feature=\"failure_derive\"" --cfg "feature=\"std\"" -C metadata=0d17cd3f9a07d838 -C extra-filename=-0d17cd3f9a07d838 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern backtrace=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbacktrace-a046ebcca2e5c405.rmeta --extern failure_derive=C:\Windows\System32\tor-v3-vanity\target\release\deps\failure_derive-8bec413ea318484d.dll --cap-lints allow`
   Compiling curve25519-dalek v3.2.1
     Running `rustc --crate-name curve25519_dalek C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\curve25519-dalek-3.2.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg "feature=\"alloc\"" --cfg "feature=\"std\"" --cfg "feature=\"u64_backend\"" -C metadata=d7108640c981df6d -C extra-filename=-d7108640c981df6d --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern byteorder=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbyteorder-e2f9c40fb54850d4.rmeta --extern digest=C:\Windows\System32\tor-v3-vanity\target\release\deps\libdigest-9e407c8af743b207.rmeta --extern rand_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\librand_core-06e7d83191242dc6.rmeta --extern subtle=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsubtle-21e6501c05ed65a8.rmeta --extern zeroize=C:\Windows\System32\tor-v3-vanity\target\release\deps\libzeroize-291c62545089b55a.rmeta --cap-lints allow`
   Compiling ptx-builder v0.5.3
     Running `rustc --crate-name ptx_builder --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\ptx-builder-0.5.3\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debug-assertions=off -C metadata=421824625e007f5b -C extra-filename=-421824625e007f5b --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern colored=C:\Windows\System32\tor-v3-vanity\target\release\deps\libcolored-30d0ded1b461fda1.rmeta --extern failure=C:\Windows\System32\tor-v3-vanity\target\release\deps\libfailure-d4d7db600885e672.rmeta --extern lazy_static=C:\Windows\System32\tor-v3-vanity\target\release\deps\liblazy_static-dadd53488fec2266.rmeta --extern regex=C:\Windows\System32\tor-v3-vanity\target\release\deps\libregex-ab9ae35383865794.rmeta --extern semver=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsemver-15795110fc9348e5.rmeta --extern toml=C:\Windows\System32\tor-v3-vanity\target\release\deps\libtoml-7850967a9eeec1d7.rmeta --cap-lints allow`
   Compiling tor-v3-vanity v0.1.0 (C:\Windows\System32\tor-v3-vanity)
     Running `rustc --crate-name build_script_build --edition=2018 build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debug-assertions=off -C metadata=213a2510e34bfe9a -C extra-filename=-213a2510e34bfe9a --out-dir C:\Windows\System32\tor-v3-vanity\target\release\build\tor-v3-vanity-213a2510e34bfe9a -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern ptx_builder=C:\Windows\System32\tor-v3-vanity\target\release\deps\libptx_builder-421824625e007f5b.rlib`
   Compiling ed25519-dalek v1.0.1
     Running `rustc --crate-name ed25519_dalek --edition=2018 C:\Users\Ayka\.cargo\registry\src\github.com-1ecc6299db9ec823\ed25519-dalek-1.0.1\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg "feature=\"default\"" --cfg "feature=\"rand\"" --cfg "feature=\"serde_crate\"" --cfg "feature=\"std\"" --cfg "feature=\"u64_backend\"" -C metadata=ea1b72622f5b9957 -C extra-filename=-ea1b72622f5b9957 --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern curve25519_dalek=C:\Windows\System32\tor-v3-vanity\target\release\deps\libcurve25519_dalek-d7108640c981df6d.rmeta --extern ed25519=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519-9a4c54e51dcfdb5c.rmeta --extern rand=C:\Windows\System32\tor-v3-vanity\target\release\deps\librand-bf116e18b67743b4.rmeta --extern serde_crate=C:\Windows\System32\tor-v3-vanity\target\release\deps\libserde-9ce61baa144e7f31.rmeta --extern sha2=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsha2-9d1f359da4a0f8b8.rmeta --extern zeroize=C:\Windows\System32\tor-v3-vanity\target\release\deps\libzeroize-291c62545089b55a.rmeta --cap-lints allow`
     Running `C:\Windows\System32\tor-v3-vanity\target\release\build\tor-v3-vanity-213a2510e34bfe9a\build-script-build`
     Running `rustc --crate-name tor_v3_vanity --edition=2018 src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=d05b9547b89e2adb --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern base32=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbase32-84f89b0dbca592fd.rlib --extern byteorder=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbyteorder-e2f9c40fb54850d4.rlib --extern chrono=C:\Windows\System32\tor-v3-vanity\target\release\deps\libchrono-70852e6d3ec7871d.rlib --extern clap=C:\Windows\System32\tor-v3-vanity\target\release\deps\libclap-2c60148a34985edb.rlib --extern crossbeam_channel=C:\Windows\System32\tor-v3-vanity\target\release\deps\libcrossbeam_channel-5b05abe2a5c3aec2.rlib --extern ed25519_compact=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519_compact-1dbc5ec94783fabb.rlib --extern ed25519_dalek=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519_dalek-ea1b72622f5b9957.rlib --extern failure=C:\Windows\System32\tor-v3-vanity\target\release\deps\libfailure-0d17cd3f9a07d838.rlib --extern num_cpus=C:\Windows\System32\tor-v3-vanity\target\release\deps\libnum_cpus-31ad845e15e2b15d.rlib --extern rand=C:\Windows\System32\tor-v3-vanity\target\release\deps\librand-bf116e18b67743b4.rlib --extern rustacuda_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\librustacuda_core-d6350021729315d8.rlib --extern sha3=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsha3-84e998739cfc5b8d.rlib --extern tor_v3_vanity_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\libtor_v3_vanity_core-e0c57114ce3d81fa.rlib -L native=/usr/local/cuda/lib64/`
error[E0432]: unresolved import `rustacuda_derive`
 --> src\lib.rs:8:5
  |
8 | use rustacuda_derive::DeviceCopy;
  |     ^^^^^^^^^^^^^^^^ use of undeclared crate or module `rustacuda_derive`
  |
help: there is a crate or module with a similar name
  |
8 | use rustacuda_core::DeviceCopy;
  |     ~~~~~~~~~~~~~~

error: cannot determine resolution for the derive macro `DeviceCopy`
  --> src\lib.rs:21:10
   |
21 | #[derive(DeviceCopy, Clone)]
   |          ^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

error: cannot determine resolution for the derive macro `DeviceCopy`
  --> src\lib.rs:13:10
   |
13 | #[derive(DeviceCopy, Clone)]
   |          ^^^^^^^^^^
   |
   = note: import resolution is stuck, try simplifying macro imports

For more information about this error, try `rustc --explain E0432`.
error: failed to compile `tor-v3-vanity v0.1.0 (C:\Windows\System32\tor-v3-vanity)`, intermediate artifacts can be found at `C:\Windows\System32\tor-v3-vanity\target`

Caused by:
  could not compile `tor-v3-vanity` due to 3 previous errors

Caused by:
  process didn't exit successfully: `rustc --crate-name tor_v3_vanity --edition=2018 src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type cdylib --crate-type rlib --emit=dep-info,link -C opt-level=3 -C embed-bitcode=no -C metadata=d05b9547b89e2adb --out-dir C:\Windows\System32\tor-v3-vanity\target\release\deps -L dependency=C:\Windows\System32\tor-v3-vanity\target\release\deps --extern base32=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbase32-84f89b0dbca592fd.rlib --extern byteorder=C:\Windows\System32\tor-v3-vanity\target\release\deps\libbyteorder-e2f9c40fb54850d4.rlib --extern chrono=C:\Windows\System32\tor-v3-vanity\target\release\deps\libchrono-70852e6d3ec7871d.rlib --extern clap=C:\Windows\System32\tor-v3-vanity\target\release\deps\libclap-2c60148a34985edb.rlib --extern crossbeam_channel=C:\Windows\System32\tor-v3-vanity\target\release\deps\libcrossbeam_channel-5b05abe2a5c3aec2.rlib --extern ed25519_compact=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519_compact-1dbc5ec94783fabb.rlib --extern ed25519_dalek=C:\Windows\System32\tor-v3-vanity\target\release\deps\libed25519_dalek-ea1b72622f5b9957.rlib --extern failure=C:\Windows\System32\tor-v3-vanity\target\release\deps\libfailure-0d17cd3f9a07d838.rlib --extern num_cpus=C:\Windows\System32\tor-v3-vanity\target\release\deps\libnum_cpus-31ad845e15e2b15d.rlib --extern rand=C:\Windows\System32\tor-v3-vanity\target\release\deps\librand-bf116e18b67743b4.rlib --extern rustacuda_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\librustacuda_core-d6350021729315d8.rlib --extern sha3=C:\Windows\System32\tor-v3-vanity\target\release\deps\libsha3-84e998739cfc5b8d.rlib --extern tor_v3_vanity_core=C:\Windows\System32\tor-v3-vanity\target\release\deps\libtor_v3_vanity_core-e0c57114ce3d81fa.rlib -L native=/usr/local/cuda/lib64/` (exit code: 1)```

I see here its having trouble importing a dependency (one of the ones that was missing previously). I feel like perhaps its having issue with my CUDA Installation so I will start to investigate down that path.

Replicating src\lib.rs as well here.

#![cfg_attr(
    any(target_arch = "nvptx", target_arch = "nvptx64"),
    feature(abi_ptx, stdsimd)
)]

use rustacuda_core::DevicePointer;
use rustacuda_derive::DeviceCopy;

#[cfg(any(target_arch = "nvptx", target_arch = "nvptx64"))]
mod kernel;

#[derive(DeviceCopy, Clone)]
#[repr(C)]
pub struct KernelParams {
    pub seed: DevicePointer<u8>,
    pub byte_prefixes: DevicePointer<BytePrefix>,
    pub byte_prefixes_len: usize,
}

#[derive(DeviceCopy, Clone)]
#[repr(C)]
pub struct BytePrefix {
    pub byte_prefix: DevicePointer<u8>,
    pub byte_prefix_len: usize,
    pub last_byte_idx: usize,
    pub last_byte_mask: u8,
    pub out: DevicePointer<u8>,
    pub success: DevicePointer<bool>,
}
impl BytePrefix {
    pub fn matches(&self, data: &[u8]) -> bool {
        let slice =
            unsafe { core::slice::from_raw_parts(self.byte_prefix.as_raw(), self.byte_prefix_len) };
        data.starts_with(&slice[..self.last_byte_idx])
            && data[self.last_byte_idx] & self.last_byte_mask == slice[self.last_byte_idx]
    }
}```

As it looks like perhaps this is trying to import something we haven't actually imported yet.

Ok. I've made some progress.

In the last one, I had errors saying it was unable to access the rustacuda_derive package, so in looking into it a little I've now appended the Cargo.toml file that came with the code to include:

rustacuda = "0.1.3"
rustacuda_core = "0.1.2"
rustacuda_derive = "0.1.2"

I am now getting a single error when attempting to build.

error: couldn't read /dev/null: The system cannot find the path specified. (os error 3)
   --> src/main.rs:129:44
    |
129 |             let module_data = CString::new(include_str!(env!("KERNEL_PTX_PATH"))).unwrap();
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro include_str (in Nightly builds, run with -Z macro-backtrace for more info)

error: failed to compile tor-v3-vanity v0.1.0 (C:\Windows\System32\tor-v3-vanity), intermediate artifacts can be found at C:\Windows\System32\tor-v3-vanity\target

Progress!

I've now added

rustacuda = "0.1.3"
rustacuda_core = "0.1.2"
rustacuda_derive = "0.1.2"

to my Cargo.toml file, and that seems to have cleared up the previous three errors in lib.rs, as it now appears to be able to find the function from Rustacuda_derive.

However I have one single error remaining now:

error: couldn't read /dev/null: The system cannot find the path specified. (os error 3)
   --> src/main.rs:129:44
    |
129 |             let module_data = CString::new(include_str!(env!("KERNEL_PTX_PATH"))).unwrap();
    |                                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |
    = note: this error originates in the macro 'include_str' (in Nightly builds, run with -Z macro-backtrace for more info)

error: failed to compile 'tor-v3-vanity v0.1.0 (C:\Windows\System32\tor-v3-vanity)', intermediate artifacts can be found at 'C:\Windows\System32\tor-v3-vanity\target'

Caused by:
  could not compile 'tor-v3-vanity' due to previous error

Progress!

I got this to compile in WSL Ubuntu, but not Windows native. Unfortunately now I need to figure out how to pass the Graphics Card through to WSL.

It seems to be getting stuck on /dev/null, which I'm completely unsure at this point where its getting that. Perhaps its time to Dual-Boot the PC.

Well, unfortunately it executes with an error, even trying it on a full Debian Live Boot (which is reporting a graphics card in nvidia-smi.)

thread '<unnamed>' panicked at 'called `Result::unwrap()` on an `Err` value: InvalidImage', src/main.rs:130:65 note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace thread 'thread '<unnamed>main' panicked at '' panicked at 'called `Result::unwrap()` on an `Err` value: RecvErrorcalled `Result::unwrap()` on an `Err` value: RecvError', ', src/main.rssrc/main.rs::273296::4032

I think this may be the end of the road.

@AykaTV I tried your solution but I am still stuck with rlib related error. Could you please help?