[llvm-dev] build llvm fails under win7 x64/VS2017

Reid Kleckner via llvm-dev llvm-dev at lists.llvm.org
Mon Sep 17 10:32:22 PDT 2018


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.

On Mon, Sep 17, 2018 at 7:04 AM Dennis Luehring via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> i've read the following on https://llvm.org/docs/CMake.html
> ....
> BUILD_SHARED_LIBS is only recommended for use by LLVM developers.
> If you want to build LLVM as a shared library, you should use the
> LLVM_BUILD_LLVM_DYLIB option.
> ....
>
> replacing BUILD_SHARED_LIBS with LLVM_LINK_LLVM_DYLIB fixed my build
> problems
>
> my new build-config:
>
> cmake -Thost=x64 -G "Visual Studio 15 2017 Win64"
> -DLLVM_TARGETS_TO_BUILD=host -DLLVM_INCLUDE_EXAMPLES=OFF
> -DLLVM_INCLUDE_TESTS=OFF -DLLVM_INCLUDE_DOCS=OFF
> -DLLVM_INCLUDE_TOOLS=OFF -DLLVM_BUILD_LLVM_DYLIB=ON ../llvm
>
> using BUILD_SHARED_LIBS with this config fails very early - is that
> intended behavior or a config bug?
>
> the next thing i try is to use Ninja on my Win7x64/VS2017 - hope that
> reduces the build-times (currently 1.5h for an full static build - but
> im using an old pc)
>
>
>
> Am 17.09.2018 um 10:30 schrieb Dennis Luehring via llvm-dev:
> > my build environment:
> >
> > Win7 x64
> > VStudio 2017 Community Edition 15.8.4 (latest)
> > CMake 3.12.1 (x86)
> > git 2.19.0 (latest, x64)
> > Python 2.7.2 (x86)
> >
> > my build steps:
> >
> > open VS2017 x64 developer command prompt
> > cd D:\projects\fun\jit_tests
> > mkdir llvm
> > cd llvm
> > git clone https://github.com/llvm-mirror/llvm
> > mkdir llvm-build
> > cd llvm-build
> > cmake -G "Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=ON
> > -DLLVM_TARGETS_TO_BUILD=host -DLLVM_ENABLE_WARNINGS=OFF
> > -DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
> > -DLLVM_INCLUDE_DOCS=OFF ../llvm
> > cmake --build .
> >
> > produces these errors and warnings while building
> >
> > CMake Warning at CMakeLists.txt:29 (message):
> >     Visual Studio generators use the x86 host compiler by default, even
> for
> >     64-bit targets.  This can result in linker instability and out of
> memory
> >     errors.  To use the 64-bit host compiler, pass -Thost=x64 on the
> CMake
> >     command line.
> > ...
> > CMake Warning (dev) at utils/benchmark/CMakeLists.txt:3 (project):
> >     Policy CMP0048 is not set: project() command manages VERSION
> variables.
> >     Run "cmake --help-policy CMP0048" for policy details.  Use the
> > cmake_policy
> >     command to set the policy and suppress this warning.
> > -----> seems related to https://bugs.llvm.org/show_bug.cgi?id=38874
> > ...
> > CMake Warning at utils/benchmark/CMakeLists.txt:234 (message):
> >     Using std::regex with exceptions disabled is not fully supported
> >
> > and later some linker errors
> >
> > LINK : fatal error LNK1104: cannot open file
> > '..\..\Debug\lib\LLVMDemangle.lib'
> >
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\lib\Support\LLVMSupport.vcxproj]
> > ...
> > LINK : fatal error LNK1104: cannot open file
> > '..\..\..\lib\Debug\benchmark.lib'
> >
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\utils\benchmark\src\benchmark_main.vcxproj]
> > ...
> > LINK : fatal error LNK1104: cannot open file
> > '..\..\Debug\lib\LLVMDemangle.lib'
> >
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\lib\Support\LLVMSupport.vcxproj]
> > ...
> > LINK : fatal error LNK1104: cannot open file
> > '..\..\..\lib\Debug\benchmark.lib'
> >
> [D:\projects\fun\jit_tests\llvm40\llvm40-build\utils\benchmark\src\benchmark_main.vcxproj]
> >
> > i also tried to build LLVM 4 and 6 on a clean cloned version
> > git checkout -b release_40
> > git checkout -b release_60
> >
> > producing the very same warnings/errors and the build breaks
> >
> > in the end i've got 1 lib and 2 dlls - not what i've expected :)
> >
> >
> > any ideas?
> >
> >
> >
> > _______________________________________________
> > LLVM Developers mailing list
> > llvm-dev at lists.llvm.org
> > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
>
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180917/46e63dfc/attachment.html>


More information about the llvm-dev mailing list