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
Build on Windows using VS 2019 + LLVM/Clang #4258
Conversation
- renamed variable so as not to use a reserved keyword.
- fix compile error requiring first arg of main() to be of type int
- pass result of c_str() instead
…X to fix various macro expansions issues - NOMINMAX to fix confusion between std::max(..) and max(..) macro redefinition - BOOST_USE_WINDOWS_H to prevent boost from redefining win32 APIs - WIN32_LEAN_AND_MEAN to fix include ordering issues with winsock.h
@fdb-build test this please |
…unpack in Debug build - defined twice in FileBackupAgent.actor.cpp and BackupAgent.actor.h - only fails when building in Debug ?
I found a new issue with template duplication when building for Debug, that does happen in Release (why??) I have to move the definition of |
I looked at the template change you made and I don't quite understand why this would cause problems (though having this code duplicated across two compilation units seems bad style). But the change imho improves on the previous state. |
I'm tracking two issues with
Anyway, before I spend too much time on this, does this |
I am merging this -- I believe that everything that doesn't work now didn't work before, so this PR is already a strict improvement (it also helps my work on the docker stuff). For the two problems:
|
As talked in https://forums.foundationdb.org/t/looking-for-community-support-for-the-windows-build/2531, this PR attempts to build on Windows using Clang-CL instead of MSVC.
DISCLAIMER: I'm not a C++ developer, and I'm not familiar at all with clang/cl, and only tested on Windows. Please review the changes and tell me if I'm doing something stupid/broke other platforms!
Required dependencies to build (ie: what's installed on my machine)
This PR is based on the 6.3 branch
I run CMAKE with the following arguments:
-T"ClangCL"
switches from MSVC to clang-cl-A x64
ensures that the 64-bit platform toolset is selected, so that clang-cl.exe does not run out of address space when reticulating splines^Hc++ templates-DCMAKE_BUILD_TYPE=Release
? doc told me to add it, never tried without...note: adding -DOPEN_FOR_IDE currently breaks the build for me!
Then I build with the following arguments:
/p:UseMultiToolTask=true
helps reduce the build time from more than one hour to about 5 minutes./p:CL_MPCount=XX
helps me tune the max number of cores used during the build. ReplaceXX
with the max number of logical threads of your cpu minus 1 or 2 to keep your host usable during the build...I tried installing the resulting MSI package and got it to start the service and fdbcli was able to connect to it.