cjdelisle / packetcrypt_rs

PacketCrypt in Rust
54 stars 45 forks source link

Windows Build Fails - error: failed to run custom build command for `ring v0.16.20` #39

Open AIoTPunks opened 2 years ago

AIoTPunks commented 2 years ago

Hi. Will you help me get my windows machine announcement mining? I'm getting an error message when I install on my newly build windows 10. Below are the steps I took and the error message.

STEPS

1) Installed Windows 10 on my macbook pro via boot camp: https://support.apple.com/boot-camp

2) Installed dependencies: go, rust, cargo, git, visual studio

3) I entered these two commands.
rustup toolchain install stable-x86_64-pc-windows-gnu rustup set default-host x86_64-pc-windows-gnu https://github.com/cjdelisle/packetcrypt_rs/issues/37#issuecomment-997134690

4) I did not setup or create a wallet on my PC. Plan was to use my existing wallet address, that I created on my mac.

5) I ran this command. The error comes up on the "cargo build --release" part git clone https://github.com/cjdelisle/packetcrypt_rs cd packetcrypt_rs cargo build --release

ERROR MESSAGE -

C:\Users\AIoT Punks - Rex\pkt_test_original\packetcrypt_rs>cargo build --release Compiling winapi-x86_64-pc-windows-gnu v0.4.0 Compiling winapi v0.3.9 Compiling autocfg v1.0.1 Compiling cfg-if v1.0.0 Compiling proc-macro2 v1.0.27 Compiling unicode-xid v0.2.2 Compiling syn v1.0.73 Compiling lazy_static v1.4.0 Compiling version_check v0.9.3 Compiling winapi-build v0.1.1 Compiling cc v1.0.68 Compiling log v0.4.14 Compiling futures-core v0.3.15 Compiling cfg-if v0.1.10 Compiling memchr v2.4.0 Compiling fnv v1.0.7 Compiling proc-macro-hack v0.5.19 Compiling winapi v0.2.8 Compiling itoa v0.4.7 Compiling slab v0.4.3 Compiling libc v0.2.97 Compiling serde_derive v1.0.126 Compiling futures-task v0.3.15 Compiling pin-project-lite v0.2.7 Compiling proc-macro-nested v0.1.7 Compiling iovec v0.1.4 Compiling bytes v0.5.6 Compiling typenum v1.13.0 Compiling bytes v1.0.1 Compiling serde v1.0.126 Compiling futures-sink v0.3.15 Compiling matches v0.1.8 Compiling pin-project-lite v0.1.12 Compiling untrusted v0.7.1 Compiling spin v0.5.2 Compiling tinyvec_macros v0.1.0 Compiling pin-utils v0.1.0 Compiling futures-channel v0.3.15 Compiling percent-encoding v2.1.0 Compiling httparse v1.4.1 Compiling hashbrown v0.11.2 Compiling bitflags v1.2.1 Compiling ryu v1.0.5 Compiling try-lock v0.2.3 Compiling maybe-uninit v2.0.0 Compiling getrandom v0.1.16 Compiling tower-service v0.3.1 Compiling cpufeatures v0.1.5 Compiling opaque-debug v0.3.0 Compiling httpdate v0.3.2 Compiling mime v0.3.16 Compiling base64 v0.12.3 Compiling encoding_rs v0.8.28 Compiling base64 v0.13.0 Compiling serde_json v1.0.64 Compiling scopeguard v1.1.0 Compiling anyhow v1.0.41 Compiling ppv-lite86 v0.2.10 Compiling regex-syntax v0.6.25 Compiling pkg-config v0.3.19 Compiling quick-error v1.2.3 Compiling nodrop v0.1.14 Compiling arrayvec v0.5.2 Compiling crossbeam-utils v0.8.5 Compiling constant_time_eq v0.1.5 Compiling arrayref v0.3.6 Compiling ipnet v2.3.1 Compiling signature v1.3.1 Compiling hex v0.4.3 Compiling crossbeam-epoch v0.9.5 Compiling pin-project-internal v0.4.28 Compiling rayon-core v1.9.1 Compiling smallvec v1.6.1 Compiling dtoa v0.4.8 Compiling futures-io v0.3.15 Compiling urlencoding v1.3.3 Compiling either v1.6.1 Compiling scoped-tls v1.0.0 Compiling unicode-width v0.1.8 Compiling strsim v0.8.0 Compiling vec_map v0.8.2 Compiling hex-literal v0.3.1 Compiling instant v0.1.9 Compiling futures-macro v0.3.15 Compiling futures-util v0.3.15 Compiling indexmap v1.7.0 Compiling crossbeam-utils v0.7.2 Compiling num-traits v0.2.14 Compiling num-integer v0.1.44 Compiling num-bigint v0.3.2 Compiling memoffset v0.6.4 Compiling rayon v1.5.1 Compiling tracing-core v0.1.18 Compiling kernel32-sys v0.2.2 Compiling ws2_32-sys v0.2.1 Compiling unicase v2.6.0 Compiling generic-array v0.14.4 Compiling ring v0.16.20 Compiling http v0.2.4 Compiling unicode-bidi v0.3.5 Compiling tinyvec v1.2.0 Compiling form_urlencoded v1.0.1 Compiling lock_api v0.4.4 Compiling humantime v1.3.0 Compiling array-init v0.0.4 Compiling blake2b_simd v0.5.11 Compiling ed25519 v1.1.1 Compiling textwrap v0.11.0 Compiling http-body v0.3.1 error: failed to run custom build command for ring v0.16.20

