Alexandre Ganea via llvm-dev
2019-Oct-28 12:10 UTC
[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?
Hi Osman, You can’t enable the static CRT through the command-line. You would need to apply this patch: https://reviews.llvm.org/D55056 (although it doesn’t work with lldb) Alex. ________________________________ De : llvm-dev <llvm-dev-bounces at lists.llvm.org> de la part de Osman Zakir via llvm-dev <llvm-dev at lists.llvm.org> Envoyé : 28 octobre 2019 07:47:43 À : llvm-dev at lists.llvm.org <llvm-dev at lists.llvm.org> Objet : Re: [llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions? I ran this command "cmake -S../llvm -G"Visual Studio 16 2019" -Thost=x64 -DCMAKE_INSTALL_PREFIX=../install -DCMAKE_BUILD_TYPE=Release -DCMAKE_MSVC_RUNTIME_LIBRARY=MT -DCMAKE_CXX_FLAGS="/permissive- /EHsc /std:c++17 /O2 /MT /D_SILENCE_ALL_CXX_DEPRECATION_WARNINGS" -DLLVM_ENABLE_RTTI=On -DLLVM_ENABLE_EH=ON -DCMAKE_CXX_STANDARD=17 -DPYTHON_HOME=C:/Users/Osman/AppData/Local/Programs/Python/Python38 -DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lld;lldb;libcxx;libcxxabi"". But I still get "Using Release VC++ CRT: MD", and also the CMake warning: "CMake Warning at utils/benchmark/CMakeLists.txt:244 (message): Using std::regex with exceptions disabled is not fully supported". Please help. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/a8032fb5/attachment-0001.html>
Osman Zakir via llvm-dev
2019-Oct-28 12:18 UTC
[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?
Okay, thanks. So how do I apply the patch? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/0abc532a/attachment.html>
Osman Zakir via llvm-dev
2019-Oct-28 14:37 UTC
[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?
I would really like to know about how to apply the patch for making MSVC-built LLVM executables lighter. But aside from that, I also want to know what LLVM does to CMake's default setting of /EHsc. I want to keep that setting on, but I can't figure out how. Any help is appreciated. Thanks in advance. P.S. The CMAKE_CXX_FLAGS variable isn't helping at all, otherwise I wouldn't be asking this. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/8c4f73ed/attachment.html>
Reid Kleckner via llvm-dev
2019-Oct-28 20:13 UTC
[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?
On Mon, Oct 28, 2019 at 5:11 AM Alexandre Ganea via llvm-dev < llvm-dev at lists.llvm.org> wrote:> You can’t enable the static CRT through the command-line. You would need > to apply this patch: https://reviews.llvm.org/D55056 > (although it doesn’t work with lldb) >Are you sure? I would expect `cmake -DLLVM_USE_CRT_RELEASE=MT` to use the static CRT. I think Zach is correct, Osman can use -DLLVM_ENABLE_EH=ON, and it will enable exceptions. You're still getting a warning from the benchmark library because LLVM's cmake forcibly disables benchmark library exceptions here: https://github.com/llvm/llvm-project/blob/2724d9e/llvm/CMakeLists.txt#L1094 That's probably a bug, it should probably be dependent on LLVM_ENABLE_EH. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/9b404667/attachment.html>
Alexandre Ganea via llvm-dev
2019-Oct-28 20:36 UTC
[llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions?
Yes you’re right, -DLLVM_USE_CRT_RELEASE=MT works indeed! Although the “Visual Studio” cmake generators are multi-config, so you end up with -DCMAKE_BUILD_TYPE=Release being ignored, which means that if you want to make things right, you would need to also set the other –DLLVM_USE_CRT_XXX values as well, to avoid surprises when switching targets inside VS. For those multi-config generators, reintroducing -DLLVM_USE_CRT would be nice, maybe. De : Reid Kleckner <rnk at google.com> Envoyé : October 28, 2019 4:13 PM À : Alexandre Ganea <alexandre.ganea at ubisoft.com> Cc : Osman Zakir <osmanzakir90 at hotmail.com>; llvm-dev <llvm-dev at lists.llvm.org> Objet : Re: [llvm-dev] How to Switch to Static Runtime and Enable C++ Exceptions? On Mon, Oct 28, 2019 at 5:11 AM Alexandre Ganea via llvm-dev <llvm-dev at lists.llvm.org<mailto:llvm-dev at lists.llvm.org>> wrote: You can’t enable the static CRT through the command-line. You would need to apply this patch: https://reviews.llvm.org/D55056 (although it doesn’t work with lldb) Are you sure? I would expect `cmake -DLLVM_USE_CRT_RELEASE=MT` to use the static CRT. I think Zach is correct, Osman can use -DLLVM_ENABLE_EH=ON, and it will enable exceptions. You're still getting a warning from the benchmark library because LLVM's cmake forcibly disables benchmark library exceptions here: https://github.com/llvm/llvm-project/blob/2724d9e/llvm/CMakeLists.txt#L1094 That's probably a bug, it should probably be dependent on LLVM_ENABLE_EH. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20191028/ad061eab/attachment.html>