[build2] Using build2 with clang 6 (trunk) on windows

Username I Wanted Was Already Taken usernameiwantedwasalreadytaken at gmail.com
Mon Dec 4 13:08:53 UTC 2017


> We haven't really tested this combination, but if you are willing to
> provide some feedback (see below), I am sure we can make it work.

Sure, I'll help.

> Hm, this definitely doesn't look right. Can you re-run it with --verbose 6
> and send the output?

Here it is (I skipped the first few lines of "trace: main..." because these
e-mails are public... hope you don't mind):

C:\Tests\Build2\hello\clang-6>b --verbose 6
...
trace: main: jobs: 8
trace: reset: resetting build state
trace: reset: original host: 'i386-microsoft-win32-msvc14.1'
trace: reset: canonical host: 'i386-microsoft-win32-msvc14.1'; class:
windows
trace: main: buildspec:
trace: source: sourcing
C:\Tests\Build2\hello\clang-6\build\bootstrap\src-root.build
trace: source: sourcing ../hello/build\bootstrap.build
trace: config::boot: for C:\Tests\Build2\hello\clang-6\
trace: source: sourcing C:\Tests\Build2\hello\clang-6\build\config.build
trace: install::boot: for C:\Tests\Build2\hello\clang-6\
trace: bootstrap_src: looking for subprojects in
C:\Tests\Build2\hello\clang-6\
trace: bootstrap_src: looking for subprojects in ../hello/
trace: main: start meta-operation batch perform, id 2
trace: main: start operation batch <default>, id 1
trace: main: operation translated to update, id 2
trace: main: bootstrapped dir{}:
trace: main:   out_base:  C:\Tests\Build2\hello\clang-6\
trace: main:   src_base:  ../hello/
trace: main:   out_root:  C:\Tests\Build2\hello\clang-6\
trace: main:   src_root:  ../hello/
trace: main: loading dir{}
trace: config::init: for C:\Tests\Build2\hello\clang-6\
trace: install::init: for C:\Tests\Build2\hello\clang-6\
trace: source: sourcing ../hello/build\root.build
trace: cxx::init: for C:\Tests\Build2\hello\clang-6\
trace: cxx::config_init: for C:\Tests\Build2\hello\clang-6\
trace: cxx::guess_init: for C:\Tests\Build2\hello\clang-6\
trace: cc::core_vars_init: for C:\Tests\Build2\hello\clang-6\
trace: cc::core_vars_init: for C:\Tests\Build2\hello\clang-6\
clang++ -v
trace: cc::guess: clang++ is clang: 'clang version 6.0.0 (
https://llvm.org/git/clang.git cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (
https://llvm.org/git/llvm.git ff7724479284555eb1d624c9e19e285408f1f45a)'
clang++ -dumpmachine
trace: cxx::guess_init: canonical target: 'x86_64-windows-msvc'; class:
other
clang++ -print-search-dirs
clang++ -x c++ -v -E -
cxx hello at C:\Tests\Build2\hello\clang-6\
  cxx        clang++ at C:\LLVM\build\bin\clang++.exe
  id         clang
  version    6.0.0 (https://llvm.org/git/clang.git
cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (https://llvm.org/git/llvm.git
ff7724479284555eb1d624c9e19e285408f1f45a)
  major      6
  minor      0
  patch      0
  build      (https://llvm.org/git/clang.git
cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (https://llvm.org/git/llvm.git
ff7724479284555eb1d624c9e19e285408f1f45a)
  signature  clang version 6.0.0 (https://llvm.org/git/clang.git
cc7a941bdff8c4f38c2bdaa94b6136b1a8f97afa) (https://llvm.org/git/llvm.git
ff7724479284555eb1d624c9e19e285408f1f45a)
  checksum
 1e14baef11417d52df424fd3528c580500e7d020e7ca841bbf6660cd6cc2da5e
  target     x86_64-windows-msvc (x86_64-pc-windows-msvc)
  inc dirs
    C:\LLVM\build\lib\clang\6.0.0\include\
    C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.11.25503\include\
    C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt\
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared\
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\
    C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt\
  lib dirs
    C:\LLVM\build\lib\clang\6.0.0\
trace: cc::core_config_init: for C:\Tests\Build2\hello\clang-6\
trace: bin::config_init: for C:\Tests\Build2\hello\clang-6\
trace: bin::config_init: canonical target: 'x86_64-windows-msvc'; class:
other
bin hello at C:\Tests\Build2\hello\clang-6\
  target     x86_64-windows-msvc
../hello/build\root.build:1:7: error: cc and bin module target mismatch
  info: cc.target is x86_64-windows-msvc
  info: bin.target is x86_64-windows-msvc
info: scheduler statistics:

  thread_max_active      8
  thread_max_total       64
  thread_helpers         0
  thread_max_waiting     0

  task_queue_depth       32
  task_queue_full        0

  wait_queue_slots       31
  wait_queue_collisions  0



>   In this light, do you know if there is a way to query Clang for
>   the MSVC runtime it is using? I guess we could get it from the
>   '...\MSVC\14.11.25503\include' bit of the include path but that
>   feels rather hackish.

I don't know a way to query that, but will look into it.


>   When you use Clang, are you expected to run it from the corresponding
>   MSVC development command prompt (where the PATH is already set to
>   include the correct variants of these tools)?

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. Clang searches for the MSVC environment
variables by itself, see:

https://github.com/llvm-mirror/clang/blob/master/lib/Driver/ToolChains/MSVC.cpp


>   Also, can you show the output of this command:
>   clang -print-search-dirs

Here it is:

C:\Tests\Build2\hello\clang-6>clang -print-search-dirs
programs: =C:\LLVM\build\bin
libraries: =C:\LLVM\build\lib\clang\6.0.0

The result is the same from either a normal command prompt of from a Visual
Studio Command Prompt.


Regards,
Jack


On Mon, Dec 4, 2017 at 10:41 AM, Boris Kolpackov <boris at codesynthesis.com>
wrote:

> Username I Wanted Was Already Taken <usernameiwantedwasalreadytake
> n at gmail.com> writes:
>
> > First of all thanks for the great work with Build2. I'm starting using
> it,
> > but it seems a great tool.
>
> Thanks, I am glad you like it so far!
>
>
> > I am trying to compile a simple hello sample on windows. I have MSVC
> > Community 2017 and Clang 6 (built from source) installed.
>
> We haven't really tested this combination, but if you are willing to
> provide some feedback (see below), I am sure we can make it work.
>
>
> > C:\Tests\Build2\hello\clang-6>b
> > ../hello/build\root.build:3:7: error: cc and bin module target mismatch
> >   info: cc.target is x86_64-windows-msvc
> >   info: bin.target is x86_64-windows-msvc
>
> Hm, this definitely doesn't look right. Can you re-run it with --verbose 6
> and send the output?
>
>
> >   target     x86_64-windows-msvc (x86_64-pc-windows-msvc)
> >   inc dirs
> >     C:\LLVM\build\lib\clang\6.0.0\include\
> >     C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\
> Tools\MSVC\14.11.25503\include\
> >     C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0\ucrt\
> >     C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\shared\
> >     C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\um\
> >     C:\Program Files (x86)\Windows Kits\10\include\10.0.16299.0\winrt\
>
> This is interesting, thanks for sending it. To support Clang with the
> MSVC target I can see two immediate things that we will need to do:
>
> 1. We will need to remap Clang's 'x86_64-pc-windows-msvc' to build2's
>    more precise 'x86_64-microsoft-win32-msvcNN.N' where NN.N is the
>    MSVC runtime version.
>
>    In this light, do you know if there is a way to query Clang for
>    the MSVC runtime it is using? I guess we could get it from the
>    '...\MSVC\14.11.25503\include' bit of the include path but that
>    feels rather hackish.
>
> 2. We will need to find the rest of the toolchain (link.exe, rc.exe,
>    mt.exe, etc).
>
>    When you use Clang, are you expected to run it from the corresponding
>    MSVC development command prompt (where the PATH is already set to
>    include the correct variants of these tools)?
>
>    Also, can you show the output of this command:
>
>    clang -print-search-dirs
>
> Thanks,
> Boris
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20171204/6a8642e4/attachment-0001.html>


More information about the users mailing list