Caused by: process didn't exit successfully: C:\Users\AIoT Punks - Rex\pkt_test_original\packetcrypt_rs\target\release\build\ring-846f484d01778f1b\build-script-build (exit code: 101) --- stdout OPT_LEVEL = Some("3") TARGET = Some("x86_64-pc-windows-gnu") HOST = Some("x86_64-pc-windows-gnu") CC_x86_64-pc-windows-gnu = None CC_x86_64_pc_windows_gnu = None HOST_CC = None CC = None CFLAGS_x86_64-pc-windows-gnu = None CFLAGS_x86_64_pc_windows_gnu = None HOST_CFLAGS = None CFLAGS = None CRATE_CC_NO_DEFAULTS = None DEBUG = Some("false") CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")

--- stderr running "gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-g3" "-DNDEBUG" "-c" "-oC:\Users\AIoT Punks - Rex\pkt_test_original\packetcrypt_rs\target\release\build\ring-152f50917f1a08e5\out\aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c" thread 'main' panicked at 'failed to execute ["gcc.exe" "-O3" "-ffunction-sections" "-fdata-sections" "-m64" "-I" "include" "-Wall" "-Wextra" "-std=c1x" "-Wbad-function-cast" "-Wnested-externs" "-Wstrict-prototypes" "-pedantic" "-pedantic-errors" "-Wall" "-Wextra" "-Wcast-align" "-Wcast-qual" "-Wconversion" "-Wenum-compare" "-Wfloat-equal" "-Wformat=2" "-Winline" "-Winvalid-pch" "-Wmissing-field-initializers" "-Wmissing-include-dirs" "-Wredundant-decls" "-Wshadow" "-Wsign-compare" "-Wsign-conversion" "-Wundef" "-Wuninitialized" "-Wwrite-strings" "-fno-strict-aliasing" "-fvisibility=hidden" "-g3" "-DNDEBUG" "-c" "-oC:\Users\AIoT Punks - Rex\pkt_test_original\packetcrypt_rs\target\release\build\ring-152f50917f1a08e5\out\aes_nohw.o" "crypto/fipsmodule/aes/aes_nohw.c"]: The system cannot find the file specified. (os error 2)', C:\Users\AIoT Punks - Rex.cargo\registry\src\github.com-1ecc6299db9ec823\ring-0.16.20\build.rs:653:9 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace warning: build failed, waiting for other jobs to finish... error: build failed

C:\Users\AIoT Punks - Rex\pkt_test_original\packetcrypt_rs>

Frank-Buss commented 2 years ago

The following manual is how to install it on a fresh Windows 10 installation. It needs about 30 GB including the operating system.

First install msys2 from msys2.org:

msys

After installation, it opens a terminal window. Update it as described on the webpage:

pacman -Syu

This will close the msys2 terminal. Start it again (type "msys2" in the Windows search bar to quickly find it), then:

pacman -Su
pacman -S --needed base-devel mingw-w64-x86_64-toolchain mingw-w64-x86_64-libsodium
pacman -S git

This is the same as suggested on the webpage, except for the additional libsodium library, which is needed by the miner software later, and git for cloning projects.

