← Back to team overview

desktop-packages team mailing list archive

[Bug 1432882] Re: libclang1 has wrong standard include paths

 

I could spot the difference between the two versions. It can be seen by running:
./refgen test.cpp -std=c++11 -v

With the ubuntu libclang, the output I get is (stripped to the essential bits):
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu"
ignoring nonexistent directory "../lib/clang/3.4/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

However, with the PPA libclang, the output is:
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
ignoring nonexistent directory "/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/x86_64-linux-gnu"
ignoring nonexistent directory "../lib/clang/3.4.2/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/backward
 /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../include/x86_64-linux-gnu/c++/4.8
 /usr/include/clang/3.4.2/include
 /usr/local/include
 /usr/lib/gcc/x86_64-linux-gnu/4.8/include
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.

It is essentially identical, except that the PPA version has one additional line that makes it all work:
 /usr/include/clang/3.4.2/include

Now where this line came from, or why was it removed in the official
ubuntu version, I have no clue... I will contact the author of the PPA
to see if he could help.

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to llvm-toolchain-3.4 in Ubuntu.
https://bugs.launchpad.net/bugs/1432882

Title:
  libclang1 has wrong standard include paths

Status in llvm-toolchain-3.4 package in Ubuntu:
  New

Bug description:
  Bug affects all versions of libclang1 I could test (3.3, 3.4 and 3.5).
  The precise version of libclang I have is 1:3.4-1ubuntu3.
  Running Ubuntu 14.04 (Linux Mint 17.1).

  When building a minimal libclang program (refgen.cpp, attached) and using the "-print-search-dirs" command line argument to output the standard header search directories, libclang outputs the following:
  programs: =:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/bin
  libraries: =../lib/clang/3.4:/usr/lib/gcc/x86_64-linux-gnu/4.8:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib/../lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../..:/lib:/usr/lib

  Notice the leading "../lib/clang/3.4" in "libraries", which does not
  make any sense and is likely missing part of the path. Notice also the
  leading ":" in "programs", which probably doesn't hurt, but looks
  suspicious.

  For reference, running clang (3.4) with the same command line argument outputs:
  programs: =/usr/bin:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../x86_64-linux-gnu/bin
  libraries: =/usr/bin/../lib/clang/3.4:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu:/lib/x86_64-linux-gnu:/lib/../lib64:/usr/lib/x86_64-linux-gnu:/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../..:/lib:/usr/lib

  One can see here that the leading "/usr/bin/" has probably been
  stripped somehow from the "programs" and "libraries" search paths in
  libclang1.

  The end result is that libclang1 does not find clang's standard headers, and falls back to using GCC's, which it does not support.
  In my case, this means that if I try to parse even the simplest of files (test.cpp, attached) with this libclang1 and C++11 support enabled, the parsing fails because libclang1 is failing to understand GCC's SSE intrinsics in /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h, generating lots of errors:
  /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h:41:10: error: use of undeclared identifier '__builtin_ia32_bsrsi'
  /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h:89:10: error: use of undeclared identifier '__builtin_ia32_rdpmc'
  /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h:97:10: error: use of undeclared identifier '__builtin_ia32_rdtsc'
  /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h:105:10: error: use of undeclared identifier '__builtin_ia32_rdtscp'
  /usr/lib/gcc/x86_64-linux-gnu/4.8/include/ia32intrin.h:113:10: error: use of undeclared identifier '__builtin_ia32_rolqi'

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/llvm-toolchain-3.4/+bug/1432882/+subscriptions


References