[llvm-bugs] [Bug 26834] New: --sysroot doesn't add the cxx includes

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 3 12:48:07 PST 2016


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

            Bug ID: 26834
           Summary: --sysroot doesn't add the cxx includes
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: vvasilev at cern.ch
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Way to reproduce:
$ cat T.cpp 
#include <string>
std::basic_string<char> myStr;

$ clang -Xclang -header-include-file -Xclang included_files.txt -fsyntax-only
T.cpp && sed -i '/<command line>/d' included_files.txt

$cat included_files.txt | xargs -I$ cp --parents $ includes/

Running with GCC seems correct. I.e. it picks the right headers. One way to
check this is to introduce an error for instance in
./includes/usr/include/c++/4.9/string

GCC Works:

gcc-4.9 -fsyntax-only --sysroot="./includes/" T.cpp -v
Using built-in specs.
COLLECT_GCC=gcc-4.9
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.9/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
4.9.3-8ubuntu2~14.04' --with-bugurl=file:///usr/share/doc/gcc-4.9/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.9 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.9 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-vtable-verify
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.9-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.9-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.9.3 (Ubuntu 4.9.3-8ubuntu2~14.04) 
COLLECT_GCC_OPTIONS='-fsyntax-only' '-v' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-linux-gnu/4.9/cc1plus -quiet -v -imultiarch
x86_64-linux-gnu -isysroot ./includes/ -D_GNU_SOURCE T.cpp -quiet -dumpbase
T.cpp -mtune=generic -march=x86-64 -auxbase T -version -fsyntax-only -o
/dev/null -fstack-protector -Wformat -Wformat-security
GNU C++ (Ubuntu 4.9.3-8ubuntu2~14.04) version 4.9.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.9.3, GMP version 5.1.3, MPFR version 3.1.3, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring duplicate directory "./includes/usr/include/x86_64-linux-gnu/c++/4.9"
ignoring nonexistent directory "./includes/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "./includes/usr/local/include"
ignoring nonexistent directory
"/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 ./includes/usr/include/c++/4.9
 ./includes/usr/include/x86_64-linux-gnu/c++/4.9
 ./includes/usr/include/c++/4.9/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include
 /usr/lib/gcc/x86_64-linux-gnu/4.9/include-fixed
 ./includes/usr/include/x86_64-linux-gnu
 ./includes/usr/include
End of search list.
GNU C++ (Ubuntu 4.9.3-8ubuntu2~14.04) version 4.9.3 (x86_64-linux-gnu)
    compiled by GNU C version 4.9.3, GMP version 5.1.3, MPFR version 3.1.3, MPC
version 1.0.1
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: 89e7430b5c7b299a0eb13bf84091b3f2
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.9/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../lib/:./includes/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../:./includes/usr/lib/
COLLECT_GCC_OPTIONS='-fsyntax-only' '-v' '-mtune=generic' '-march=x86-64'

Clang does not:

clang++ -fsyntax-only --sysroot="./includes/" T.cpp -v
clang version 3.8.0 (https://github.com/llvm-mirror/clang.git
da6b27875042ee23afaf898f189e410f177311ad)
(https://github.com/llvm-mirror/llvm.git
1c23594d2c3887bbb714a55a51770524f7744293)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/vvassilev/workspace/llvm-git/inst/bin
Found candidate GCC installation: ./includes//usr/lib/gcc/x86_64-linux-gnu/4.9
 "/home/vvassilev/workspace/llvm-git/inst/bin/clang" -cc1 -triple
x86_64-unknown-linux-gnu -fsyntax-only -disable-free -main-file-name T.cpp
-mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno
-masm-verbose -mconstructor-aliases -munwind-tables -target-cpu x86-64
-target-linker-version 2.24 -v -dwarf-column-info -resource-dir
/home/vvassilev/workspace/llvm-git/inst/bin/../lib/clang/3.8.0 -isysroot
./includes/ -internal-isystem ./includes//usr/local/include -internal-isystem
/home/vvassilev/workspace/llvm-git/inst/bin/../lib/clang/3.8.0/include
-internal-externc-isystem ./includes//usr/include/x86_64-linux-gnu
-internal-externc-isystem ./includes//include -internal-externc-isystem
./includes//usr/include -fdeprecated-macro -fdebug-compilation-dir
/tmp/creduce-demo -ferror-limit 19 -fmessage-length 151 -fobjc-runtime=gcc
-fcxx-exceptions -fexceptions -fdiagnostics-show-option -x c++ T.cpp
clang -cc1 version 3.8.0 based upon LLVM 3.8.0svn default target
x86_64-unknown-linux-gnu
ignoring nonexistent directory "./includes//usr/local/include"
ignoring nonexistent directory "./includes//include"
#include "..." search starts here:
#include <...> search starts here:
 /home/vvassilev/workspace/llvm-git/inst/bin/../lib/clang/3.8.0/include
 ./includes//usr/include/x86_64-linux-gnu
 ./includes//usr/include
End of search list.
T.cpp:1:10: fatal error: 'string' file not found
#include <string>
         ^
1 error generated.

To me this seems a bug.

-- 
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/20160303/c246a225/attachment.html>


More information about the llvm-bugs mailing list