<div dir="ltr"><span class="gmail-im" style="font-size:12.8px"><br></span><span style="font-size:12.8px">> We haven't really tested this combination, but if you are willing to</span><br style="font-size:12.8px"><span style="font-size:12.8px">> provide some feedback (see below), I am sure we can make it work.</span><br><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Sure, I'll help.</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">> Hm, this definitely doesn't look right. Can you re-run it with --verbose 6</span><br style="font-size:12.8px"><span style="font-size:12.8px">> and send the output?</span><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px">Here it is (I skipped the first few lines of "trace: main..." because these e-mails are public... hope you don't mind):</span></div><div><span style="font-size:12.8px"><br></span></div><div><div><span style="font-size:12.8px">C:\Tests\Build2\hello\clang-6>b --verbose 6</span></div><div><span style="font-size:12.8px">...</span></div><div><span style="font-size:12.8px">trace: main: jobs: 8</span></div><div><span style="font-size:12.8px">trace: reset: resetting build state</span></div><div><span style="font-size:12.8px">trace: reset: original host: 'i386-microsoft-win32-msvc14.1'</span></div><div><span style="font-size:12.8px">trace: reset: canonical host: 'i386-microsoft-win32-msvc14.1'; class: windows</span></div><div><span style="font-size:12.8px">trace: main: buildspec:</span></div><div><span style="font-size:12.8px">trace: source: sourcing C:\Tests\Build2\hello\clang-6\build\bootstrap\src-root.build</span></div><div><span style="font-size:12.8px">trace: source: sourcing ../hello/build\bootstrap.build</span></div><div><span style="font-size:12.8px">trace: config::boot: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: source: sourcing C:\Tests\Build2\hello\clang-6\build\config.build</span></div><div><span style="font-size:12.8px">trace: install::boot: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: bootstrap_src: looking for subprojects in C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: bootstrap_src: looking for subprojects in ../hello/</span></div><div><span style="font-size:12.8px">trace: main: start meta-operation batch perform, id 2</span></div><div><span style="font-size:12.8px">trace: main: start operation batch <default>, id 1</span></div><div><span style="font-size:12.8px">trace: main: operation translated to update, id 2</span></div><div><span style="font-size:12.8px">trace: main: bootstrapped dir{}:</span></div><div><span style="font-size:12.8px">trace: main: out_base: C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: main: src_base: ../hello/</span></div><div><span style="font-size:12.8px">trace: main: out_root: C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: main: src_root: ../hello/</span></div><div><span style="font-size:12.8px">trace: main: loading dir{}</span></div><div><span style="font-size:12.8px">trace: config::init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: install::init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: source: sourcing ../hello/build\root.build</span></div><div><span style="font-size:12.8px">trace: cxx::init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: cxx::config_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: cxx::guess_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: cc::core_vars_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: cc::core_vars_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">clang++ -v</span></div><div><span style="font-size:12.8px">trace: cc::guess: clang++ is clang: 'clang version 6.0.0 (<a href="https://llvm.org/git/clang.git">https://llvm.org/git/clang.git</a> cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (<a href="https://llvm.org/git/llvm.git">https://llvm.org/git/llvm.git</a> ff7724479284555eb1d624c9e19e285408f1f45a)'</span></div><div><span style="font-size:12.8px">clang++ -dumpmachine</span></div><div><span style="font-size:12.8px">trace: cxx::guess_init: canonical target: 'x86_64-windows-msvc'; class: other</span></div><div><span style="font-size:12.8px">clang++ -print-search-dirs</span></div><div><span style="font-size:12.8px">clang++ -x c++ -v -E -</span></div><div><span style="font-size:12.8px">cxx hello@C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px"> cxx clang++@C:\LLVM\build\bin\clang++.exe</span></div><div><span style="font-size:12.8px"> id clang</span></div><div><span style="font-size:12.8px"> version 6.0.0 (<a href="https://llvm.org/git/clang.git">https://llvm.org/git/clang.git</a> cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (<a href="https://llvm.org/git/llvm.git">https://llvm.org/git/llvm.git</a> ff7724479284555eb1d624c9e19e285408f1f45a)</span></div><div><span style="font-size:12.8px"> major 6</span></div><div><span style="font-size:12.8px"> minor 0</span></div><div><span style="font-size:12.8px"> patch 0</span></div><div><span style="font-size:12.8px"> build (<a href="https://llvm.org/git/clang.git">https://llvm.org/git/clang.git</a> cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (<a href="https://llvm.org/git/llvm.git">https://llvm.org/git/llvm.git</a> ff7724479284555eb1d624c9e19e285408f1f45a)</span></div><div><span style="font-size:12.8px"> signature clang version 6.0.0 (<a href="https://llvm.org/git/clang.git">https://llvm.org/git/clang.git</a> cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (<a href="https://llvm.org/git/llvm.git">https://llvm.org/git/llvm.git</a> ff7724479284555eb1d624c9e19e285408f1f45a)</span></div><div><span style="font-size:12.8px"> checksum 1e14baef11417d52df424fd3528c580500e7d020e7ca841bbf6660cd6cc2da5e</span></div><div><span style="font-size:12.8px"> target x86_64-windows-msvc (x86_64-pc-windows-msvc)</span></div><div><span style="font-size:12.8px"> inc dirs</span></div><div><span style="font-size:12.8px"> C:\LLVM\build\lib\clang\6.0.0\include\</span></div><div><span style="font-size:12.8px"> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\</span></div><div><span style="font-size:12.8px"> C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt\</span></div><div><span style="font-size:12.8px"> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared\</span></div><div><span style="font-size:12.8px"> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\</span></div><div><span style="font-size:12.8px"> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt\</span></div><div><span style="font-size:12.8px"> lib dirs</span></div><div><span style="font-size:12.8px"> C:\LLVM\build\lib\clang\6.0.0\</span></div><div><span style="font-size:12.8px">trace: cc::core_config_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: bin::config_init: for C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px">trace: bin::config_init: canonical target: 'x86_64-windows-msvc'; class: other</span></div><div><span style="font-size:12.8px">bin hello@C:\Tests\Build2\hello\clang-6\</span></div><div><span style="font-size:12.8px"> target x86_64-windows-msvc</span></div><div><span style="font-size:12.8px">../hello/build\root.build:1:7: error: cc and bin module target mismatch</span></div><div><span style="font-size:12.8px"> info: cc.target is x86_64-windows-msvc</span></div><div><span style="font-size:12.8px"> info: bin.target is x86_64-windows-msvc</span></div><div><span style="font-size:12.8px">info: scheduler statistics:</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> thread_max_active 8</span></div><div><span style="font-size:12.8px"> thread_max_total 64</span></div><div><span style="font-size:12.8px"> thread_helpers 0</span></div><div><span style="font-size:12.8px"> thread_max_waiting 0</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> task_queue_depth 32</span></div><div><span style="font-size:12.8px"> task_queue_full 0</span></div><div><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"> wait_queue_slots 31</span></div><div><span style="font-size:12.8px"> wait_queue_collisions 0</span></div><div style="font-size:12.8px"><br></div></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><span style="font-size:12.8px">> In this light, do you know if there is a way to query Clang for</span><br style="font-size:12.8px"><span style="font-size:12.8px">> the MSVC runtime it is using? I guess we could get it from the</span><br style="font-size:12.8px"><span style="font-size:12.8px">> '...\MSVC\14.11.25503\include' bit of the include path but that</span><br style="font-size:12.8px"><span style="font-size:12.8px">> feels rather hackish.</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">I don't know a way to query that, but will look into it.</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">> When you use Clang, are you expected to run it from the corresponding</span><br></div><div style="font-size:12.8px"><span style="font-size:12.8px">> MSVC development command prompt (where the PATH is already set to</span><br style="font-size:12.8px"><span style="font-size:12.8px">> include the correct variants of these tools)?</span><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">Actually no. I can run Clang (and build2) from a normal command line prompt. Of course I can also run from a Visual Studio Command Prompt, but that gives me the same result. </span><span style="font-size:12.8px">Clang searches for the MSVC environment variables by itself, see:</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div><span style="font-size:12.8px"><a href="https://github.com/llvm-mirror/clang/blob/master/lib/Driver/ToolChains/MSVC.cpp">https://github.com/llvm-mirror/clang/blob/master/lib/Driver/ToolChains/MSVC.cpp</a></span><br></div><div><br></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">> Also, can you show the output of this command:</span><br style="font-size:12.8px"><span style="font-size:12.8px">> clang -print-search-dirs</span><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px">Here it is:</span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><div style="font-size:12.8px">C:\Tests\Build2\hello\clang-6>clang -print-search-dirs</div><div style="font-size:12.8px">programs: =C:\LLVM\build\bin</div><div style="font-size:12.8px">libraries: =C:\LLVM\build\lib\clang\6.0.0</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">The result is the same from either a normal command prompt of from a Visual Studio Command Prompt.</div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px"><br></div><div style="font-size:12.8px">Regards,</div><div style="font-size:12.8px">Jack</div></span></div><div style="font-size:12.8px"><span style="font-size:12.8px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 4, 2017 at 10:41 AM, Boris Kolpackov <span dir="ltr"><<a href="mailto:boris@codesynthesis.com" target="_blank">boris@codesynthesis.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Username I Wanted Was Already Taken <<a href="mailto:usernameiwantedwasalreadytaken@gmail.com">usernameiwantedwasalreadytake<wbr>n@gmail.com</a>> writes:<br>
<br>
> First of all thanks for the great work with Build2. I'm starting using it,<br>
> but it seems a great tool.<br>
<br>
</span>Thanks, I am glad you like it so far!<br>
<span class=""><br>
<br>
> I am trying to compile a simple hello sample on windows. I have MSVC<br>
> Community 2017 and Clang 6 (built from source) installed.<br>
<br>
</span>We haven't really tested this combination, but if you are willing to<br>
provide some feedback (see below), I am sure we can make it work.<br>
<span class=""><br>
<br>
> C:\Tests\Build2\hello\clang-6><wbr>b<br>
> ../hello/build\root.build:3:7: error: cc and bin module target mismatch<br>
> info: cc.target is x86_64-windows-msvc<br>
> info: bin.target is x86_64-windows-msvc<br>
<br>
</span>Hm, this definitely doesn't look right. Can you re-run it with --verbose 6<br>
and send the output?<br>
<span class=""><br>
<br>
> target x86_64-windows-msvc (x86_64-pc-windows-msvc)<br>
> inc dirs<br>
> C:\LLVM\build\lib\clang\6.0.0\<wbr>include\<br>
> C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\<wbr>Tools\MSVC\14.11.25503\<wbr>include\<br>
> C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\<wbr>ucrt\<br>
> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\<wbr>shared\<br>
> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\<wbr>um\<br>
> C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\<wbr>winrt\<br>
<br>
</span>This is interesting, thanks for sending it. To support Clang with the<br>
MSVC target I can see two immediate things that we will need to do:<br>
<br>
1. We will need to remap Clang's 'x86_64-pc-windows-msvc' to build2's<br>
more precise 'x86_64-microsoft-win32-<wbr>msvcNN.N' where NN.N is the<br>
MSVC runtime version.<br>
<br>
In this light, do you know if there is a way to query Clang for<br>
the MSVC runtime it is using? I guess we could get it from the<br>
'...\MSVC\14.11.25503\include' bit of the include path but that<br>
feels rather hackish.<br>
<br>
2. We will need to find the rest of the toolchain (link.exe, rc.exe,<br>
mt.exe, etc).<br>
<br>
When you use Clang, are you expected to run it from the corresponding<br>
MSVC development command prompt (where the PATH is already set to<br>
include the correct variants of these tools)?<br>
<br>
Also, can you show the output of this command:<br>
<br>
clang -print-search-dirs<br>
<br>
Thanks,<br>
Boris<br>
</blockquote></div><br></div>