[llvm-bugs] [Bug 31570] New: clang++ always prefers the system libcxx instead of the internal version

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 7 06:03:37 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31570

            Bug ID: 31570
           Summary: clang++ always prefers the system libcxx instead of
                    the internal version
           Product: clang
           Version: trunk
          Hardware: PC
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alexej.h at xiphos.de
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

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 http://llvm.org/svn/llvm-project/llvm/trunk llvm
svn co -r 290110 http://llvm.org/svn/llvm-project/cfe/trunk llvm/tools/clang
svn co -r 290110 http://llvm.org/svn/llvm-project/clang-tools-extra/trunk
llvm/tools/clang/tools/extra
svn co -r 290110 http://llvm.org/svn/llvm-project/libcxx/trunk
llvm/projects/libcxx
svn co -r 290110 http://llvm.org/svn/llvm-project/libcxxabi/trunk
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20170107/5d61ac60/attachment.html>


More information about the llvm-bugs mailing list