After upgrading to 13.10, clang and GCC erroneously look for GCC-4.7 headers

Bug #1244021 reported by Nicholas Nethercote
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
gcc-4.8 (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I'm a Firefox developer. 13.04 was working fine. I upgraded to 13.10 and now I can't compile Firefox with either clang or GCC.

Here's a reduced test case:

  #include <memory>
  int main(void) {}

If I compile this with clang I get this:

[fjord:~/moz/mi5] clang++ a.cpp
In file included from a.cpp:1:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/memory:62:
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/allocator.h:92:29: error:
      unknown template name '__allocator_base'
    class allocator: public __allocator_base<_Tp>
                            ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/allocator.h:116:25: error:
      expected '('
      : __allocator_base<_Tp>(__a) { }
                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../../include/c++/4.8/bits/allocator.h:116:25: error:
      expected '{' or ','
3 errors generated.

The results with GCC are similar.

I found the problem is that both clang and GCC are somehow configured to look for some GCC 4.7 headers as well as GCC 4.8 headers -- both of them have |-I/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../include/x86_64-linux-gnu/c++/4.7| hardwired in the default flags.

As a workaround, I renamed /usr/include/c++/4.7/ and /usr/include/x86_64-linux-gnu/c++/4.7/ so the compilers could no longer find them, and now things are working normally. But obviously this should be fixed properly.

Revision history for this message
Horst Schirmeier (horst) wrote :

Cannot reproduce. I'm using 13.10 (x86_64; was upgraded from several earlier releases), only gcc-4.8 and clang-3.2 is installed.

$ clang++ a.cpp
$ g++ a.cpp
$ clang++ --version
Debian clang version 3.2-7ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: x86_64-pc-linux-gnu
Thread model: posix
$ g++ --version
g++ (Ubuntu/Linaro 4.8.1-10ubuntu8) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc seems to use the correct include paths here (see attachment).

Revision history for this message
Nicholas Nethercote (n-nethercote) wrote :

FWIW, I just upgraded to 14.04 and hit exactly the same problem. This time I just had to rename /usr/include/x86_64-linux-gnu/c++/4.7/ to fix it.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-4.8 (Ubuntu):
status: New → Confirmed
Revision history for this message
peter (peter--s) wrote :

After a dist-upgrade of my Linux Mint (to Olivia), I ran into the same problems.

Your fix (renaming all c++/4.7 directory to something like c++/4.7_old) fixed it. Just my directories were /usr/include/c++/4.7/ and /usr/include/i386-linux-gnu/c++/4.7/ . But that was easy to find.

Revision history for this message
Matthias Klose (doko) wrote :

I don't see this in 14.04 LTS

Changed in gcc-4.8 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.