dr-bonez / tor-v3-vanity

A TOR v3 vanity url generator designed to run on an NVIDIA GPU.
https://crates.io/crates/tor-v3-vanity
MIT License
128 stars 22 forks source link

Build error under WSL2 #13

Open TheFiZi opened 2 years ago

TheFiZi commented 2 years ago

Not sure if this is related to https://github.com/dr-bonez/tor-v3-vanity/issues/8 or not. Since the error I am getting is different I figured I'd post a separate issue.

Installed the latest CUDA via the instructions in https://forums.developer.nvidia.com/t/failure-to-install-cuda-on-wsl-2-ubuntu/128592/8

Also tried this:

rustup +nightly target add nvptx64-nvidia-cuda
cargo +nightly install ptx-linker

and I get the following:

me@localhost:~/temp/tor-v3-vanity$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.4 LTS"

me@localhost:~/temp/tor-v3-vanity$ cargo +nightly install --path .
  Installing tor-v3-vanity v0.1.0 (/home/me/temp/tor-v3-vanity)
    Updating crates.io index
   Compiling tor-v3-vanity v0.1.0 (/home/me/temp/tor-v3-vanity)
error: failed to compile `tor-v3-vanity v0.1.0 (/home/me/temp/tor-v3-vanity)`, intermediate artifacts can be found at `/home/me/temp/tor-v3-vanity/target`

Caused by:
  failed to run custom build command for `tor-v3-vanity v0.1.0 (/home/me/temp/tor-v3-vanity)`

Caused by:
  process didn't exit successfully: `/home/me/temp/tor-v3-vanity/target/release/build/tor-v3-vanity-a93a8bc24f511348/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]    Compiling tor-v3-vanity-core v0.1.0 (/home/me/temp/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]

There are CUDA Libraries in /usr/local/cuda/lib64/

AykaTV commented 2 years ago

I'm encountering the exact same error on Windows, from what I can tell it doesn't have anything to do w/ the CUDA Install.

Instead it would appear that its requiring we get those three libraries in the RLIB Format, but they're compiled in a different format. I noticed in build.rs the following: // Workaround for "crate required to be available in rlib format" bug std::env::set_var("CARGO_BUILD_PIPELINING", "false");

but it would appear this workaround no longer works. I can't seem to get past this either, and I dont know RUST well enough to know what to google to find the result. Nothing is really jumping out at me as to how we can force these three libs to compile in rlib.

jkennedyvz commented 2 years ago

I am a rust noob Here is what I did to build:

Install rustup and stable channel, then run cargo install ptx-linker

Now switch to channel before pipeline changes, I used nightly-2021-04-01 default toolchain.

rustup target add nvptx64-nvidia-cuda

At this point ed25519-1.4.0 was problematic for being too-new. Instead of downgrading I patched my local version.

~/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-1.4.0/Cargo.toml:11

+cargo-features = ["edition2021"]

~/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-1.4.0/src/lib.rs:259

+use core::convert::TryFrom; +use core::convert::TryInto;

Now build with cargo install --path .

TheFiZi commented 2 years ago

@jkennedyvz Was this to get it working under WSL2? I tried the steps you outlined and ended up with the same rlib format error.

jkennedyvz commented 2 years ago

Hi @TheFiZi , This was under ubuntu 20.04.4. The errors you are seeing will be present regardless of OS.

Can you run cargo clean, check your default toolchain, and then attempt the steps again?

BTW: I have experienced the same issues described in #11. This project is less performant on a 10xGPU rig than mkp224o on a decent multi-core system.

TheFiZi commented 2 years ago

@jkennedyvz thanks! I got a lot further with that. I've got ed25519 1.4.1 installed and with or without your suggested tweaks I get this:

error[E0405]: cannot find trait `TryFrom` in this scope
   --> /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-1.4.1/src/lib.rs:376:6
    |
376 | impl TryFrom<&[u8]> for Signature {
    |      ^^^^^^^ not found in this scope
    |
help: consider importing one of these items
    |
268 | use core::convert::TryFrom;
    |
268 | use crate::str::slice::raw::array::TryFrom;
    |

error[E0658]: arbitrary expressions in key-value attributes are unstable
 --> /home/me/.cargo/registry/src/github.com-1ecc6299db9ec823/ed25519-1.4.1/src/lib.rs:3:10
  |
3 | #![doc = include_str!("../README.md")]
  |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: see issue #78835 <https://github.com/rust-lang/rust/issues/78835> for more information
  = help: add `#![feature(extended_key_value_attributes)]` to the crate attributes to enable

error: aborting due to 2 previous errors

Some errors have detailed explanations: E0405, E0658.
For more information about an error, try `rustc --explain E0405`.
error: could not compile `ed25519`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tor-v3-vanity v0.1.0 (/home/me/temp/tor-v3-vanity)`, intermediate artifacts can be found at `/home/me/temp/tor-v3-vanity/target`

Caused by:
  build failed

Now that I've read running this on my 3070 isn't going to be any faster than just using mkp224o on my CPU. I think I'll just stick with that.

AykaTV commented 2 years ago

So I was able to get this to compile myself; however started encountering errors when actually running it:

thread '<unnamed>' panicked at 'calledResult::unwrap()on anErrvalue: InvalidImage', src/main.rs:130:65 note: run withRUST_BACKTRACE=1environment variable to display a backtrace thread 'thread '<unnamed>main' panicked at '' panicked at 'calledResult::unwrap()on anErrvalue: RecvErrorcalledResult::unwrap()on anErrvalue: RecvError', ', src/main.rssrc/main.rs::273296::4032

AykaTV commented 2 years ago

After reading that you too @jkennedyvz had issues with speed on a GPU Rig, I've been running the CatHugger mkp224o on a AMD Epyc processor now for a bit; and will likely just continue with that.

ajmcello commented 2 years ago

I've tried this, the nightly 04 snapshot, and about 50 others. Having the exact same issues as AykaTV. Once, I did get it to compile and it spit out a seed key and my custom prefix. Ha. But I have no idea how I did it and cannot replicate it. :\

I think it builds successfully if I use:

PTX_CRATE_BUILDING=1 CARGO_BUILD_PIPELINING=true cargo +nightly install --path .

but will blow up with the unwrap() Err on InvalidImage. So frustrating, I probably spent enough time on this to get a vanity on regular CPU cores :\