<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 --- - libcxx cannot find libatomic and cstddef"
   href="https://llvm.org/bugs/show_bug.cgi?id=26622">26622</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libcxx cannot find libatomic and cstddef
          </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>All
          </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>gonzalobg88@gmail.com
          </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 am trying to install libcxx on a macosx 10.11.2 without installing libcxxabi
as explained in the libcxx website but cmake cannot find libatomic.

I am using a recently compiled and installed clang from source.

The command I am using is:

# Build libcxx without libcxxabi
cd ${LIBCXX_BUILD}
cmake ${LIBCXX_SRC} -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_ASSERTIONS=Off
-DLIT_EXECUTABLE=${LLVM_LIT} \
-DCMAKE_INSTALL_PREFIX=${PREFIX} -DLLVM_CONFIG=${PREFIX}/bin/llvm-config
make -j $POOL_JOBS
make install

The error I get is: 

-- Configuring for standalone build.
-- Found LLVM_CONFIG as /Users/name/pool/bin/llvm-config
-- Found PythonInterp: /usr/local/bin/python (found version "2.7.11") 
-- Sphinx disabled.
-- The CXX compiler identification is Clang 3.9.0
-- The C compiler identification is Clang 3.9.0
-- Check for working CXX compiler: /Users/name/pool/bin/clang++
-- Check for working CXX compiler: /Users/name/pool/bin/clang++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working C compiler: /Users/name/pool/bin/clang
-- Check for working C compiler: /Users/name/pool/bin/clang -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Performing Test LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB - Failed
-- Looking for __atomic_fetch_add_8 in atomic
-- Looking for __atomic_fetch_add_8 in atomic - not found
CMake Error at cmake/Modules/CheckLibcxxAtomic.cmake:39 (message):
  Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
  cmake/config-ix.cmake:3 (include)
  CMakeLists.txt:240 (include)

-- Configuring incomplete, errors occurred!
See also "/Users/name/pool/build/libcxx/CMakeFiles/CMakeOutput.log".
See also "/Users/name/pool/build/libcxx/CMakeFiles/CMakeError.log".

Basically from CMakeError.log I found that the problem was that #include
<cstddef> could not be found. That is why the atomic tests failed to compile,
but this is werid since cstddef is provided by libc++ itself.

I "fixed" this by just adding a path to libc++'s include directory to my
install command:

# Build libcxx without libcxxabi
cd ${LIBCXX_BUILD}
cmake ${LIBCXX_SRC} -DCMAKE_BUILD_TYPE=Release -DLIBCXX_ENABLE_ASSERTIONS=Off
-DLIT_EXECUTABLE=${LLVM_LIT} \
      -DCMAKE_INSTALL_PREFIX=${PREFIX} -DLLVM_CONFIG=${PREFIX}/bin/llvm-config
-DCMAKE_CXX_FLAGS="-I${LIBCXX_SRC}/include"
make -j $POOL_JOBS
make install

Still it looks that I am missing something, why should this be necessary?</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>