Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 417913 - sys-devel/clang-3.1-r2 - In file included from .../llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:19: /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/new:40:10: fatal error: 'bits/c++config.h' file not found
Summary: sys-devel/clang-3.1-r2 - In file included from .../llvm-3.1.src/projects/comp...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Bernard Cafarelli
URL:
Whiteboard:
Keywords: Bug, REGRESSION
Depends on:
Blocks: systemwide-clang
  Show dependency tree
 
Reported: 2012-05-28 06:03 UTC by Ben Longbons
Modified: 2012-06-11 02:04 UTC (History)
12 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log from sys-devel/clang-3.1-r2 (clang-build.log.gz,80.31 KB, application/x-gzip)
2012-05-28 06:03 UTC, Ben Longbons
Details
clang error with -v (clang-error,2.65 KB, text/plain)
2012-05-28 22:36 UTC, Ben Longbons
Details
verbose error on x86 (clang-3.1-r2_verbose_error,3.03 KB, text/plain)
2012-05-28 23:21 UTC, ninuje
Details
strace output (clang_strace.log,40.29 KB, text/plain)
2012-05-29 03:10 UTC, ninuje
Details
strace output, bis (clang_strace_bis.log,40.52 KB, text/plain)
2012-05-29 06:37 UTC, ninuje
Details
strace log (3.1-r3) (clang_strace_r3.log,16.59 KB, text/plain)
2012-06-05 05:14 UTC, ninuje
Details
verbose output (3.1-r3) (clang_verbose_r3.log,3.03 KB, text/plain)
2012-06-06 01:26 UTC, ninuje
Details
verbose output (tweaked 3.1-r3) (clang_verbose_r3-2.log,2.99 KB, text/plain)
2012-06-06 03:54 UTC, ninuje
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Longbons 2012-05-28 06:03:54 UTC
Created attachment 313353 [details]
build.log from sys-devel/clang-3.1-r2

[ebuild  N    ] sys-devel/clang-3.1-r2  USE="static-analyzer -debug -multitarget -test"

Portage 2.1.10.63 (default/linux/amd64/10.0, gcc-4.6.2, glibc-2.15-r2, 3.3.4-gentoo x86_64)
=================================================================
                         System Settings
=================================================================
System uname: Linux-3.3.4-gentoo-x86_64-AMD_Athlon-tm-_64_X2_Dual_Core_Processor_4200+-with-gentoo-2.1
Timestamp of tree: Sun, 27 May 2012 09:45:01 +0000
app-shells/bash:          4.2_p28
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r2, 3.2.3-r1
dev-util/cmake:           2.8.8-r2
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.1
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.9.6-r3, 1.10.3, 1.11.5
sys-devel/binutils:       2.22-r1
sys-devel/gcc:            4.3.6-r1, 4.4.7, 4.5.3-r2, 4.6.0, 4.6.1-r1, 4.6.2, 4.7.0
sys-devel/gcc-config:     1.7.1
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r3
sys-kernel/linux-headers: 3.4 (virtual/os-headers)
sys-libs/glibc:           2.15-r2
Repositories: gentoo o11c toolchain games gamerlay-stable
ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-O2 -pipe -march=native -ggdb"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-O2 -pipe -march=native -ggdb -Wno-c++0x-compat"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles news parallel-fetch parse-eapi-ebuild-head protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"
FFLAGS=""
GENTOO_MIRRORS="http://gentoo.mirrors.easynews.com/linux/gentoo/ http://distro.ibiblio.org/pub/linux/distributions/gentoo/ http://gentoo.osuosl.org/ ftp://ftp.wallawalla.edu/pub/mirrors/ftp.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j3 -l 0.7"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage /var/lib/layman/toolchain /var/lib/layman/games /var/lib/layman/gamerlay"
SYNC="rsync://rsync.us.gentoo.org/gentoo-portage"
USE="X acl alsa amd64 avahi bash-completion berkdb bzip2 cli consolekit cracklib crypt cups cxx dbus doc dri ffmpeg flac fortran gdbm gpm gtk hal hscolour iconv icu ipv6 jpeg kde midi mikmod mmx mng modules mp3 mp4 mpeg mudflap multilib ncurses nptl ogg opengl openmp pam pcre png pppd qt3support qt4 readline sdl session sql sse sse2 ssl svg tcpd threads tiff timidity truetype unicode usb vorbis webkit wxwidgets xinerama xorg zeroconf zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="evdev synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="nvidia" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 1 theodor 2012-05-28 12:12:57 UTC
Happens here under x86, too.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-05-28 15:31:01 UTC
ryao, you are better at that stuff ;P.
Comment 3 Ostashevskyi Viktor 2012-05-28 19:38:47 UTC
I can also reproduce on x86.
Comment 4 Richard Yao (RETIRED) gentoo-dev 2012-05-28 21:52:52 UTC
Would someone affected by this attach the contents of /usr/include/c++/4.6.2/new and also the output of `equery belongs /usr/include/c++/4.6.2/new`?

