[Bug 213217] Passing -isystem <sysroot>/usr/include to clang breaks C++ compilation
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Wed Oct 5 01:33:13 UTC 2016
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=213217
Bug ID: 213217
Summary: Passing -isystem <sysroot>/usr/include to clang breaks
C++ compilation
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: freebsd-bugs at FreeBSD.org
Reporter: gonzo at FreeBSD.org
Created attachment 175436
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=175436&action=edit
test case
To reproduce this bug run following command:
% clang++ -isystem /usr/include test.cpp
In file included from test.cpp:1:
/usr/include/c++/v1/cstddef:43:15: fatal error: 'stddef.h' file not found
#include_next <stddef.h>
^
1 error generated.
File compiles fine without -isystem flag:
% clang++ test.cpp
%
The problem is that stddef.h is clang's internal header and supposed to be in
/usr/bin/../lib/clang/3.8.0/include. But since it conflicts with freebsd's
stddef.h we do not install it and append /usr/include to the list of include
dirs:
% clang++ -v test.cpp
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM
3.8.0)
.. skipped ...
#include "..." search starts here:
#include <...> search starts here:
/usr/include/c++/v1
/usr/bin/../lib/clang/3.8.0/include
/usr/include
End of search list.
But when we pass -isystem /usr/include, clang removes appended dir as a
duplicate and search path looks like this:
% clang++ -v -isystem /usr/include test.cpp
FreeBSD clang version 3.8.0 (tags/RELEASE_380/final 262564) (based on LLVM
3.8.0)
.. skipped ..
ignoring duplicate directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/include
/usr/include/c++/v1
/usr/bin/../lib/clang/3.8.0/include
End of search list.
#include_next does not go through whole list, only from the directory where its
parent file is located
Some third-party software passes -isystem for cross-compilation cases alogn
with --sysroot, namely Qt does it like this:
c++ ... --sysroot=/src/FreeBSD/tftproot/rpi/ ... -isystem
/src/FreeBSD/tftproot/rpi/usr/include ...
and this bug breaks cross-compilation
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list