<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 - Clang fails to build with -DLLVM_ENABLE_MODULES=ON"
   href="https://bugs.llvm.org/show_bug.cgi?id=37438">37438</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Clang fails to build with -DLLVM_ENABLE_MODULES=ON
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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>Modules
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>anastasis.gramm2@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20299" name="attach_20299" title="clang build error">attachment 20299</a> <a href="attachment.cgi?id=20299&action=edit" title="clang build error">[details]</a></span>
clang build error

I am using system clang to compile the trunk clang.

$ clang --version # system clang
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-pc-linux-gnu
Thread model: posix

I used the following cmake flags for the configuration:
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Debug \
  -DLLVM_ENABLE_MODULES=On -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ ~/code/llvm

ninja opt worked fine and the build time was almost halfed.
ninja clang OTOH produces the attached errors. (short version below)

---
FAILED: tools/clang/lib/Basic/CMakeFiles/clangBasic.dir/Attributes.cpp.o
While building module 'Clang_Basic' imported from
/home/gramanas/code/llvm/tools/clang/lib/Basic/Attributes.cpp:1:
In file included from <module-includes>:15:
In file included from
/home/gramanas/code/llvm/tools/clang/include/clang/Basic/Attributes.h:13:
In file included from
/home/gramanas/code/llvm/tools/clang/include/clang/Basic/LangOptions.h:22:
/home/gramanas/code/llvm/tools/clang/include/clang/Basic/Visibility.h:53:3:
error: declaration of 'uint8_t' must be imported from module
'Clang_Basic.CommentOptions' before it is required
  uint8_t linkage_    : 3;
  ^
/usr/include/bits/stdint-uintn.h:24:19: note: previous declaration is here
typedef __uint8_t uint8_t;
                  ^
/home/gramanas/code/llvm/tools/clang/lib/Basic/Attributes.cpp:1:10: fatal
error: could not build module 'Clang_Basic'
#include "clang/Basic/Attributes.h"
 ~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
2 errors generated.
ninja: build stopped: subcommand failed.
---

I tried more configurations in the past weeks like with
ccache enabled and with shared libraries and everything 
wroks just fine. It's only when I enable the modules
the it crashes.</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>