It would also be helpful if you could provide the output of the following command in the go into the /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt directory: 

/var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/clang -Wall -Werror -O3 -fomit-frame-pointer -m64 -c -fno-exceptions -fPIC -funwind-tables -o /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-x86_64/x86_64/SubDir.lib__asan/asan_new_delete.o /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc -v

It is what triggered the failure, with -v added so we can see what the include paths are.
Comment 5 Richard Yao (RETIRED) gentoo-dev 2012-05-28 21:57:51 UTC
As a side note, this failure occurs because something installed /usr/include/c++, which does not exist on my system. It should be possible to workaround this failure by renaming that directory to /usr/include/c++-old before compiling Clang.

It would be best to understand what installed it and why it triggers a failure, which is what the questions in my previous comment are designed to do.
Comment 6 Ben Longbons 2012-05-28 22:36:28 UTC
Created attachment 313441 [details]
clang error with -v

I made the /usr/include/c++/ directory with symlinks to the real header dirs (/usr/include/c++/4.6.2 -> /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/), because that's where everybody else installs the headers. (gcc[USE=vanilla] might also trigger this, though I didn't do that)

So /usr/include/c++/4.6.2/new doesn't belong to any package, but it is really /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/new, which belongs to =sys-devel/gcc-4.6.2

Normally bits/c++config.h is include/c++/$GCCVERSION/x86_64-unknown-linux-gnu/bits/c++config.h, but gentoo installs it to /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/x86_64-pc-linux-gnu/bits/c++config.h (note the extra /x86_64-pc-linux-gnu/)

