<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Invalid, missing flags passed into Ninja generator (libc++ release build)"
   href="https://bugs.llvm.org/show_bug.cgi?id=47859">47859</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Invalid, missing flags passed into Ninja generator (libc++ release build)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Windows XP
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>local.tourist.kiev@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=24065" name="attach_24065" title="This my generated build.ninja file">attachment 24065</a> <a href="attachment.cgi?id=24065&action=edit" title="This my generated build.ninja file">[details]</a></span>
This my generated build.ninja file

Hi.

It looks like there are few issues, while building libc++ on Windows 10 (I can
confirm on both x86_64 and i386) with clang-cl:

*--* _CRT_STDIO_ISO_WIDE_SPECIFIERS flag is passed into the compiler, while I
didn't enforce that;
*--* /MD flag is passed instead of /MT ;
*--* /DNDEBUG should not be passed, since I am performing a release build ;
*--* /NODEFAULTLIB wasn't specified (while I suspect that it should, according
to my recent tryouts, to resolve the issue) for: libucrt.lib, ucrt.lib,
libvcruntime.lib, vcruntime.lib ;


Not sure (yet) how should it look properly - but here is an example of
improperly formed build instruction, from the generated build.ninja file:

build src\CMakeFiles\cxx_static.dir\valarray.cpp.obj:
CXX_COMPILER__cxx_static_Release
C$:\Users\Worker\Desktop\llvm-project\libcxx\src\valarray.cpp ||
cmake_object_order_depends_target_cxx_static
  DEFINES = -DNDEBUG -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
-D_ALLOW_MSC_VER_MISMATCH -D_CRTBLD -D_CRT_SECURE_NO_WARNINGS
-D_CRT_STDIO_ISO_WIDE_SPECIFIERS -D_LIBCPP_BUILDING_LIBRARY
-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
  FLAGS = /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MD /O2 /Ob2 /DNDEBUG -Wall -Wextra
-W -Wwrite-strings -Wno-unused-parameter -Wno-long-long -Werror=return-type
-Wextra-semi -Wno-user-defined-literals -Wno-covered-switch-default
-Wno-suggest-override -Wno-ignored-attributes -Wno-c++98-compat
-Wno-c++98-compat-pedantic -Wno-c++11-compat -Wno-undef -Wno-reserved-id-macro
-Wno-gnu-include-next -Wno-gcc-compat -Wno-zero-as-null-pointer-constant
-Wno-deprecated-dynamic-exception-spec -Wno-sign-conversion -Wno-old-style-cast
-Wno-deprecated -Wno-shift-sign-overflow -Wno-double-promotion -Wno-error -EHsc
/I C:/Users/Worker/Desktop/llvm-project/build_libcxx/include/c++/v1 /FI
C:/Users/Worker/Desktop/llvm-project/build_libcxx/__config_site -std:c++17
  OBJECT_DIR = src\CMakeFiles\cxx_static.dir
  OBJECT_FILE_DIR = src\CMakeFiles\cxx_static.dir
  TARGET_COMPILE_PDB = src\CMakeFiles\cxx_s

I was generating the config. like this:

cmake -DLLVM_PATH=../llvm -DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="C:\Users\Worker\libcxx_dist"
-DCMAKE_C_COMPILER=clang-cl -DCMAKE_CXX_COMPILER=clang-cl -G Ninja ../libcxx

And

<span class="quote">>cmake --version</span >
cmake version 3.19.0-rc1

<span class="quote">>clang-cl --version</span >
clang version 11.0.0
Target: x86_64-pc-windows-msvc
Thread model: posix

<span class="quote">>ninja --version</span >
1.10.0.git.kitware.jobserver-1

You can find my generated build.ninja file described here:
<a href="https://gist.github.com/advancedwebdeveloper/d1bbd53677dfefac219f21545a55a114">https://gist.github.com/advancedwebdeveloper/d1bbd53677dfefac219f21545a55a114</a>

And here is my compressed build folder:
<a href="https://drive.google.com/file/d/1oo4jz8A0Ha63tC7LWoZ1IKa6Ld99GXX7/view?usp=sharing">https://drive.google.com/file/d/1oo4jz8A0Ha63tC7LWoZ1IKa6Ld99GXX7/view?usp=sharing</a>

Ivan</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>