<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 --- - clang++ always prefers the system libcxx instead of the internal version"
href="https://llvm.org/bugs/show_bug.cgi?id=31570">31570</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>clang++ always prefers the system libcxx instead of the internal version
</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>FreeBSD
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>Driver
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>alexej.h@xiphos.de
</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>When libcxx is compiled and installed together with clang++, it is never used
and the include path is missing.
/opt/llvm/bin/clang++ -v -std=c++1z -xc++ - -pthread -lc++experimental <
/dev/null
clang version 4.0.0 (trunk 290110)
Target: x86_64-unknown-freebsd10.3
Thread model: posix
InstalledDir: /opt/llvm/bin
"/opt/llvm/bin/clang-4.0" -cc1 -triple x86_64-unknown-freebsd10.3 -emit-obj
-mrelax-all -disable-free -disable-llvm-verifier -discard-value-names
-main-file-name - -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -masm-verbose -mconstructor-aliases -munwind-tables
-target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -resource-dir
/opt/llvm/bin/../lib/clang/4.0.0 -internal-isystem /usr/include/c++/v1
-std=c++1z -fdeprecated-macro -fdebug-compilation-dir /home/aharm -ferror-limit
19 -fmessage-length 120 -pthread -fobjc-runtime=gnustep -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/--5962a5.o
-x c++ -
clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target
x86_64-unknown-freebsd10.3
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/v1
/opt/llvm/bin/../lib/clang/4.0.0/include
/usr/include
End of search list.
"/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1
--hash-style=both --enable-new-dtags -o a.out /usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/crtbegin.o -L/usr/lib /tmp/--5962a5.o -lc++experimental -lc++ -lm
-lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed
-lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
/usr/bin/ld: cannot find -lc++experimental
Steps to reproduce on 10.3-RELEASE-p7 and possibly 11:
svn co -r 290110 <a href="http://llvm.org/svn/llvm-project/llvm/trunk">http://llvm.org/svn/llvm-project/llvm/trunk</a> llvm
svn co -r 290110 <a href="http://llvm.org/svn/llvm-project/cfe/trunk">http://llvm.org/svn/llvm-project/cfe/trunk</a> llvm/tools/clang
svn co -r 290110 <a href="http://llvm.org/svn/llvm-project/clang-tools-extra/trunk">http://llvm.org/svn/llvm-project/clang-tools-extra/trunk</a>
llvm/tools/clang/tools/extra
svn co -r 290110 <a href="http://llvm.org/svn/llvm-project/libcxx/trunk">http://llvm.org/svn/llvm-project/libcxx/trunk</a>
llvm/projects/libcxx
svn co -r 290110 <a href="http://llvm.org/svn/llvm-project/libcxxabi/trunk">http://llvm.org/svn/llvm-project/libcxxabi/trunk</a>
llvm/projects/libcxxabi
mkdir llvm/build && cd llvm/build
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="../stage" \
-DLLVM_TARGETS_TO_BUILD="X86" -DCLANG_DEFAULT_CXX_STDLIB="libc++"
-DLLVM_ENABLE_WARNINGS=OFF -DLLVM_ENABLE_PEDANTIC=OFF \
-DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
-DLIBCXXABI_ENABLE_SHARED=OFF -DLIBCXXABI_ENABLE_STATIC=ON \
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
-DCLANG_INCLUDE_TESTS=OFF ..
ninja
ninja install
setenv CC ../stage/bin/clang
setenv CXX ../stage/bin/clang++
cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/llvm" \
-DLLVM_TARGETS_TO_BUILD="X86" -DCLANG_DEFAULT_CXX_STDLIB="libc++"
-DLLVM_ENABLE_WARNINGS=OFF -DLLVM_ENABLE_PEDANTIC=OFF \
-DLIBCXX_ENABLE_SHARED=OFF -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=ON
-DLIBCXXABI_ENABLE_SHARED=OFF -DLIBCXXABI_ENABLE_STATIC=ON \
-DLLVM_INCLUDE_EXAMPLES=OFF -DLLVM_INCLUDE_TESTS=OFF
-DCLANG_INCLUDE_TESTS=OFF -DLIBCXX_ENABLE_FILESYSTEM=ON \
-DLIBCXX_INSTALL_EXPERIMENTAL_LIBRARY=ON
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="WebAssembly" ..
ninja && sudo ninja install</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>