<div dir="ltr">The version of clang you have is configured to target the MSVC runtime, so I mistakenly assumed that's what you wanted. :)<div><br></div><div>If you want to use mingw, you can either pass --target=i686-w64-windows-gnu to every compile step, or reconfigure and rebuild clang with -DLLVM_DEFAULT_TARGET_TRIPLE=i686-w64-windows-gnu.<div><br></div><div>I think passing '-DCMAKE_C_FLAGS=--target=i686-w64-windows-gnu -DCMAKE_CXX_FLAGS=--target=i686-w64-windows-gnu' to the second stage build is enough, but I could be wrong, I don't have experience building mingw64 clang.</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Feb 9, 2016 at 2:47 AM, Victor Leschuk <span dir="ltr"><<a href="mailto:vleschuk@gmail.com" target="_blank">vleschuk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hello Reid,<br>
    <br>
    thanks a lot for your answer, it helped. As far as I understood from
    the documentation: one needs to use clang-cl if he wants to use
    visual studio runtime. The clang.exe and clang++.exe binaries are
    intended to be used only with mingw runtime (and libc++ is not yet
    available for windows). Am I correct?<div><div class="h5"><br>
    <br>
    <div>On 02/09/2016 01:15 AM, Reid Kleckner
      wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Try clang-cl instead, like this:
        <div><span style="font-size:12.8px">$ cmake .. -GNinja
            -DCMAKE_C_COMPILER=clang-cl </span><span style="font-size:12.8px">-DCMAKE_CXX_COMPILER=clang-cl</span><br>
        </div>
        <div><span style="font-size:12.8px"><br>
          </span></div>
        <div><span style="font-size:12.8px">If you use the other command
            line syntax, it looks like CMake has mingw-ish assumptions
            about what linker flags are valid.</span></div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Sun, Feb 7, 2016 at 3:49 AM, Victor
          Leschuk via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank"></a><a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello all,<br>
            <br>
            I am currently trying to use clang compiler on Windows 7
            (64bit), I have built LLVM and clang from sources (master
            branch) using VS 2015.<br>
            <br>
            Now I am trying to rebuild the LLVM and clang using clang
            itself.<br>
            <br>
            So I am stuck setting correct configuration for cmake.<br>
            <br>
            I am running the following command:<br>
            <br>
             $ cmake .. -G "Ninja" -DCMAKE_C_COMPILER=clang
            -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER_ID=Clang
            -DCMAKE_CXX_COMPILER_ID=Clang<br>
            <br>
            And after that the first test fails with linkage error:<br>
            <br>
              CMakeFiles\cmTC_8f103.dir\testCCompiler.c.obj -o
            cmTC_8f103.exe<br>
              -Wl,--out-implib,libcmTC_8f103.dll.a<br>
              -Wl,--major-image-version,0,--minor-image-version,0
            && cd ."<br>
            <br>
              LINK : warning LNK4044: unrecognized option
            '/-out-implib'; ignored<br>
            <br>
              LINK : warning LNK4044: unrecognized option
            '/-major-image-version';<br>
              ignored<br>
            <br>
              LINK : warning LNK4044: unrecognized option
            '/-minor-image-version';<br>
              ignored<br>
            <br>
              LINK : fatal error LNK1181: cannot open input file
            'libcmTC_8f103.dll.a'<br>
            <br>
              clang.exe: error: linker command failed with exit code
            1181 (use -v to see<br>
            <br>
            I have found similar bug:<br>
            <br>
            <a href="https://llvm.org/bugs/show_bug.cgi?id=20868" rel="noreferrer" target="_blank">https://llvm.org/bugs/show_bug.cgi?id=20868</a><br>
            <br>
            However it is for WinXP and is marked as already fixed.<br>
            <br>
            Also here is similar unsolved discussion SO: <a href="http://stackoverflow.com/questions/22585874/building-c-project-on-windows-with-cmake-clang-and-ninja" rel="noreferrer" target="_blank"></a><a href="http://stackoverflow.com/questions/22585874/building-c-project-on-windows-with-cmake-clang-and-ninja" target="_blank">http://stackoverflow.com/questions/22585874/building-c-project-on-windows-with-cmake-clang-and-ninja</a><br>
            <br>
            Here is clang version which I am trying to use:<br>
            <br>
            $ clang --version<br>
            clang version 3.9.0<br>
            Target: i686-pc-windows-msvc<br>
            Thread model: posix<br>
            InstalledDir: C:\Users\del\work\llvm\bin<br>
            <br>
            It would be great is somebody could point me on what am I
            doing wrong?<br>
            <br>
            Thanks in advance!<br>
            <br>
            --<br>
            Victor<br>
            <br>
            <br>
            _______________________________________________<br>
            cfe-dev mailing list<br>
            <a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
            <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>