Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minimal code changes to allow msvc compilation #11558

Merged
merged 1 commit into from Dec 13, 2017

Conversation

sipsorcery
Copy link
Member

@sipsorcery sipsorcery commented Oct 25, 2017

These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (#11562 is also required).

I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

tp->tv_usec = (long)(system_time.wMilliseconds * 1000);
return 0;
}
#endif
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's just drop gettimedouble() and switch this to std::chrono::steady_clock. That should eliminate the non-portable code.

src/random.h Outdated
typedef int32_t ssize_t;
#endif
#endif

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just making MAX_TRIES an int should remove the need for this?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just making MAX_TRIES an int should remove the need for this?

Yes this would be better than adding a top-level definition that could conflict with other libraries. (Also, if we did need a top-level definition, compat.h would probably be a better place to put it.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanofsky I agree it's very clunky to add yet another ssize_t typedef. I did consider adding to compat.h, see the main PR comment. Happy to go with whatever the consensus is.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to go with whatever the consensus is.

I think you should just make MAX_TRIES an int like Cory suggested.

@@ -32,7 +36,7 @@ void memory_cleanse(void *ptr, size_t len)
might try to eliminate "superfluous" memsets. If there's an easy way to
detect memset_s, it would be better to use that. */
#if defined(_MSC_VER)
__asm;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the discussion here #11196 for context here. Now would be a good time to reassess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that __asm is not supported with msvc when targeting x64, that's the only reason for this change.

@theuni
Copy link
Member

theuni commented Oct 25, 2017

The rest of the changes look good to me.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good if ssize_t, gettimeofday, and tab character comments are addressed.

src/random.h Outdated
typedef int32_t ssize_t;
#endif
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think just making MAX_TRIES an int should remove the need for this?

Yes this would be better than adding a top-level definition that could conflict with other libraries. (Also, if we did need a top-level definition, compat.h would probably be a better place to put it.)

@@ -7,6 +7,10 @@

#include <cstring>

#if defined(_MSC_VER)
#include <Windows.h> // For SecureZeroMemory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to get replace the tab on this line with spaces to fix travis error.

@theuni
Copy link
Member

theuni commented Oct 25, 2017

See #11562, which should eliminate the need for the gettimeofday() patch.

Copy link
Contributor

@ryanofsky ryanofsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK a80e0c591b5b56111bdb1d42ff0449dede61810b. Seems fine now without gettimeofday implementation. Would be nice to get rid of ssize_t too.

src/random.h Outdated
typedef int32_t ssize_t;
#endif
#endif

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Happy to go with whatever the consensus is.

I think you should just make MAX_TRIES an int like Cory suggested.

@sipsorcery sipsorcery force-pushed the code_msvc branch 4 times, most recently from 17cd798 to af82415 Compare November 1, 2017 09:41
@sipsorcery
Copy link
Member Author

Working around the use of the non-portable ssize_t definition is proving to be a bit tricky. Adding a typedef to random.h allows the code to build but as some reviewers pointed out it was a clunky fix.

Switching from ssize_t to int in random.h and random.cpp is not sufficient. There are also multiple uses of ssize_t in netbase.cpp and test/util_tests.cpp. A side effect of the definition in random.h was that those two classes picked up the definition.

Adding a typedef to compat.h and also adding an include for compat.h to random.h gets the definition to the missing spots BUT it introduces a re-definition compilation error because the db.h header from BerkeleyDB already has the same typedef.

After some gymnastics I have managed to come up with a set of directives that allow successful compilation, see below, however if portable code is a goal for the future it may be worth steering away from non-C++ standard types, such as ssize_t, outside of any platform specific classes?

#ifdef _MSC_VER
#if !defined(ssize_t)
#ifdef _WIN64
typedef int64_t ssize_t;
#else
typedef int32_t ssize_t;
#endif
#endif
#endif

laanwj added a commit that referenced this pull request Nov 8, 2017
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example #11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
@laanwj
Copy link
Member

laanwj commented Nov 9, 2017

however if portable code is a goal for the future it may be worth steering away from non-C++ standard types, such as ssize_t, outside of any platform specific classes?

Agree, ssize_t should be used in POSIX code, as some of the POSIX functions such as read() return it. But outside it it's better not to.

utACK, changes look sane (or at least harmless) to me now. af82415

@ryanofsky
Copy link
Contributor

ryanofsky commented Nov 9, 2017


EDIT: Never mind. I see there were other uses of ssize_t outside of random.h/cpp. Still would be good to stop using ssize_t in inappropriate places.

src/random.h Outdated
@@ -9,6 +9,7 @@
#include "crypto/chacha20.h"
#include "crypto/common.h"
#include "uint256.h"
#include "compat.h"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please just make NUM_OS_RANDOM_BYTES an int to keep the compat.h include out of this header. I realize it's still needed in the cpp, but let's try not to spread the use further than necessary.

@laanwj laanwj merged commit fbf327b into bitcoin:master Dec 13, 2017
laanwj added a commit that referenced this pull request Dec 13, 2017
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
@maflcko
Copy link
Member

maflcko commented Dec 13, 2017

Post merge Concept ACK fbf327b

@sipsorcery sipsorcery deleted the code_msvc branch December 13, 2017 21:23
@bolekC bolekC mentioned this pull request Jan 14, 2018
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Aug 13, 2018
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example bitcoin#11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jan 31, 2020
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example bitcoin#11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 4, 2020
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example bitcoin#11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 9, 2020
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example bitcoin#11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 13, 2020
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Feb 27, 2020
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
zkbot added a commit to zcash/zcash that referenced this pull request Apr 30, 2020
Memory cleanse backports

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#10308
- bitcoin/bitcoin#11196
- bitcoin/bitcoin#11558
  - Only the changes that did not conflict.
- bitcoin/bitcoin#16158

Part of #145.
zkbot added a commit to zcash/zcash that referenced this pull request Apr 30, 2020
memory_cleanse backports

Cherry-picked from the following upstream PRs:
- bitcoin/bitcoin#10308
- bitcoin/bitcoin#11196
- bitcoin/bitcoin#11558
  - Only the changes that did not conflict.
- bitcoin/bitcoin#16158

Part of #145.
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Nov 13, 2020
Summary:
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

---

Backport of Core [[bitcoin/bitcoin#11558 | PR11558]]

Test Plan:
  ninja all check check-functional

Reviewers: #bitcoin_abc, deadalnix

Reviewed By: #bitcoin_abc, deadalnix

Subscribers: deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D8379
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request May 26, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 26, 2021
24a0bdd bench: prefer a steady clock if the resolution is no worse (Cory Fields)
c515d26 bench: switch to std::chrono for time measurements (Cory Fields)

Pull request description:

  gettimeofday has portability issues, see for example bitcoin#11558.

  Regardless of large-scale clock refactors in the future, I think it's fine for bench to just use std::chrono itself.

  Note that this may slightly improve bench accuracy and changes the display from tiny floats to nanosecond counts instead.

Tree-SHA512: 122355456d01ec6cfcf6867991715cf3a95eabbf5a4f2adc26a059b50382ffb318b7639cdd575197fc4ee5be8b967c0404f1f920d6f5bd4ddd0bd63b5e5c5632
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 27, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 28, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jun 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
gades pushed a commit to cosanta/cosanta-core that referenced this pull request Jun 30, 2021
fbf327b Minimal code changes to allow msvc compilation. (Aaron Clauson)

Pull request description:

  These changes are required to allow the Bitcoin source to build with Microsoft's C++ compiler (bitcoin#11562 is also required).

  I looked around for a better place for the typedef of ssize_t which is in random.h. The best candidate looks like src/compat.h but I figured including that header in random.h is a bigger change than the typedef. Note that the same typedef is in at least two other places including the OpenSSL and Berkeley DB headers so some of the Bitcoin code already picks it up.

Tree-SHA512: aa6cc6283015e08ab074641f9abdc116c4dc58574dc90f75e7a5af4cc82946d3052370e5cbe855fb6180c00f8dc66997d3724ff0412e4b7417e51b6602154825
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 1, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 12, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 13, 2021
…up docs

f53a70c Improve documentation of memory_cleanse() (Tim Ruffing)
cac30a4 Clean up logic in memory_cleanse() for MSVC (Tim Ruffing)

Pull request description:

  When working on bitcoin-core/secp256k1#185, I noticed that the logic in memory_cleanse(), which is supposed to clear memory securely, is weird on MSVC. While it's correct, it's at least a code smell because the code clears the memory twice on MSVC. This weirdness was introduced by bitcoin#11558.

  This PR fixes the logic on MSVC and also improves the docs around this function. Best reviewed in individual commits, see the commit messages for more rationale. The second commit touches only comments.

ACKs for top commit:
  practicalswift:
    utACK f53a70c :-)
  laanwj:
    code review ACK f53a70c

Tree-SHA512: 1c2fd98ae62b34b3e6e59d1178b293af969a9e06cbb7df02a699ce8802f145a336f72edb178c520e3ecec81f7e8083828f90a5ba6367d966a2c7d7c0dd6c0475
linuxsh2 pushed a commit to linuxsh2/dash that referenced this pull request Jul 29, 2021
ef7beae Visual Studio build configuration for Bitcoin Core (Aaron Clauson)

Pull request description:

  This PR allows Bitcoin Core to be relatively easily built with Visual Studio 2017. It's anticipated that it could be useful for devs familiar with Visual Studio and Microsoft's tooling. In particular the ability to use the VS debugger is a big benefit.

  ~~Caveats:~~
  - ~~There are some minor code changes required on Bitcoin Core in order for msvc to be able to successfully compile. I'll submit them in a separate PR, The code changes are available in bitcoin#11528 bitcoin#11558 and bitcoin#11562~~.
  - ~~The vcpkg for SECP256K1 has not yet been accepted by Microsoft. The files are available from this [PR](microsoft/vcpkg#2005) and should be copied into a vcpkg/ports/secp256k1 directory prior to vcpkg install steps.~~

  **Update:** For anyone wishing to test out the Visual Studio build with the various open pull requests the steps are:

  - Clone and build [Vcpkg](https://github.com/Microsoft/vcpkg) (Microsoft's new open source C/C++ package manager)
      - git clone https://github.com/Microsoft/vcpkg
      - .\bootstrap-vcpkg.bat
  - Set up Visual Studio to automatically reference vcpkg installs: .\vcpkg integrate install
  - Install the required packages (replace x86 with x64 as required):
      - vcpkg install boost:x86-windows-static
      - vcpkg install libevent:x86-windows-static
      - vcpkg install openssl:x86-windows-static
      - vcpkg install zeromq:x86-windows-static
      - vcpkg install berkeleydb:x86-windows-static
      - vcpkg install secp256k1:x86-windows-static
      - vcpkg install leveldb:x86-windows-static
  - git clone https://github.com/bitcoin/bitcoin.git
  - git checkout -b testbuild
  - git pull origin pull/11526/head # Visual Studio build configuration for Bitcoin Core
  - ~~git pull origin pull/11558/head # Minimal code changes to allow msvc compilation~~
  - ~~git pull origin pull/11562/head # bench: use std::chrono rather than gettimeofday~~
  - ~~Copy and unzip attached bitcoin-config.h to src/config, edit as required [bitcoin-config.zip](https://github.com/bitcoin/bitcoin/files/1429484/bitcoin-config.zip)~~
  - ~~git pull origin pull/13031/head # gmtime fix for msvc~~
  - Build the Visual Studio solution which, if successful, will result in all but the Qt dependent libraries/programs being built. If the build fails please add a comment.

Tree-SHA512: 5cd17273d33a09c35d8534c9f49123dec60ec05383669c67674b2cac88ada177bf94d7731c2a827759444f18d4b67085b91b02458124d0c32ab3a8f72ba5dac9
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants