diff options
author | fanquake <fanquake@gmail.com> | 2023-04-06 09:29:47 +0100 |
---|---|---|
committer | fanquake <fanquake@gmail.com> | 2023-04-06 09:36:45 +0100 |
commit | 06fb95b51bf660c60a2fe80895d7f00290bd9d4b (patch) | |
tree | 8eed2c164a95db49cef058ce9f73cf6f3c64ae53 | |
parent | 04595484d97100a50c146e5fc080319d9e0f5ca4 (diff) | |
parent | 6a9a4d13b2b22632e0acd4f86f7bac238294ba42 (diff) |
Merge bitcoin/bitcoin#27335: Fixes compile errors in MSVC build #27332
6a9a4d13b2b22632e0acd4f86f7bac238294ba42 Fixes compile errors in MSVC build #27332 (Ethan Heilman)
Pull request description:
This PR is designed to address the issue https://github.com/bitcoin/bitcoin/issues/27332. The MSVC build is failing because of two bugs in how the build is configured.
The issue
====
When running `msbuild build_msvc\bitcoin.sln -property:Configuration=Release -maxCpuCount -verbosity:minima`l the build fails with following two errors.
* `C:\Users\e0\Documents\GitHub\bitcoin\src\httpserver.cpp(637,9): error C2664: 'void evhttp_connection_get_peer(evhttp_connection *,const char **,uint16_t *)': cannot convert argument 2 from 'char **' to 'const char **' [C:\Users\e0\Documents\GitHub\bitcoin\build_msvc\libbitcoin_node\libbitcoin_node .vcxproj]`
This error is occurs because bitcoin is using the wrong function signature for `evhttp_connection_get_peer` in libevent. In automake builds, configure.ac inspects the version of libevent it is building against and then defines `HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR` to flag the source code to use the correct signature. In MSVC build there does not appear to be a mechanism to do this. So it uses the wrong signature and fails. See the PR https://github.com/bitcoin/bitcoin/pull/23607 for when this logic was added to automake builds.
* `event.lib(evutil_rand.c.obj) : error LNK2019: unresolved external symbol BCryptGenRandom referenced in function arc4_seed [C:\Users\e0\Documents\GitHub\bitcoin\build_msvc\bitcoin-cli\bitcoin-cli.vcxproj]
C:\Users\e0\Documents\GitHub\bitcoin\build_msvc\x64\Release\bitcoin-cli.exe : fatal error LNK1120: 1 unresolved externals [C:\Users\e0\Documents\GitHub\bitcoin\build_msvc\bitcoin-cli\bitcoin-cli.vcxproj]`
This error is caused by msbuild not being able to find the library bcrypt.lib because it has not been configured to use bcrypt.lib.
Fixes
====
While for automake builds a macro is being define to configure the current function signature for `evhttp_connection_get_peer` in libevent, this macro is not being defined for MSVC builds.
1. This PR addresses this issue by assuming more recent version of libevent is installed and always defining `HAVE_EVHTTP_CONNECTION_GET_PEER_CONST_CHAR`. This logic is more brittle the automake logic, but someone following the MSVC build instructions should only get the more recent version of libevent.
2. This PR fixes the bcrypt.lib errors this by setting this library as a dependency in build_msvc/common.init.vcxproj.in.
ACKs for top commit:
hebasto:
re-ACK 6a9a4d13b2b22632e0acd4f86f7bac238294ba42
Tree-SHA512: 69d2cb6a62ecca976540a39e5f83a4e5386d920a564761cedc5127d82e5fa66ced7fcde3e5e5eb3bd6cde1cc78f843e94aa2789f02bd3e3414118030017d0387
-rw-r--r-- | build_msvc/vcpkg.json | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/build_msvc/vcpkg.json b/build_msvc/vcpkg.json index 86773d1fd3..3557269be0 100644 --- a/build_msvc/vcpkg.json +++ b/build_msvc/vcpkg.json @@ -13,5 +13,12 @@ "features": ["thread"] }, "zeromq" + ], + "builtin-baseline": "f14984af3738e69f197bf0e647a8dca12de92996", + "overrides": [ + { + "name": "libevent", + "version": "2.1.12#7" + } ] } |