<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:737289053;
mso-list-template-ids:-1513739130;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-CA" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">You have Strawberry Perl installed, and that comes with MinGW. cmake picks up the GNU binutils inside that distribution, instead of MSVC cl.exe. Like Brian suggested, there are too many link jobs
going on, so you could re-run `ninja check-all -j 2`, but that will be slower to build.<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If you want to build the first stage with MSVC, <span style="mso-fareast-language:EN-US">
do this (because cmake doesn’t like backslashes):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="text-indent:36.0pt"><span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project>
</span><span style="font-size:9.0pt;font-family:"Courier New";mso-fareast-language:EN-US">set VS2017=%VCToolsInstallDir:\=/%</span><span style="mso-fareast-language:EN-US"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US">And the re-run cmake, telling it explicitly which compiler it should use (similar to what you’ll do for the second stage):<o:p></o:p></span></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:36.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build1> cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS="llvm;clang;lld"
<span style="background:yellow;mso-highlight:yellow">-DCMAKE_C_COMPILER="%VS2017%/bin/HostX64/x64/cl.EXE" -DCMAKE_CXX_COMPILER="%VS2017%/bin/HostX64/x64/cl.EXE" -DCMAKE_LINKER="%VS2017%/bin/HostX64/x64/link.EXE"</span></span><o:p></o:p></p>
<p class="MsoNormal"><span style="mso-fareast-language:EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="FR">De :</span></b><span lang="FR"> llvm-dev <llvm-dev-bounces@lists.llvm.org>
<b>De la part de</b> blackthirt33n . via llvm-dev<br>
<b>Envoyé :</b> April 12, 2020 6:59 PM<br>
<b>À :</b> llvm-dev@lists.llvm.org<br>
<b>Objet :</b> Re: [llvm-dev] using the bat script build_llvm_package.bat on windows<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">after following the instructions for <span style="font-size:9.0pt;font-family:"Courier New"">
ninja check-all:</span><o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">FAILED: bin/libclang.dll lib/liblibclang.dll.a<br>
cmd.exe /C "cd . && C:\Strawberry\c\bin\c++.exe -Wa,-mbig-obj -Werror=date-time<br>
-Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-fi<br>
eld-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-unin<br>
itialized -Wno-class-memaccess -Wno-noexcept-type -Wdelete-non-virtual-dtor -Wno<br>
-comment -fno-common -Woverloaded-virtual -fno-strict-aliasing -O2 C:/temp/llv<br>
m-build/llvm-project/build1/tools/clang/tools/libclang/libclang.def -shared -o b<br>
in\libclang.dll -Wl,--out-implib,lib\liblibclang.dll.a -Wl,--major-image-version<br>
,11,--minor-image-version,0 @CMakeFiles\libclang.rsp && cd ."<br>
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-m<br>
ingw32/bin/ld.exe: cannot find lib/libLLVMCore.a: Too many open files<br>
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-m<br>
ingw32/bin/ld.exe: cannot find lib/libLLVMRemarks.a: Too many open files<br>
C:/Strawberry/c/bin/../lib/gcc/x86_64-w64-mingw32/8.3.0/../../../../x86_64-w64-m<br>
ingw32/bin/ld.exe: cannot find lib/libLLVMBitstreamReader.a: Too many open files<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">On Sun, Apr 12, 2020 at 1:25 PM Alexandre Ganea <<a href="mailto:alexandre.ganea@ubisoft.com" target="_blank">alexandre.ganea@ubisoft.com</a>> wrote:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">build_llvm_package.bat is only a template for building releases.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">You can use it as reference, but for a two-stage build the simplest you can do is:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<ol start="1" type="1">
<li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1">
Ensure cmake, ninja build, python, GnuWin32 are installed and available in %PATH%.<o:p></o:p></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1">
Start “x64 Native Tools Command Prompt for VS 2017” from the Start menu/Visual Studio 2017.<o:p></o:p></li><li class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1">
‘cd’ to the root of your git checkout and run:<o:p></o:p></li></ol>
<p> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project> mkdir build1 && cd build1</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build1> cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_LIBXML2=OFF -DLLVM_ENABLE_PROJECTS="llvm;clang;lld"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">(…)</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build1> ninja check-all</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">The first stage will therefore use MSVC. If the above commands succeed, you can move on to stage 2:<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build1> cd .. && mkdir build2 && cd build2</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build2> cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -DLLVM_OPTIMIZED_TABLEGEN=ON -DLLVM_ENABLE_LIBXML2=OFF -DCMAKE_C_COMPILER="../build1/bin/clang-cl.exe" -DCMAKE_CXX_COMPILER="../build1/bin/clang-cl.exe"
-DCMAKE_LINKER="../build1/bin/lld-link.exe" -DLLVM_ENABLE_LLD=ON -DCMAKE_CXX_FLAGS="-Xclang -O3" -DCMAKE_C_FLAGS="-Xclang -O3" -DLLVM_ENABLE_PROJECTS="llvm;clang;lld" -DCLANG_TABLEGEN="../build1/bin/clang-tblgen.exe" -DLLVM_TABLEGEN="../build1/bin/llvm-tblgen.exe"</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:18.0pt">
<span style="font-size:9.0pt;font-family:"Courier New"">D:\llvm-project\build2> ninja check-all</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">You should have now the binaries for the second stage in build2\bin.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">This is only an example. You can then take a look at
<a href="https://llvm.org/docs/CMake.html" target="_blank">https://llvm.org/docs/CMake.html</a> for extra cmake flags that can be used to tweak your build. You could for example use ThinLTO on the second stage, by adding -DLLVM_ENABLE_LTO=Thin. You can also
use `cmake-gui` if you don’t want to go through command-lines (ensure it points to the right build stage).<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Best,<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Alex.<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><b>De :</b> llvm-dev <<a href="mailto:llvm-dev-bounces@lists.llvm.org" target="_blank">llvm-dev-bounces@lists.llvm.org</a>>
<b>De la part de</b> blackthirt33n . via llvm-dev<br>
<b>Envoyé :</b> April 11, 2020 7:46 PM<br>
<b>À :</b> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<b>Objet :</b> [llvm-dev] using the bat script build_llvm_package.bat on windows<o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">where should the file build_llvm_package.bat be placed and how should the build_llvm_package.bat be called?<o:p></o:p></p>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">or <o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">is there a another way to do a two stage build of the llvm project on windows starting with using visual studio 2017 community.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</body>
</html>