[llvm-bugs] [Bug 44923] New: After b50e8c592, --sysroot no longer applies to C++ system include directory

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Feb 15 10:22:24 PST 2020


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

            Bug ID: 44923
           Summary: After b50e8c592, --sysroot no longer applies to C++
                    system include directory
           Product: clang
           Version: trunk
          Hardware: All
                OS: Windows NT
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: dimitry at andric.com
                CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org,
                    neeilans at live.com, richard-llvm at metafoo.co.uk

In
https://github.com/llvm/llvm-project/commit/b50e8c592789bfecb85dca9067c0853ad4d30199
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 (git at github.com: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 (git at github.com: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.

-- 
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/20200215/85793c93/attachment-0001.html>


More information about the llvm-bugs mailing list