So although I brought this problem upon myself, there are still two issues:
1. why is gentoo not using the standard include paths? (it's not like /usr is anything close to multiarch capable, like debian is doing)
2. clang is using its own diagnostics instead of the active gcc's specs. (I'm probably lucky I haven't added the 4.7.0 symlink yet, because it would probably use that and find something that would mess up even worse)
Comment 7 ninuje 2012-05-28 23:21:52 UTC
Created attachment 313449 [details]
verbose error on x86
Comment 8 ninuje 2012-05-28 23:22:57 UTC
(In reply to comment #7)
> Created attachment 313449 [details]
> verbose error on x86

That's on my ~x86 box, FWIW.

Also:

equery f gcc | grep -e 'new$' -e 'c++config.h$'
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu/bits/c++config.h
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/new
Comment 9 Christoph Junghans (RETIRED) gentoo-dev 2012-05-29 00:00:39 UTC
Same on my x86 system.
Comment 10 Richard Yao (RETIRED) gentoo-dev 2012-05-29 01:27:48 UTC
(In reply to comment #6)
> Created attachment 313441 [details]
> clang error with -v
> 
> I made the /usr/include/c++/ directory with symlinks to the real header dirs
> (/usr/include/c++/4.6.2 ->
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/), because that's
> where everybody else installs the headers. (gcc[USE=vanilla] might also
> trigger this, though I didn't do that)
> 
> So /usr/include/c++/4.6.2/new doesn't belong to any package, but it is
> really /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/new, which
> belongs to =sys-devel/gcc-4.6.2
> 
> Normally bits/c++config.h is
> include/c++/$GCCVERSION/x86_64-unknown-linux-gnu/bits/c++config.h, but
> gentoo installs it to
> /usr/lib/gcc/x86_64-pc-linux-gnu/4.6.2/include/g++-v4/x86_64-pc-linux-gnu/
> bits/c++config.h (note the extra /x86_64-pc-linux-gnu/)

At present, /usr/include/c++ should not exist on a Gentoo Linux system. It should only exist on Gentoo FreeBSD. Please make a tarball of it and attach that to this bug so I can examine it. After you make the tarball, you should remove /usr/include/c++ from your system. It should not be there.

> So although I brought this problem upon myself, there are still two issues:
> 1. why is gentoo not using the standard include paths? (it's not like /usr
> is anything close to multiarch capable, like debian is doing)

I patched Clang so that it should use GCC's includes, but for some reason, it is not doing that on your system. Please post the contents of /etc/env.d/gcc/config-x86_64-pc-linux-gnu.

> 2. clang is using its own diagnostics instead of the active gcc's specs.
> (I'm probably lucky I haven't added the 4.7.0 symlink yet, because it would
> probably use that and find something that would mess up even worse)

It should not do that. The patch I wrote for bug #406163 should make it obey the system gcc-config setting, but something is going wrong with this on your system.

It would be helpful if you could reproduce the failure one more time and run `strace /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/clang -Wall -Werror -O3 -fomit-frame-pointer -m64 -c -fno-exceptions -fPIC -funwind-tables -o /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-x86_64/x86_64/SubDir.lib__asan/asan_new_delete.o /var/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc` Piping the output to a file (e.g. `... 2>&1 > strace-clang.log) and posting it would provide me with valuable information on what is happening inside your system.

(In reply to comment #8)
> (In reply to comment #7)
> > Created attachment 313449 [details]
> > verbose error on x86
> 
> That's on my ~x86 box, FWIW.
> 
> Also:
> 
> equery f gcc | grep -e 'new$' -e 'c++config.h$'
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu/bits/
> c++config.h
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/new

The following patch that I sent upstream should have prevented this issue on your system, but something is going wrong:

http://llvm.org/bugs/attachment.cgi?id=8648&action=diff

Would you use the instructions I provided to Ben to provide strace output? I want to see precisely what your system is using for getDriver().DefaultTargetTriple and I should be able to determine that from the strace output.
Comment 11 Jean-Francois Ostiguy 2012-05-29 02:25:18 UTC
same issue on my x86 box.
Comment 12 ninuje 2012-05-29 03:10:21 UTC
Created attachment 313467 [details]
strace output

Here's what strace has to say about it :).

And just in case:

cat /etc/env.d/gcc/config-i686-pc-linux-gnu
CURRENT=i686-pc-linux-gnu-4.6.3
Comment 13 Andrew Church 2012-05-29 04:30:21 UTC
FWIW, I see this on ~x86 without /usr/include/c++ existing:
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/new:40:10: fatal error: 'bits/c++config.h' file not found

$ find /usr -name c++config.h
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu/bits/c++config.h
/usr/lib/gcc/mingw32/4.6.3/include/g++-v4/mingw32/bits/c++config.h

$ cat /etc/env.d/gcc/config-i686-pc-linux-gnu 
CURRENT=i686-pc-linux-gnu-4.6.3
Comment 14 Richard Yao (RETIRED) gentoo-dev 2012-05-29 04:34:59 UTC
(In reply to comment #12)
> Created attachment 313467 [details]
> strace output
> 
> Here's what strace has to say about it :).
> 
> And just in case:
> 
> cat /etc/env.d/gcc/config-i686-pc-linux-gnu
> CURRENT=i686-pc-linux-gnu-4.6.3

The reason this does not work on your system is because Clang is looking for /etc/env.d/gcc/config-i386-pc-linux-gnu. You can confirm that this is the case by doing `ln -s config-i686-pc-linux-gnu /etc/env.d/gcc/config-i386-pc-linux-gnu` to install a symlink as a workaround.

I will need to rework my patch to handle the situation where the CHOST is not config-i386-pc-linux-gnu on x86.

With that said, I would appreciate strace information from anyone suffering from this problem on amd64 or some other architecture. That would let me know what is going wrong there.
Comment 15 Andrew Church 2012-05-29 05:43:46 UTC
(In reply to comment #14)
> The reason this does not work on your system is because Clang is looking for
> /etc/env.d/gcc/config-i386-pc-linux-gnu. You can confirm that this is the
> case by doing `ln -s config-i686-pc-linux-gnu
> /etc/env.d/gcc/config-i386-pc-linux-gnu` to install a symlink as a
> workaround.

Sorry, this doesn't work for me:

$ ls -l /etc/env.d/gcc
total 16
lrwxrwxrwx   1 root     root           24 May 29 13:56 config-i386-pc-linux-gnu -> config-i686-pc-linux-gnu
-rw-r--r--   1 root     root           32 May 28 00:46 config-i686-pc-linux-gnu
-rw-r--r--   1 root     root           22 May 25 00:14 config-mingw32
-rw-r--r--   1 root     root          235 May 22 23:25 i686-pc-linux-gnu-4.6.3
-rw-r--r--   1 root     root          229 May 25 00:14 mingw32-4.6.3

$ (cd /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt; strace -fo/tmp/t /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/clang -Wall -Werror -O3 -fomit-frame-pointer -m32 -c -fno-exceptions -fPIC -funwind-tables -o /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_new_delete.o /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc -v)
clang version 3.1 (branches/release_31)
Target: i386-pc-linux-gnu
Thread model: posix
 "/tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj -disable-free -disable-llvm-verifier -main-file-name asan_new_delete.cc -pic-level 2 -masm-verbose -mconstructor-aliases -munwind-tables -target-cpu pentium4 -target-linker-version 2.22 -momit-leaf-frame-pointer -v -coverage-file /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_new_delete.o -resource-dir /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4 -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/backward -internal-isystem /usr/local/include -internal-isystem /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/../lib/clang/3.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -Wall -Werror -fdeprecated-macro -fdebug-compilation-dir /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt -ferror-limit 19 -fmessage-length 163 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fdiagnostics-show-option -fcolor-diagnostics -o /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_new_delete.o -x c++ /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc
clang -cc1 version 3.1 based upon LLVM 3.1 default target i386-pc-linux-gnu
ignoring nonexistent directory "/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4
 /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/backward
 /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/Release/bin/../lib/clang/3.1/include
 /usr/include
End of search list.
In file included from /tmp/portage/sys-devel/clang-3.1-r2/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:19:
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/new:40:10: fatal error: 'bits/c++config.h' file not found
Comment 16 ninuje 2012-05-29 06:37:23 UTC
Created attachment 313481 [details]
strace output, bis

Yeah, me neither.

And the strace output is only marginally different.
Comment 17 Andrew Church 2012-05-29 06:49:43 UTC
(In reply to comment #16)
> And the strace output is only marginally different.

A quick note -- you might want to run strace with the -f option, so it follows forks (note the vfork call near the end of your trace, which forks a child to run the actual compiler binary).  That said, I'm not familiar with clang's internals, so I don't know whether the information Richard wants is in the parent or child process.
Comment 18 Richard Yao (RETIRED) gentoo-dev 2012-05-29 07:58:20 UTC
(In reply to comment #17)
> (In reply to comment #16)
> > And the strace output is only marginally different.
> 
> A quick note -- you might want to run strace with the -f option, so it
> follows forks (note the vfork call near the end of your trace, which forks a
> child to run the actual compiler binary).  That said, I'm not familiar with
> clang's internals, so I don't know whether the information Richard wants is
> in the parent or child process.

The parent had all of the information that I needed. I am split between many different bugs at the moment, but I will try to give the code some direct attention tomorrow.

Before I do, one last thing that might help me would be whether or not this issue occurs with sys-devel/clang-3.1-r1.
Comment 19 ninuje 2012-05-29 08:03:45 UTC
(In reply to comment #18)
> Before I do, one last thing that might help me would be whether or not this
> issue occurs with sys-devel/clang-3.1-r1.

Given the fact that it occurs in compiler-rt and that AFAICT 3.1-r1 didn't build it, 3.1-r1 should work ;). I haven't tried -r1, but FWIW, the initial 3.1 ebuild did install poperly on this system.
Comment 20 Richard Yao (RETIRED) gentoo-dev 2012-05-29 08:05:01 UTC
(In reply to comment #19)
> (In reply to comment #18)
> > Before I do, one last thing that might help me would be whether or not this
> > issue occurs with sys-devel/clang-3.1-r1.
> 
> Given the fact that it occurs in compiler-rt and that AFAICT 3.1-r1 didn't
> build it, 3.1-r1 should work ;). I haven't tried -r1, but FWIW, the initial
> 3.1 ebuild did install poperly on this system.

I observed a similar failure in earlier ebuild revisions, so I am curious if -r1 is affected.
Comment 21 Adrian Bassett 2012-05-29 08:11:03 UTC
> Before I do, one last thing that might help me would be whether or not this
> issue occurs with sys-devel/clang-3.1-r1.

I am seeing the same problem on x86 (OK on amd64).  There was no problem with clang-3.1-r1;  I have no /usr/include/c++, and am using gcc-4.5.3 (Gentoo 4.5.3-r2 p1.1, pie-0.4.7).
Comment 22 ninuje 2012-05-29 08:22:17 UTC
(In reply to comment #20)
> I observed a similar failure in earlier ebuild revisions, so I am curious if
> -r1 is affected.

-r1 installs successfully :).
Comment 23 Christoph Junghans (RETIRED) gentoo-dev 2012-05-29 16:37:47 UTC
-r1 works!
Comment 24 Benjamin Block 2012-06-02 15:43:38 UTC
same bug for me on a x86-system with gcc-4.6.3 (no /usr/inlcude/c++).
sys-devel/clang-3.1-r1 compiled just fine.
Comment 25 Lyall Pearce 2012-06-03 08:41:14 UTC
-r2 failed for me also in my basic VirtualBox VM.

# emerge --info
Portage 2.1.10.49 (default/linux/x86/10.0/desktop, gcc-4.5.3, glibc-2.14.1-r3, 3.2.12-gentoo i686)
=================================================================
System uname: Linux-3.2.12-gentoo-i686-Intel-R-_Core-TM-2_Quad_CPU_Q9400_@_2.66GHz-with-gentoo-2.1
Timestamp of tree: Sun, 03 Jun 2012 06:05:01 +0000
app-shells/bash:          4.2_p20
dev-java/java-config:     2.1.11-r3
dev-lang/python:          2.7.3-r1, 3.2.3
dev-util/cmake:           2.8.7-r5
dev-util/pkgconfig:       0.26
sys-apps/baselayout:      2.1-r1
sys-apps/openrc:          0.10.2
sys-apps/sandbox:         2.5
sys-devel/autoconf:       2.13, 2.68
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.21.1-r1
sys-devel/gcc:            4.5.3-r2
sys-devel/gcc-config:     1.5-r2
sys-devel/libtool:        2.4-r1
sys-devel/make:           3.82-r1
sys-kernel/linux-headers: 3.1 (virtual/os-headers)
sys-libs/glibc:           2.14.1-r3
Repositories: gentoo x-local
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -mtune=i686 -march=i686 -fomit-frame-pointer -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mtune=i686 -march=i686 -fomit-frame-pointer -pipe"
DISTDIR="/portage/distfiles"
FEATURES="assume-digests binpkg-logs collision-protect distlocks ebuild-locks fixlafiles news nostrip parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="ftp://mirror.internode.on.net/pub/gentoo ftp://mirror.pacific.net.au/linux/Gentoo http://mymirror.asiaosc.org/gentoo/ http://www.zentek-international.com/mirrors/gentoo/ http://open-systems.ufl.edu/mirrors/gentoo http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_AU.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j3"
PKGDIR="/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/tmp"
PORTDIR="/portage"
PORTDIR_OVERLAY="/portage/local"
SYNC="rsync://hawk.gentoo.org/gentoo-portage"
USE="X a52 aac acl acpi alsa apache2 avahi berkdb bindist bluetooth branding bzip2 cairo cdb cdda cddb cdparanoia cdr cli consolekit cracklib crypt css cups cxx daap dbus dri dts dvb dvd dvdr emboss encode exif fam ffmpeg firefox flac fortran gdbm gif gnome gpm gtk iconv ipv6 java javascript joystick jpeg jpeg2k kde latin1 lcms libnotify lirc mad mdnsresponder-compat mikmod mmxext mng modules mp3 mp4 mpeg mplayer mudflap mysql ncurses nls nptl nsplugin ogg opengl openmp oss pam pango pcre pdf png policykit posix ppds pppd qt3support qt4 readline rss samba sdl server session spell sqlite sse3 ssl startup-notification svg tcpd threads tiff transcode truetype type1 udev udisks unicode upower usb v4l vcd vorbis wma wxwidgets x264 x86 xcb xcomposite xine xml xorg xulrunner xv xvid xvmc zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon authn_dbd authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_lock dbd deflate dir disk_cache env expires ext_filter file_cache filter headers ident imagemap include info log_config logio mem_cache mime mime_magic negotiation proxy proxy_ajp proxy_balancer proxy_connect proxy_http rewrite setenvif so speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" PHP_TARGETS="php5-3" PYTHON_TARGETS="python3_2 python2_7" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="vesa fbdev" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON
Comment 26 Ben Longbons 2012-06-03 21:34:24 UTC
(Sorry, but I only have access to this system on weekends.)

I moved /usr/include/c++ out of the way, and -r2 built&merged fine.
Then I moved it back into place and did ebuild clang-3.1-r1.ebuild install (i.e. everything but actually merging it into the filesystem) -r1, and that went fine.

(although there is an unimportant permissions error if you run the 'install' stage as a normal user in the 'portage' group)

I still don't understand why gentoo doesn't use /usr/include/c++ like everybody else.
Comment 27 theodor 2012-06-04 11:57:54 UTC
There is no /usr/include/c++ on my system and while I can emerge clang-3.1-r1, clang++ doesn't work. A simple Hello-World-program (using iostreams) fails to compile with the following error message:

In file included from test.cc:1:
/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/iostream:38:10: fatal error: 
      'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.
Comment 28 Richard Yao (RETIRED) gentoo-dev 2012-06-05 02:05:23 UTC
I have committed sys-devel/clang-3.1-r3, which should fix the issues people have had.

If this is not fixed for anyone, let me know and I will reopen the bug.
Comment 29 Richard Yao (RETIRED) gentoo-dev 2012-06-05 02:11:33 UTC
(In reply to comment #26)
> I still don't understand why gentoo doesn't use /usr/include/c++ like
> everybody else.

The headers in /usr/include/c++ are from libstdc++, which is bundled into GCC. Gentoo allows people to choose the version of GCC they use, so libstdc++ headers cannot go in /usr/include/c++.
Comment 30 ninuje 2012-06-05 05:14:27 UTC
Created attachment 314251 [details]
strace log (3.1-r3)

-r3 still fails to build here (~x86), sorry ;).
Comment 31 Christoph Junghans (RETIRED) gentoo-dev 2012-06-05 05:20:11 UTC
Same for me!
Comment 32 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2012-06-05 07:43:32 UTC
(In reply to comment #30)
> Created attachment 314251 [details]
> strace log (3.1-r3)
> 
> -r3 still fails to build here (~x86), sorry ;).

I've package.masked the revbump so people wouldn't have to rebuild it unnecessarily. Sorry.
Comment 33 theodor 2012-06-05 13:32:26 UTC
clang-3.1-r3 still fails to compile because of missing bits/c++config.h (on x86, no /usr/include/c++).
Comment 34 Stuart Shelton 2012-06-06 00:32:00 UTC
Same problem with 3.1-r3 on x86 without USE="vanilla" for gcc.
Comment 35 Richard Yao (RETIRED) gentoo-dev 2012-06-06 00:38:48 UTC
(In reply to comment #30)
> Created attachment 314251 [details]
> strace log (3.1-r3)
> 
> -r3 still fails to build here (~x86), sorry ;).

I had thought that the failure was triggered by not finding the proper include paths, but that does not appear to be the case. At least, it is not the case in the situation that you are having.

Would you follow the instructions I posted in comment #4 to provide the output with -v specified?

(In reply to comment #34)
> Same problem with 3.1-r3 on x86 without USE="vanilla" for gcc.

Does using a GCC built with USE="vanilla" make it work?
Comment 36 ninuje 2012-06-06 01:26:26 UTC
Created attachment 314365 [details]
verbose output (3.1-r3)

Here you go.

From what I gather, it's still looking in /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu instead of usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu
Comment 37 Richard Yao (RETIRED) gentoo-dev 2012-06-06 01:44:54 UTC
(In reply to comment #36)
> Created attachment 314365 [details]
> verbose output (3.1-r3)
> 
> Here you go.
> 
> From what I gather, it's still looking in
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu
> instead of
> usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu

Well, before -r3, it would have looked in /usr/lib/gcc/i386-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu, which was wrong.

With -r3, it looks in /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu, which is still wrong, but a step in the right direction.

Try doing this and let me know if it addresses the issue:

ebuild /usr/portage/sys-devel/clang/clang-3.1-r3.ebuild prepare && patch -R -p1 -d /var/tmp/portage/sys-devel/clang-3.1-r3/work < /usr/portage/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch && ebuild /usr/portage/sys-devel/clang/clang-3.1-r3.ebuild merge

It seems that I wrote clang-3.1-gentoo-linux-fix-cxx-include.patch without realizing that there was really an issue in clang-3.1-gentoo-runtime-gcc-detection.patch. Now that clang-3.1-gentoo-runtime-gcc-detection-r2.patch is in tree, clang-3.1-gentoo-linux-fix-cxx-include.patch appears to be no longer necessary, but I would like someone experiencing this issue to verify that theory before I commit -r4 to remove it from the tree.
Comment 38 ninuje 2012-06-06 03:54:47 UTC
Created attachment 314373 [details]
verbose output (tweaked 3.1-r3)

Nope, still doesn't build (the strace output is the same, so I didn't attach it).
Comment 39 Richard Yao (RETIRED) gentoo-dev 2012-06-06 04:25:33 UTC
(In reply to comment #38)
> Created attachment 314373 [details]
> verbose output (tweaked 3.1-r3)
> 
> Nope, still doesn't build (the strace output is the same, so I didn't attach
> it).

(In reply to comment #38)
> Created attachment 314373 [details]
> verbose output (tweaked 3.1-r3)
> 
> Nope, still doesn't build (the strace output is the same, so I didn't attach
> it).

Just to verify that there is only one issue that needs to be corrected, would you try `ln -s i386-pc-linux-gnu /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu`, build Clang and then delete that symlink?
Comment 40 ninuje 2012-06-06 05:30:26 UTC
(In reply to comment #39)
> Just to verify that there is only one issue that needs to be corrected,
> would you try `ln -s i386-pc-linux-gnu
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu`,
> build Clang and then delete that symlink?

With or without the patch removed?

And are you sure about that symlink, because I just end up with a broken

/usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu/i386-pc-linux-gnu -> i386-pc-linux-gnu 

?
Comment 41 Lyall Pearce 2012-06-06 05:43:50 UTC
FYI: I tried the commands described above to install -r3, the compilation failed.


The commands I used:-

ebuild /portage/sys-devel/clang/clang-3.1-r3.ebuild prepare && 
    patch -R -p1 -d /tmp/portage/sys-devel/clang-3.1-r3/work < /portage/sys-devel/clang/files/clang-3.1-gentoo-linux-fix-cxx-include.patch && 
    ebuild /portage/sys-devel/clang/clang-3.1-r3.ebuild merge

(I have relocated /usr/src/portage and /var/tmp/portage)

The compilation output (after about half an hour in my VirtualBox VM)

...

  COMPILE:   clang_linux/asan-i386/i386: /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_poisoning.cc
/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/Release/bin/clang -Wall -Werror -O3 -fomit-frame-pointer -m32 -c -fno-exceptions -fPIC -funwind-tables -o /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_poisoning.o /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_poisoning.cc
  COMPILE:   clang_linux/asan-i386/i386: /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc
/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/Release/bin/clang -Wall -Werror -O3 -fomit-frame-pointer -m32 -c -fno-exceptions -fPIC -funwind-tables -o /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_posix.o /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc
In file included from /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_new_delete.cc:19:
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/new:40:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/cstddef:42:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.
make[4]: *** [/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_new_delete.o] Error 1
make[4]: *** Waiting for unfinished jobs....
In file included from /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt/lib/asan/asan_posix.cc:35:
In file included from /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/algorithm:60:
/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/utility:68:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.
make[4]: *** [/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime/compiler-rt/clang_linux/asan-i386/i386/SubDir.lib__asan/asan_posix.o] Error 1
make[4]: Leaving directory `/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/projects/compiler-rt'
make[3]: *** [BuildRuntimeLibraries] Error 2
rm /tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/Release/lib/clang/3.1/lib/linux/.dir
make[3]: Leaving directory `/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime/compiler-rt'
make[2]: *** [compiler-rt/.makeall] Error 2
make[2]: Leaving directory `/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang/runtime'
make[1]: *** [all] Error 1
make[1]: Leaving directory `/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src/tools/clang'
make: *** [all] Error 1
 * ERROR: sys-devel/clang-3.1-r3 failed (compile phase):
 *   emake failed
 * 
 * If you need support, post the output of 'emerge --info =sys-devel/clang-3.1-r3',
 * the complete build log and the output of 'emerge -pqv =sys-devel/clang-3.1-r3'.
 * The complete build log is located at '/var/log/emerge/sys-devel:clang-3.1-r3:20120602-185344.log'.
 * The ebuild environment file is located at '/tmp/portage/sys-devel/clang-3.1-r3/temp/environment'.
 * S: '/tmp/portage/sys-devel/clang-3.1-r3/work/llvm-3.1.src'
root@lyalls-vc tmp
Comment 42 Richard Yao (RETIRED) gentoo-dev 2012-06-06 07:05:45 UTC
(In reply to comment #40)
> (In reply to comment #39)
> > Just to verify that there is only one issue that needs to be corrected,
> > would you try `ln -s i386-pc-linux-gnu
> > /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu`,
> > build Clang and then delete that symlink?
> 
> With or without the patch removed?
> 
> And are you sure about that symlink, because I just end up with a broken
> 
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i686-pc-linux-gnu/i386-
> pc-linux-gnu -> i386-pc-linux-gnu 
> 
> ?

My apologies. That symlink should have been: `ln -s i686-pc-linux-gnu /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu`

At the moment, I don't have a x86 system to test, so I am writing these from memory.
Comment 43 ninuje 2012-06-06 18:25:56 UTC
(In reply to comment #42)
> 
> My apologies. That symlink should have been: `ln -s i686-pc-linux-gnu
> /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu`
> 
> At the moment, I don't have a x86 system to test, so I am writing these from
> memory.


3.1-r3 (from the tree, untouched) builds fine with the symlink. It also seems to be working okay ;).
Comment 44 Christoph Junghans (RETIRED) gentoo-dev 2012-06-06 22:52:02 UTC
(In reply to comment #43)
> (In reply to comment #42)
> > 
> > My apologies. That symlink should have been: `ln -s i686-pc-linux-gnu
> > /usr/lib/gcc/i686-pc-linux-gnu/4.6.3/include/g++-v4/i386-pc-linux-gnu`
> > 
> > At the moment, I don't have a x86 system to test, so I am writing these from
> > memory.
> 
> 
> 3.1-r3 (from the tree, untouched) builds fine with the symlink. It also
> seems to be working okay ;).
Actually I just realized that, 3.1-r1 builds, but the compiler doesn't work in the end om ym x86 box.

Error from cmake configure run:
Determining if the include file cmath exists failed with the following output:
...
/usr/lib/gcc/i686-pc-linux-gnu/4.7.0/include/g++-v4/cmath:42:10: fatal error: 'bits/c++config.h' file not found
#include <bits/c++config.h>
         ^
1 error generated.

So I guess we should mask clang-3.1-r[123] on x86.
Comment 45 Richard Yao (RETIRED) gentoo-dev 2012-06-07 00:30:20 UTC
I have committed sys-devel/clang-r4. I reproduced this issue in a x86 chroot and then tweaked our patches to address it. I am confident this should resolve the issue in the previous versions. Let us know if it does not.
Comment 46 Andrew Church 2012-06-07 03:56:52 UTC
Confirming that it installs successfully and builds source correctly on x86.
Comment 47 Lyall Pearce 2012-06-09 07:19:48 UTC
(In reply to comment #46)
> Confirming that it installs successfully and builds source correctly on x86.

It installs, but I can't even get it to compile the following code.
I am not a c++ programmer so I could be completely off base here.

#include <iostream>
int main() {
 std::cout << "Hello." << std::endl;
 return 0;
}

whilst g++ is quite happy to.


root@lyalls-vc tmp 
root@lyalls-vc tmp 
# g++ hello.cpp -o hello
root@lyalls-vc tmp 
# ./hello
hello.
# rm hello; clang -v hello.cpp -o hello
clang version 3.1 (branches/release_31)
Target: i386-pc-linux-gnu
Thread model: posix
 "/usr/bin/clang" -cc1 -triple i386-pc-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name hello.cpp -mrelocation-model static -mdisable-fp-elim -masm-verbose -mconstructor-aliases -target-cpu pentium4 -target-linker-version 2.21.1 -momit-leaf-frame-pointer -v -resource-dir /usr/bin/../lib/clang/3.1 -fmodule-cache-path /var/tmp/clang-module-cache -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4 -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/i686-pc-linux-gnu -internal-isystem /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/backward -internal-isystem /usr/local/include -internal-isystem /usr/bin/../lib/clang/3.1/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -fdeprecated-macro -fdebug-compilation-dir /tmp -ferror-limit 19 -fmessage-length 80 -mstackrealign -fgnu-runtime -fobjc-runtime-has-arc -fobjc-runtime-has-weak -fobjc-fragile-abi -fcxx-exceptions -fexceptions -fdiagnostics-show-option -o /tmp/hello-mkHgCa.o -x c++ hello.cpp
clang -cc1 version 3.1 based upon LLVM 3.1 default target i386-pc-linux-gnu
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/include/g++-v4/backward
 /usr/bin/../lib/clang/3.1/include
 /usr/include
End of search list.
 "/usr/bin/ld" --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o hello /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../crt1.o /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../crti.o /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtbegin.o -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3 -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../i686-pc-linux-gnu/lib -L/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../.. -L/lib -L/usr/lib /tmp/hello-mkHgCa.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/crtend.o /usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../crtn.o
/tmp/hello-mkHgCa.o: In function `main':
hello.cpp:(.text+0x8): undefined reference to `std::cout'
hello.cpp:(.text+0x21): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'
hello.cpp:(.text+0x27): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)'
hello.cpp:(.text+0x33): undefined reference to `std::ostream::operator<<(std::ostream& (*)(std::ostream&))'
/tmp/hello-mkHgCa.o: In function `__cxx_global_var_init':
hello.cpp:(.text.startup+0x10): undefined reference to `std::ios_base::Init::Init()'
hello.cpp:(.text.startup+0x16): undefined reference to `std::ios_base::Init::~Init()'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
root@lyalls-vc tmp 
#
Comment 48 Lyall Pearce 2012-06-09 07:24:16 UTC
Ignore my previous comment, I simply did not use 'clang++', rather than 'clang', on the mistaken believe that clang detected the language by filename.
It does compile.
Comment 49 Ben Longbons 2012-06-11 02:04:15 UTC
On amd64, with my /usr/include/c++/* symlinks back in place:

Confirmed that -r4 emerges and produces a usable compiler that uses the correct include directories.

There's still a problem with certain headers like <chrono>, but that's a separate bug, probably in g++/libstdc++ ... it looks like the known bug in libstdc++-4.7, despite the fact that I'm using 4.6.2 ...

http://clang.llvm.org/cxx_status.html

(In reply to comment #29)
> (In reply to comment #26)
> > I still don't understand why gentoo doesn't use /usr/include/c++ like
> > everybody else.
> 
> The headers in /usr/include/c++ are from libstdc++, which is bundled into
> GCC. Gentoo allows people to choose the version of GCC they use, so
> libstdc++ headers cannot go in /usr/include/c++.
But they go in a subdirectory. Even with USE=multislot, it only uses through the minor number - /usr/include/c++/4.6.2/ should be sufficiently unique ...

(now the only thing I'm wondering is why clang is looking for /include)