Then you can close the terminal windows.

Next add the directories c:\msys64\ming64\bin and c:\msys64\usr\bin to the Windows system path:

path

Now open a new command prompt (type cmd.exe in the search bar and hit enter). If you enter gcc --version it should look like this (might be a later version, and another user name) :

gcc

Close the command prompt, and install Rust from rustup.rs. Then open a new command prompt and enter this:

rustup toolchain install stable-x86_64-pc-windows-gnu
rustup set default-host x86_64-pc-windows-gnu

Finally create a new temporary directory, clone the project, and compile it:

cd c:\
mkdir tmp
git clone https://github.com/cjdelisle/packetcrypt_rs
cd packetcrypt_rs
cargo build --release

The result is in the target\release directory: release

Frank-Buss commented 2 years ago

PS: here are all the warnings I got when compiling the miner software, which should be fixed:

warning: march=native is enabled, this build is non-portable
warning: packetcrypt/src/Hash.c:31:29: warning: argument 3 of type 'const uint8_t * restrict' {aka 'const unsigned char * restrict'} declared as a pointer [-Warray-parameter=]
warning:    31 |     const uint8_t* restrict seed,
warning:       |     ~~~~~~~~~~~~~~~~~~~~~~~~^~~~
warning: In file included from packetcrypt/src/Hash.c:7:
warning: packetcrypt/src/Hash.h:17:61: note: previously declared as an array 'const uint8_t[static 32]' {aka 'const unsigned char[32]'}
warning:    17 | void Hash_expand(uint8_t* buff, uint32_t len, const uint8_t seed[static 32], uint32_t num);
warning:       |                                               ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
warning: packetcrypt/src/ProofTree.c: In function 'ProofTree_mkProof':
warning: packetcrypt/src/ProofTree.c:43:8: warning: array subscript 'ProofTree_Proof_t {aka struct ProofTree_Proof_s}[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds]
warning:    43 |     out->data = PacketCryptProof_mkProof(&size, &pt->tree, annNumbers);
warning:       |        ^~
warning: packetcrypt/src/ProofTree.c:40:30: note: referencing an object of size 8 allocated by 'malloc'
warning:    40 |     ProofTree_Proof_t* out = malloc(sizeof(ProofTree_Proof_t*));
warning:       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: packetcrypt/src/ProofTree.c:44:8: warning: array subscript 'ProofTree_Proof_t {aka struct ProofTree_Proof_s}[0]' is partly outside array bounds of 'unsigned char[8]' [-Warray-bounds]
warning:    44 |     out->size = size;
warning:       |        ^~
warning: packetcrypt/src/ProofTree.c:40:30: note: referencing an object of size 8 allocated by 'malloc'
warning:    40 |     ProofTree_Proof_t* out = malloc(sizeof(ProofTree_Proof_t*));
warning:       |                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
warning: packetcrypt/src/BlockMine.c: In function 'munmap':
warning: packetcrypt/src/BlockMine.c:81:39: warning: unused parameter '_len' [-Wunused-parameter]
warning:    81 | static int munmap(void* buf, uint64_t _len) {
warning:       |                              ~~~~~~~~~^~~~
warning: packetcrypt/src/UdpGso.c: In function 'UdpGro_enable':
warning: packetcrypt/src/UdpGso.c:18:23: warning: unused parameter '_fd' [-Wunused-parameter]
warning:    18 | int UdpGro_enable(int _fd, int _pktSize) {
warning:       |                   ~~~~^~~
warning: packetcrypt/src/UdpGso.c:18:32: warning: unused parameter '_pktSize' [-Wunused-parameter]
warning:    18 | int UdpGro_enable(int _fd, int _pktSize) {
warning:       |                            ~~~~^~~~~~~~
warning: packetcrypt/src/UdpGso.c: In function 'UdpGro_recvmsg':
warning: packetcrypt/src/UdpGso.c:21:24: warning: unused parameter '_fd' [-Wunused-parameter]
warning:    21 | int UdpGro_recvmsg(int _fd, struct UdpGro_Sockaddr* _addrOut, uint8_t* _buf, int _length, int* _pktSize) {
warning:       |                    ~~~~^~~
warning: packetcrypt/src/UdpGso.c:21:53: warning: unused parameter '_addrOut' [-Wunused-parameter]
warning:    21 | int UdpGro_recvmsg(int _fd, struct UdpGro_Sockaddr* _addrOut, uint8_t* _buf, int _length, int* _pktSize) {
warning:       |                             ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
warning: packetcrypt/src/UdpGso.c:21:72: warning: unused parameter '_buf' [-Wunused-parameter]
warning:    21 | int UdpGro_recvmsg(int _fd, struct UdpGro_Sockaddr* _addrOut, uint8_t* _buf, int _length, int* _pktSize) {
warning:       |                                                               ~~~~~~~~~^~~~
warning: packetcrypt/src/UdpGso.c:21:82: warning: unused parameter '_length' [-Wunused-parameter]
warning:    21 | int UdpGro_recvmsg(int _fd, struct UdpGro_Sockaddr* _addrOut, uint8_t* _buf, int _length, int* _pktSize) {
warning:       |                                                                              ~~~~^~~~~~~
warning: packetcrypt/src/UdpGso.c:21:96: warning: unused parameter '_pktSize' [-Wunused-parameter]
warning:    21 | int UdpGro_recvmsg(int _fd, struct UdpGro_Sockaddr* _addrOut, uint8_t* _buf, int _length, int* _pktSize) {
warning:       |                                                                                           ~~~~~^~~~~~~~
warning: packetcrypt/src/UdpGso.c: In function 'UdpGro_sendmsg':
warning: packetcrypt/src/UdpGso.c:24:24: warning: unused parameter '_fd' [-Wunused-parameter]
warning:    24 | int UdpGro_sendmsg(int _fd, const struct UdpGro_Sockaddr* _addr, const uint8_t* _data, int _length, int _pktSize) {
warning:       |                    ~~~~^~~
warning: packetcrypt/src/UdpGso.c:24:59: warning: unused parameter '_addr' [-Wunused-parameter]
warning:    24 | int UdpGro_sendmsg(int _fd, const struct UdpGro_Sockaddr* _addr, const uint8_t* _data, int _length, int _pktSize) {
warning:       |                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
warning: packetcrypt/src/UdpGso.c:24:81: warning: unused parameter '_data' [-Wunused-parameter]
warning:    24 | int UdpGro_sendmsg(int _fd, const struct UdpGro_Sockaddr* _addr, const uint8_t* _data, int _length, int _pktSize) {
warning:       |                                                                  ~~~~~~~~~~~~~~~^~~~~
warning: packetcrypt/src/UdpGso.c:24:92: warning: unused parameter '_length' [-Wunused-parameter]
warning:    24 | int UdpGro_sendmsg(int _fd, const struct UdpGro_Sockaddr* _addr, const uint8_t* _data, int _length, int _pktSize) {
warning:       |                                                                                        ~~~~^~~~~~~
warning: packetcrypt/src/UdpGso.c:24:105: warning: unused parameter '_pktSize' [-Wunused-parameter]
warning:    24 | int UdpGro_sendmsg(int _fd, const struct UdpGro_Sockaddr* _addr, const uint8_t* _data, int _length, int _pktSize) {
warning:       |                                                                                                     ~~~~^~~~~~~~
warning: packetcrypt/src/UdpGso.c: In function 'UdpGro_setRecvBuf':
warning: packetcrypt/src/UdpGso.c:27:27: warning: unused parameter '_fd' [-Wunused-parameter]
warning:    27 | int UdpGro_setRecvBuf(int _fd, int _bufSz) {
warning:       |                       ~~~~^~~
warning: packetcrypt/src/UdpGso.c:27:36: warning: unused parameter '_bufSz' [-Wunused-parameter]
warning:    27 | int UdpGro_setRecvBuf(int _fd, int _bufSz) {
warning:       |                                ~~~~^~~~~~

Also, using "%llu", for example used here: https://github.com/cjdelisle/packetcrypt_rs/blob/9cce37edd78f94f8ddd8b451022b5b34b3a766ca/packetcrypt-sys/packetcrypt/src/BlockMine.c#L167 is a GCC extension and not portable C and might fail later with Visual C. The standard way is with the %PRI* macros, as described here, for example %PRIu64, which is defined in inttypes.h: https://en.cppreference.com/w/c/types/integer

Kower999 commented 2 years ago

thank you very much m8 .. installing MSYS2 was crucial to successfully compile packetcrypt ...