Bug#785697: clang-3.6: Clang++ does not find standard include files, e.g. <iostream>

Giuseppe Bilotta giuseppe.bilotta at gmail.com
Mon Oct 19 14:05:57 UTC 2015


Package: clang-3.6
Version: 1:3.6.2-1
Followup-For: Bug #785697

I've found this happens when using the --gcc-toolchain command-line
option to choose the toolchain to use. The include path in this case is
seriously defective. Compare:


== 8< === without --gcc-toolchain =====

$ echo | clang++ -x c++ -c -v -o /dev/null -
Debian clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/i586-linux-gnu/5.2.1
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/i586-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
 "/usr/lib/llvm-3.6/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name - -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -target-linker-version 2.25 -v -dwarf-column-info -coverage-file /dev/null -resource-dir /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/x86_64-linux-gnu/c++/5.2.1 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/x86_64-linux-gnu/c++/5.2.1 -internal-isystem /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1/backward -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/oblomov -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /dev/null -x c++ -
clang -cc1 version 3.6.2 based upon LLVM 3.6.2 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
ignoring duplicate directory "/usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/x86_64-linux-gnu/c++/5.2.1"
#include "..." search starts here:
#include <...> search starts here:
 /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1
 /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/x86_64-linux-gnu/c++/5.2.1
 /usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1/../../../../include/c++/5.2.1/backward
 /usr/local/include
 /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

== 8< ==============================


versus:

== 8< === with --gcc-toolchain =====

$ echo | clang++ -x c++ --gcc-toolchain=/usr/bin/../lib/gcc/x86_64-linux-gnu/5.2.1 -c -v -o /dev/null -

Debian clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
 "/usr/lib/llvm-3.6/bin/clang" -cc1 -triple x86_64-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name - -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.25 -v -dwarf-column-info -coverage-file /dev/null -resource-dir /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2 -internal-isystem /usr/local/include -internal-isystem /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /home/oblomov -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /dev/null -x c++ -
clang -cc1 version 3.6.2 based upon LLVM 3.6.2 default target x86_64-pc-linux-gnu
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/include
 /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

== 8< ==============================

Notice that even though the same GCC installation is selected, the
include paths are completely missing. Testing with `echo '#include
<cstdio>'` instead of a plain echo gives an error in the second case but
not in the first. Comparing the line beginning with space-doublequote it
is apparent that the -internal-isystem parameters are NOT being passed
in the second case, leading to the error.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.2.0-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages clang-3.6 depends on:
ii  binutils                 2.25.1-7
ii  libc6                    2.19-22
ii  libc6-dev                2.19-22
ii  libclang-common-3.6-dev  1:3.6.2-1
ii  libclang1-3.6            1:3.6.2-1
ii  libedit2                 3.1-20150325-1
ii  libffi6                  3.2.1-3
ii  libgcc-5-dev             5.2.1-22
ii  libgcc1                  1:5.2.1-22
ii  libllvm3.6v5             1:3.6.2-1
ii  libobjc-5-dev            5.2.1-22
ii  libstdc++-5-dev          5.2.1-22
ii  libstdc++6               5.2.1-22
ii  libtinfo5                6.0+20150810-1
ii  zlib1g                   1:1.2.8.dfsg-2+b1

Versions of packages clang-3.6 recommends:
ii  llvm-3.6-dev  1:3.6.2-1
ii  python        2.7.9-1

Versions of packages clang-3.6 suggests:
pn  clang-3.6-doc  <none>
pn  gnustep        <none>
pn  gnustep-devel  <none>

-- no debconf information



More information about the Pkg-llvm-team mailing list