<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 - After b50e8c592, --sysroot no longer applies to C++ system include directory"
href="https://bugs.llvm.org/show_bug.cgi?id=44923">44923</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>After b50e8c592, --sysroot no longer applies to C++ system include directory
</td>
</tr>
<tr>
<th>Product</th>
<td>clang
</td>
</tr>
<tr>
<th>Version</th>
<td>trunk
</td>
</tr>
<tr>
<th>Hardware</th>
<td>All
</td>
</tr>
<tr>
<th>OS</th>
<td>Windows NT
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>release blocker
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>-New Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>unassignedclangbugs@nondot.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>dimitry@andric.com
</td>
</tr>
<tr>
<th>CC</th>
<td>htmldeveloper@gmail.com, llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
</td>
</tr></table>
<p>
<div>
<pre>In
<a href="https://github.com/llvm/llvm-project/commit/b50e8c592789bfecb85dca9067c0853ad4d30199">https://github.com/llvm/llvm-project/commit/b50e8c592789bfecb85dca9067c0853ad4d30199</a>
the -stdlib++-isystem flag is introduced, for reasons explained in the commit
message.
However, the way it is implemented appears to break --sysroot, where such a
sysroot points to a directory with correctly populated C and C++ headers. For
instance, during the FreeBSD buildworld process, we set up a directory:
/usr/obj/usr/src/amd64.amd64/tmp/usr/include
which has the C headers, and under it also the libc++ headers, in:
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1
With clang++ 9.0.1, pointing to such a sysroot with --sysroot, and compiling a
simple "hello world" program, the C++ system include directory is correctly
appended to the sysroot path, e.g.:
$ clang++-9.0.1 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -v -c helloworld.cpp
FreeBSD clang version 9.0.1 (<a href="mailto:git@github.com">git@github.com</a>:llvm/llvm-project.git
c1a0a213378a458fbea1a5c77b315c7dce08fd05) (based on LLVM 9.0.1)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
"/usr/bin/clang++-9.0.1" -cc1 -triple x86_64-unknown-freebsd13.0 -emit-obj
-mrelax-all -disable-free -main-file-name helloworld.cpp -mrelocation-model
static -mthread-model posix -mdisable-fp-elim -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-dwarf-column-info -debugger-tuning=gdb -v -coverage-notes-file
/tmp/helloworld.gcno -resource-dir /usr/lib/clang/9.0.1 -isysroot
/usr/obj/usr/src/amd64.amd64/tmp -internal-isystem
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 160
-fobjc-runtime=gnustep -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -faddrsig -o helloworld.o -x c++ helloworld.cpp
clang -cc1 version 9.0.1 based upon LLVM 9.0.1 default target
x86_64-unknown-freebsd13.0
ignoring nonexistent directory "/usr/lib/clang/9.0.1/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1 <--- THIS IS CORRECT
/usr/obj/usr/src/amd64.amd64/tmp/usr/include
End of search list.
With clang++ 10.0.0 (so after b50e8c592), this no longer happens, and it
reverts back to the host system's C++ include directory instead:
$ clang++-10.0.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -v -c
helloworld.cpp
FreeBSD clang version 10.0.0 (<a href="mailto:git@github.com">git@github.com</a>:llvm/llvm-project.git
90c78073f73eac58f4f8b4772a896dc8aac023bc)
Target: x86_64-unknown-freebsd13.0
Thread model: posix
InstalledDir: /usr/bin
(in-process)
"/usr/bin/clang++-10.0.0" -cc1 -triple x86_64-unknown-freebsd13.0 -emit-obj
-mrelax-all -disable-free -main-file-name helloworld.cpp -mrelocation-model
static -mthread-model posix -mframe-pointer=all -fno-rounding-math
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-dwarf-column-info -fno-split-dwarf-inlining -debugger-tuning=gdb -v
-resource-dir /usr/lib/clang/10.0.0 -isysroot /usr/obj/usr/src/amd64.amd64/tmp
-internal-isystem /usr/bin/../include/c++/v1 -fdeprecated-macro
-fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 160
-fgnuc-version=4.2.1 -fobjc-runtime=gnustep -fcxx-exceptions -fexceptions
-fdiagnostics-show-option -fcolor-diagnostics -faddrsig -o helloworld.o -x c++
helloworld.cpp
clang -cc1 version 10.0.0 based upon LLVM 10.0.0git default target
x86_64-unknown-freebsd13.0
#include "..." search starts here:
#include <...> search starts here:
/usr/bin/../include/c++/v1 <--- THIS IS WRONG
/usr/lib/clang/10.0.0/include
/usr/obj/usr/src/amd64.amd64/tmp/usr/include
End of search list.</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>