cmake, msvc: Allow to build for default x64-windows triplet#104
Conversation
|
Friendly ping @sipsorcery :) |
|
Not sure about the exact reason of |
|
@hebasto what's the reason to use the vcpkg x64-windows triplet? Last time I checked all the Bitcoin Core exe's were statically linked to the CRT and therefore won't work with the /MD flag (dynamically link against the runtime library) that the x64-windows will produce. |
The main reason is to minimize vcpkg dependencies as some packages for
Binaries with |
Is that only done for CI purposes? Or is the idea to use dynamic runtime linking for Bitcoin Core exes built with msvc and cmake? If it's just for CI it seems a bit unusual to do the build being tested differently to the main build. |
The idea is to suggest a choice to the user :) |
OK, makes sense. Have you been able to do a dynamically linked build of the Gui with Qt? That was always the trickiest one. It would actually be very handy to be able to use a non-static Qt build since they can be downloaded from Qt whereas static ones have to be custom built. I'd assumed that whole Qt static plugin situation meant I had to be a statically linked build but maybe not? |
Yes. Here is an excerpt from the |
I've submitted a bug report upstream. |
Use `/MD` flag when building for the `x64-windows` triplet.
Add a workaround for microsoft/vcpkg#36955.
Allow to build for default `x64-windows` triplet. This change effectively renames the current preset "vs2022" to "vs2022-static", which affects the "Win64 native" CI job.
8233237 to
2d80505
Compare
Build all vcpkg triplets in the matrix.
2d80505 to
41322c1
Compare
|
Rebased and undrafted. CI builds both cc @sipsorcery |
| #include <sys/auxv.h> | ||
| #endif | ||
|
|
||
| #ifndef _MSC_VER |
There was a problem hiding this comment.
The extern char** environ; declaration is not necessary when compiling with MSVC, and it causes warning C4273 "inconsistent dll linkage".
There was a problem hiding this comment.
Maybe fix / workaround the warning, rather than adding more #ifdefs to our RNG code?
There was a problem hiding this comment.
|
Where do I specify the triplet when doing the cmake build? Any chance you could update your previous instructions? FWIW I've kicked off the build and it's defaulting to x64-windows. If it works it will be the first time I've ever built a dynamically linked Bitcoin Core exe. |
Specifying a preset is enough. Use
Thanks for a reminder! Updated. |
|
tACK #41322c1732ae3d02fee0489342e9fb031092dd2b (correct commit, I started the build prior to the follow on commits). First time I've ever done a non-static msvc build. All the exe's seem to work although load noticeably slower than the static build, which is not surprising. |
The
x64-windowstriplet is the default one when building on Windows. All dependencies are linked dynamically, which is similar to how they are linked on POSIX systems (Linux, macOS) when building without depends.CI builds both
x64-windowsandx64-windows-statictriplets. Additionallydumpbin /importsoutput is provided for thebitcoind.exebinaries to observe the triplet effect.