<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </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 --- - llvm+libcxx cmake failing on SunOS: cc1plus: fatal error: llvm/Support/Solaris.h: No such file or directory"
   href="https://llvm.org/bugs/show_bug.cgi?id=29013">29013</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>llvm+libcxx cmake failing on SunOS: cc1plus: fatal error: llvm/Support/Solaris.h: No such file or directory
          </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>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>cmake
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>mgorny@gentoo.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>I'm attempting to build LLVM+clang+libcxx together on SunOS (OpenIndiana). When
the cmake process reaches libcxx, it fails with the following error:

-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG
-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG - Failed
CMake Error at projects/libcxx/CMakeLists.txt:308 (message):
  C++11 or greater is required but the compiler does not support c++11

Looking into CMakeError.log, I find the following problem:

/usr/bin/c++     -fPIC -fvisibility-inlines-hidden -Wall -W
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers  -Wno-long-long -Wno-maybe-uninitialized
-Wdelete-non-virtual-dtor -Wno-comment -std=c++11 -include
llvm/Support/Solaris.h -DLIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG   -std=c++11 -o
CMakeFiles/cmTC_9c6d6.dir/src.cxx.o -c
/root/mgorny-test/llvm/_build/CMakeFiles/CMakeTmp/src.cxx
cc1plus: fatal error: llvm/Support/Solaris.h: No such file or directory
compilation terminated.


It seems to be caused by the following block from top CMakeLists.txt file:

if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
   SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include llvm/Support/Solaris.h")
endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )

This causes the listed header to be included unconditionally for all files
built, including subprojects. However, it seems that libcxx doesn't specify an
appropriate include dir, therefore causing everything using this to fail.

Depending on whether this is desired in subprojects, potential fixes are:

a. instead of appending to CMAKE_CXX_FLAGS, add the -include flag restrictively
for LLVM source files it needs and do not propagate it into subprojects,

b. or add appropriate include dirs where appropriate. The simplest fix would be
to add an appropriate -I flag in the same block.</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>