<div dir="ltr">BUILD_SHARED_LIBS is definitely not supported with MSVC. I'm not even confident that LLVM_BUILD_LLVM_DYLIB will work well, despite various people's attempts to make it work. I would recommend static linking first, and then move on to the much harder problem of building a DLL that exports what you want.</div><br><div class="gmail_quote"><div dir="ltr">On Mon, Sep 17, 2018 at 7:04 AM Dennis Luehring via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">i've read the following on <a href="https://llvm.org/docs/CMake.html" rel="noreferrer" target="_blank">https://llvm.org/docs/CMake.html</a><br>
....<br>
BUILD_SHARED_LIBS is only recommended for use by LLVM developers.<br>
If you want to build LLVM as a shared library, you should use the <br>
LLVM_BUILD_LLVM_DYLIB option.<br>
....<br>
<br>
replacing BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB fixed my build <br>
problems<br>
<br>
my new build-config:<br>
<br>
cmake -Thost=x64 -G "Visual Studio 15 2017 Win64" <br>
-DLLVM_TARGETS_TO_BUILD=host -DLLVM_INCLUDE_EXAMPLES=OFF <br>
-DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_DOCS=OFF <br>
-DLLVM_INCLUDE_TOOLS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON ../llvm<br>
<br>
using BUILD_SHARED_LIBS with this config fails very early - is that <br>
intended behavior or a config bug?<br>
<br>
the next thing i try is to use Ninja on my Win7x64/VS2017 - hope that <br>
reduces the build-times (currently 1.5h for an full static build - but <br>
im using an old pc)<br>
<br>
<br>
<br>
Am 17.09.2018 um 10:30 schrieb Dennis Luehring via llvm-dev:<br>
> my build environment:<br>
><br>
> Win7 x64<br>
> VStudio 2017 Community Edition 15.8.4 (latest)<br>
> CMake 3.12.1 (x86)<br>
> git 2.19.0 (latest, x64)<br>
> Python 2.7.2 (x86)<br>
><br>
> my build steps:<br>
><br>
> open VS2017 x64 developer command prompt<br>
> cd D:\projects\fun\jit_tests<br>
> mkdir llvm<br>
> cd llvm<br>
> git clone <a href="https://github.com/llvm-mirror/llvm" rel="noreferrer" target="_blank">https://github.com/llvm-mirror/llvm</a><br>
> mkdir llvm-build<br>
> cd llvm-build<br>
> cmake -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=ON<br>
> -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_WARNINGS=OFF<br>
> -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF<br>
> -DLLVM_INCLUDE_DOCS=OFF ../llvm<br>
> cmake --build .<br>
><br>
> produces these errors and warnings while building<br>
><br>
> CMake Warning at CMakeLists.txt:29 (message):<br>
>     Visual Studio generators use the x86 host compiler by default, even for<br>
>     64-bit targets.  This can result in linker instability and out of memory<br>
>     errors.  To use the 64-bit host compiler, pass -Thost=x64 on the CMake<br>
>     command line.<br>
> ...<br>
> CMake Warning (dev) at utils/benchmark/CMakeLists.txt:3 (project):<br>
>     Policy CMP0048 is not set: project() command manages VERSION variables.<br>
>     Run "cmake --help-policy CMP0048" for policy details.  Use the<br>
> cmake_policy<br>
>     command to set the policy and suppress this warning.<br>
> -----> seems related to <a href="https://bugs.llvm.org/show_bug.cgi?id=38874" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_bug.cgi?id=38874</a><br>
> ...<br>
> CMake Warning at utils/benchmark/CMakeLists.txt:234 (message):<br>
>     Using std::regex with exceptions disabled is not fully supported<br>
><br>
> and later some linker errors<br>
><br>
> LINK : fatal error LNK1104: cannot open file<br>
> '..\..\Debug\lib\LLVMDemangle.lib'<br>
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\lib\Support\LLVMSupport.vcxproj]<br>
> ...<br>
> LINK : fatal error LNK1104: cannot open file<br>
> '..\..\..\lib\Debug\benchmark.lib'<br>
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\utils\benchmark\src\benchmark_main.vcxproj]<br>
> ...<br>
> LINK : fatal error LNK1104: cannot open file<br>
> '..\..\Debug\lib\LLVMDemangle.lib'<br>
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\lib\Support\LLVMSupport.vcxproj]<br>
> ...<br>
> LINK : fatal error LNK1104: cannot open file<br>
> '..\..\..\lib\Debug\benchmark.lib'<br>
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\utils\benchmark\src\benchmark_main.vcxproj]<br>
><br>
> i also tried to build LLVM 4 and 6 on a clean cloned version<br>
> git checkout -b release_40<br>
> git checkout -b release_60<br>
><br>
> producing the very same warnings/errors and the build breaks<br>
><br>
> in the end i've got 1 lib and 2 dlls - not what i've expected :)<br>
><br>
><br>
> any ideas?<br>
><br>
><br>
><br>
> _______________________________________________<br>
> LLVM Developers mailing list<br>
> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br>
<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>