zcash / zcash

Zcash - Internet Money
https://z.cash/
Other
4.93k stars 2.03k forks source link

Document the process of cross-compiling to Windows and running tests on Windows #4622

Open daira opened 4 years ago

daira commented 4 years ago

The process to get zcashd running is:

To run the tests:

str4d commented 4 years ago

run pip install simplejson and pip install pyblake2 (the latter is why you need Visual Studio; would be good to avoid that requirement);

Python 3.6 added BLAKE2s and BLAKE2b to hashlib, based on the pyblake2 implementation. We can try to use the hashlib implementations, and fall back to pyblake2 for pre-3.6.

daira commented 4 years ago

Many of the RPC tests fail with errors similar to this one (on Windows 8.1, Python 3.8.4):

screenshot

daira commented 4 years ago
daira@katava:~$ sudo update-alternatives --config x86_64-w64-mingw32-gcc
[sudo] password for daira: 
There are 2 choices for the alternative x86_64-w64-mingw32-gcc (providing /usr/bin/x86_64-w64-mingw32-gcc).

  Selection    Path                                   Priority   Status
------------------------------------------------------------
  0            /usr/bin/x86_64-w64-mingw32-gcc-win32   60        auto mode
* 1            /usr/bin/x86_64-w64-mingw32-gcc-posix   30        manual mode
  2            /usr/bin/x86_64-w64-mingw32-gcc-win32   60        manual mode

Press <enter> to keep the current choice[*], or type selection number: ^C
daira@katava:~$ sudo update-alternatives --config x86_64-w64-mingw32-g++
There are 2 choices for the alternative x86_64-w64-mingw32-g++ (providing /usr/bin/x86_64-w64-mingw32-g++).

  Selection    Path                                   Priority   Status
------------------------------------------------------------
  0            /usr/bin/x86_64-w64-mingw32-g++-win32   60        auto mode
* 1            /usr/bin/x86_64-w64-mingw32-g++-posix   30        manual mode
  2            /usr/bin/x86_64-w64-mingw32-g++-win32   60        manual mode

Press <enter> to keep the current choice[*], or type selection number: 

zcashd uses std::thread APIs, which are only available with the posix threading option. The win32 threading option cannot possibly work.

We should probably document that the posix threading option should be set using:

sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix

(Somewhat horrifyingly, the gcc and g++ threading options can be set differently. Don't do that!)

See also https://github.com/zcash/zcash/pull/6517/files#r1154268931, which might be sufficient to avoid needing to set these options.

daira commented 3 years ago

Many of the RPC tests fail with errors similar to this one (on Windows 8.1, Python 3.8.4): [...]

This issue is still present in (888039caf1cc41577f9c8facecdc2525375e9be5 plus #4810). There seem to be many other RPC test failures as well, some that look like regressions.

daira commented 3 years ago

Apparently it might be required to install zstd now.

daira commented 3 years ago

Related (but no fix there): https://bugs.llvm.org/show_bug.cgi?id=43642

daira commented 3 years ago

4848 and #4975 have information needed for a successful build.