Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 643302

Summary: sys-libs/glibc - emerge on profile 17.1 fails when "/usr/lib/include" (untracked by package manager) exists
Product: Gentoo Linux Reporter: Laslo Hunhold <dev>
Component: Current packagesAssignee: Gentoo Toolchain Maintainers <toolchain>
Status: RESOLVED FIXED    
Severity: normal CC: alexander, dev, rzubaly, sam, slyfox, thomas
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=833620
Whiteboard: 17.1 profiles
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 506276    
Attachments: build.log

Description Laslo Hunhold 2018-01-03 19:06:29 UTC
Created attachment 513120 [details]
build.log

I recently switched to the new 17.1 profile and did a complete world-rebuild, including gcc. All packages compiled successfully, with the exception of glibc.
The versions of glibc I tried emerging were 2.26-r3 and 2.26-r5, both failing the same way:

Right at the beginning of compilation, it complains about not finding stddef.h and stdbool.h. I suspect it has something to do with the order I emerged glibc and gcc during the world-rebuild, possibly removing something from which the ebuild cannot recover from.

Attached you can find the full build-log and the following is my emerge --info:

Portage 2.3.19 (python 3.5.4-final-0, default/linux/amd64/17.1, gcc-7.2.0, glibc-2.26-r3, 4.14.9 x86_64)
=================================================================
System uname: Linux-4.14.9-x86_64-Intel-R-_Core-TM-_i7-3720QM_CPU_@_2.60GHz-with-gentoo-2.4.1
KiB Mem:    16305044 total,    349472 free
KiB Swap:          0 total,         0 free
Timestamp of repository gentoo: Wed, 03 Jan 2018 18:30:01 +0000
Head commit of repository gentoo: 0012abc6273f02d8932dbf833522416694ee9dff
sh bash 4.4_p12
ld GNU ld (Gentoo 2.29.1 p3) 2.29.1
app-shells/bash:          4.4_p12::gentoo
dev-java/java-config:     2.2.0-r3::gentoo
dev-lang/perl:            5.26.1-r1::gentoo
dev-lang/python:          2.7.14-r1::gentoo, 3.5.4-r1::gentoo
dev-util/cmake:           3.10.1::gentoo
dev-util/pkgconfig:       0.29.2::gentoo
sys-apps/baselayout:      2.4.1-r2::gentoo
sys-apps/openrc:          0.34.11::gentoo
sys-apps/sandbox:         2.12::gentoo
sys-devel/autoconf:       2.13::gentoo, 2.69-r4::gentoo
sys-devel/automake:       1.15.1-r1::gentoo
sys-devel/binutils:       2.29.1-r1::gentoo
sys-devel/gcc:            7.2.0::gentoo
sys-devel/gcc-config:     1.9.1::gentoo
sys-devel/libtool:        2.4.6-r4::gentoo
sys-devel/make:           4.2.1-r1::gentoo
sys-kernel/linux-headers: 4.14::gentoo (virtual/os-headers)
sys-libs/glibc:           2.26-r3::gentoo
Repositories:

gentoo
    location: /usr/portage
    sync-type: rsync
    sync-uri: rsync://rsync.gentoo.org/gentoo-portage
    priority: -1000
    sync-rsync-extra-opts:

x-portage
    location: /usr/local/portage
    masters: gentoo
    priority: 0

local-crossdev
    location: /usr/portage-musl
    masters: gentoo
    priority: 9999

ACCEPT_KEYWORDS="amd64 ~amd64"
ACCEPT_LICENSE="@FREE"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /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="-march=native -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--keep-going --with-bdeps=y --quiet-build=y --color=y --complete-graph"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distlocks ebuild-locks fixlafiles merge-sync multilib-strict news parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j8 -l4"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
USE="alsa amd64 bzip2 cli colord crypt cups cxx dri iconv ipv6 lcms multilib ncurses nptl offensive openmp readline seccomp ssl tk unicode zlib" ABI_X86="64 32" ALSA_CARDS="usb-audio" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd 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 author" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="aes avx f16c mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock isync itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 timing tsip tripmate tnt ublox ubx" INPUT_DEVICES="keyboard mouse joystick evdev" KERNEL="linux" L10N="en en_US" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" LINGUAS="en en_US" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-6 php7-0" POSTGRES_TARGETS="postgres9_5" PYTHON_SINGLE_TARGET="python3_5" PYTHON_TARGETS="python2_7 python3_5" RUBY_TARGETS="ruby24 ruby25" USERLAND="GNU" VIDEO_CARDS="intel i915 i965" 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:  CC, CPPFLAGS, CTARGET, CXX, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 1 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-03 21:41:26 UTC
Looks like your gcc in -m32 mode searches for headers in nonexistent location.

Let's check if gcc -m32 is working at all. Do both these commands succeed for you?

    $ echo '#include <stddef.h>' | gcc -x c -c -m32 - -o a.o
    $ echo '#include <stddef.h>' | gcc -x c -c      - -o a.o
Comment 2 Laslo Hunhold 2018-01-03 22:45:03 UTC
(In reply to Sergei Trofimovich from comment #1)
> Looks like your gcc in -m32 mode searches for headers in nonexistent
> location.
> 
> Let's check if gcc -m32 is working at all. Do both these commands succeed
> for you?
> 
>     $ echo '#include <stddef.h>' | gcc -x c -c -m32 - -o a.o
>     $ echo '#include <stddef.h>' | gcc -x c -c      - -o a.o

/tmp $ echo '#include <stddef.h>' | gcc -x c -c -m32 - -o a.o
/tmp $ echo $?
0
/tmp $ echo '#include <stddef.h>' | gcc -x c -c      - -o a.o
/tmp $ echo $?
0

Yes, this seems to work.
Comment 3 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-06 19:20:20 UTC
(In reply to Laslo Hunhold from comment #2)
> (In reply to Sergei Trofimovich from comment #1)
> > Looks like your gcc in -m32 mode searches for headers in nonexistent
> > location.
> > 
> > Let's check if gcc -m32 is working at all. Do both these commands succeed
> > for you?
> > 
> >     $ echo '#include <stddef.h>' | gcc -x c -c -m32 - -o a.o
> >     $ echo '#include <stddef.h>' | gcc -x c -c      - -o a.o
> 
> /tmp $ echo '#include <stddef.h>' | gcc -x c -c -m32 - -o a.o
> /tmp $ echo $?
> 0
> /tmp $ echo '#include <stddef.h>' | gcc -x c -c      - -o a.o
> /tmp $ echo $?
> 0
> 
> Yes, this seems to work.

That's unexpected. Let's try to explore the failure then.

I presume the command was ran from directory:
    '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/glibc-2.26/csu'

And it was:

gawk -f ../scripts/gen-as-const.awk ../sysdeps/x86/cpu-features-offsets.sym \
| x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed -S -o /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.hT3 -std=gnu11 -fgnu89-inline  -O2 -Wall -Wundef -Wwrite-strings -fmerge-all-constants -fno-strict-aliasing -frounding-math -fstack-protector-all -march=native -pipe -Wstrict-prototypes -Wold-style-definition -mpreferred-stack-boundary=4    -ftls-model=initial-exec   -U_FORTIFY_SOURCE   -I../include -I/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/csu  -I/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl  -I../sysdeps/unix/sysv/linux/i386/i686  -I../sysdeps/i386/i686/nptl  -I../sysdeps/unix/sysv/linux/i386  -I../sysdeps/unix/sysv/linux/x86  -I../sysdeps/x86/nptl  -I../sysdeps/i386/nptl  -I../sysdeps/unix/sysv/linux/include -I../sysdeps/unix/sysv/linux  -I../sysdeps/nptl  -I../sysdeps/pthread  -I../sysdeps/gnu  -I../sysdeps/unix/inet  -I../sysdeps/unix/sysv  -I../sysdeps/unix/i386  -I../sysdeps/unix  -I../sysdeps/posix  -I../sysdeps/i386/i686/fpu/multiarch  -I../sysdeps/i386/i686/fpu  -I../sysdeps/i386/i686/multiarch  -I../sysdeps/i386/i686  -I../sysdeps/i386/fpu  -I../sysdeps/x86/fpu/include -I../sysdeps/x86/fpu  -I../sysdeps/i386  -I../sysdeps/x86  -I../sysdeps/wordsize-32  -I../sysdeps/ieee754/float128  -I../sysdeps/ieee754/ldbl-96/include -I../sysdeps/ieee754/ldbl-96  -I../sysdeps/ieee754/dbl-64  -I../sysdeps/ieee754/flt-32  -I../sysdeps/ieee754  -I../sysdeps/generic  -I.. -I../libio -I. -nostdinc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed -isystem /usr/include  -D_LIBC_REENTRANT -include /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/libc-modules.h -DMODULE_NAME=libc -include ../include/libc-symbols.h       -DTOP_NAMESPACE=glibc -x c - \
        -MD -MP -MF /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.dT -MT '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.d /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h'

Try to reproduce it by running it as-is in that directory. If it fails the same way add '-v' flag to gcc invocation, for example by changing ' -m32 ' to ' -m32 -v ' and post the output. I'm interested in headers directory list.
Comment 4 Laslo Hunhold 2018-01-09 14:51:28 UTC
(In reply to Sergei Trofimovich from comment #3)

Sorry for the late response.

> That's unexpected. Let's try to explore the failure then.
> 
> I presume the command was ran from directory:
>     '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/glibc-2.26/csu'
> And it was:
> [...]
> Try to reproduce it by running it as-is in that directory. If it fails the
> same way add '-v' flag to gcc invocation, for example by changing ' -m32 '
> to ' -m32 -v ' and post the output. I'm interested in headers directory list.

Exactly! It failed the same way; With -v added, it gives the following output:

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0/x86_64-pc-linux-gnu-gcc
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/g++-v7 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/python --enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 7.2.0 p1.1' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.0 (Gentoo 7.2.0 p1.1) 
COLLECT_GCC_OPTIONS='-m32' '-v' '-S' '-o' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.hT3' '-std=gnu11' '-fgnu89-inline' '-O2' '-Wall' '-Wundef' '-Wwrite-strings' '-fmerge-all-constants' '-fno-strict-aliasing' '-frounding-math' '-fstack-protector-all' '-march=native' '-pipe' '-Wstrict-prototypes' '-Wold-style-definition' '-mpreferred-stack-boundary=4' '-ftls-model=initial-exec' '-U' '_FORTIFY_SOURCE' '-I' '../include' '-I' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/csu' '-I' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl' '-I' '../sysdeps/unix/sysv/linux/i386/i686' '-I' '../sysdeps/i386/i686/nptl' '-I' '../sysdeps/unix/sysv/linux/i386' '-I' '../sysdeps/unix/sysv/linux/x86' '-I' '../sysdeps/x86/nptl' '-I' '../sysdeps/i386/nptl' '-I' '../sysdeps/unix/sysv/linux/include' '-I' '../sysdeps/unix/sysv/linux' '-I' '../sysdeps/nptl' '-I' '../sysdeps/pthread' '-I' '../sysdeps/gnu' '-I' '../sysdeps/unix/inet' '-I' '../sysdeps/unix/sysv' '-I' '../sysdeps/unix/i386' '-I' '../sysdeps/unix' '-I' '../sysdeps/posix' '-I' '../sysdeps/i386/i686/fpu/multiarch' '-I' '../sysdeps/i386/i686/fpu' '-I' '../sysdeps/i386/i686/multiarch' '-I' '../sysdeps/i386/i686' '-I' '../sysdeps/i386/fpu' '-I' '../sysdeps/x86/fpu/include' '-I' '../sysdeps/x86/fpu' '-I' '../sysdeps/i386' '-I' '../sysdeps/x86' '-I' '../sysdeps/wordsize-32' '-I' '../sysdeps/ieee754/float128' '-I' '../sysdeps/ieee754/ldbl-96/include' '-I' '../sysdeps/ieee754/ldbl-96' '-I' '../sysdeps/ieee754/dbl-64' '-I' '../sysdeps/ieee754/flt-32' '-I' '../sysdeps/ieee754' '-I' '../sysdeps/generic' '-I' '..' '-I' '../libio' '-I' '.' '-nostdinc' '-isystem' '/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include' '-isystem' '/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed' '-isystem' '/usr/include' '-D' '_LIBC_REENTRANT' '-include' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/libc-modules.h' '-D' 'MODULE_NAME=libc' '-include' '../include/libc-symbols.h' '-D' 'TOP_NAMESPACE=glibc' '-MD' '-MP' '-MF' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.dT' '-MT' '/var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.d /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/cc1 -quiet -nostdinc -v -I ../include -I /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/csu -I /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl -I ../sysdeps/unix/sysv/linux/i386/i686 -I ../sysdeps/i386/i686/nptl -I ../sysdeps/unix/sysv/linux/i386 -I ../sysdeps/unix/sysv/linux/x86 -I ../sysdeps/x86/nptl -I ../sysdeps/i386/nptl -I ../sysdeps/unix/sysv/linux/include -I ../sysdeps/unix/sysv/linux -I ../sysdeps/nptl -I ../sysdeps/pthread -I ../sysdeps/gnu -I ../sysdeps/unix/inet -I ../sysdeps/unix/sysv -I ../sysdeps/unix/i386 -I ../sysdeps/unix -I ../sysdeps/posix -I ../sysdeps/i386/i686/fpu/multiarch -I ../sysdeps/i386/i686/fpu -I ../sysdeps/i386/i686/multiarch -I ../sysdeps/i386/i686 -I ../sysdeps/i386/fpu -I ../sysdeps/x86/fpu/include -I ../sysdeps/x86/fpu -I ../sysdeps/i386 -I ../sysdeps/x86 -I ../sysdeps/wordsize-32 -I ../sysdeps/ieee754/float128 -I ../sysdeps/ieee754/ldbl-96/include -I ../sysdeps/ieee754/ldbl-96 -I ../sysdeps/ieee754/dbl-64 -I ../sysdeps/ieee754/flt-32 -I ../sysdeps/ieee754 -I ../sysdeps/generic -I .. -I ../libio -I . -imultilib 32 -MD /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.d -MF /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.dT -MP -MT /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h.d /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.h -U _FORTIFY_SOURCE -D _LIBC_REENTRANT -D MODULE_NAME=libc -D TOP_NAMESPACE=glibc -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include -isystem /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed -isystem /usr/include -include /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/libc-modules.h -include ../include/libc-symbols.h - -march=ivybridge -mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -mno-sse4a -mcx16 -msahf -mno-movbe -maes -mno-sha -mpclmul -mpopcnt -mno-abm -mno-lwp -mno-fma -mno-fma4 -mno-xop -mno-bmi -mno-sgx -mno-bmi2 -mno-tbm -mavx -mno-avx2 -msse4.2 -msse4.1 -mno-lzcnt -mno-rtm -mno-hle -mrdrnd -mf16c -mfsgsbase -mno-rdseed -mno-prfchw -mno-adx -mfxsr -mxsave -mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf -mno-prefetchwt1 -mno-clflushopt -mno-xsavec -mno-xsaves -mno-avx512dq -mno-avx512bw -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps -mno-avx5124vnniw -mno-clwb -mno-mwaitx -mno-clzero -mno-pku -mno-rdpid --param l1-cache-size=32 --param l1-cache-line-size=64 --param l2-cache-size=6144 -mtune=ivybridge -quiet -dumpbase - -m32 -mpreferred-stack-boundary=4 -auxbase-strip /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.hT3 -O2 -Wall -Wundef -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -std=gnu11 -version -fgnu89-inline -fmerge-all-constants -fno-strict-aliasing -frounding-math -fstack-protector-all -ftls-model=initial-exec -o /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/cpu-features-offsets.hT3
GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
	compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
#include "..." search starts here:
#include <...> search starts here:
 ../include
 /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl/csu
 /var/tmp/portage/sys-libs/glibc-2.26-r5/work/build-x86-x86_64-pc-linux-gnu-nptl
 ../sysdeps/unix/sysv/linux/i386/i686
 ../sysdeps/i386/i686/nptl
 ../sysdeps/unix/sysv/linux/i386
 ../sysdeps/unix/sysv/linux/x86
 ../sysdeps/x86/nptl
 ../sysdeps/i386/nptl
 ../sysdeps/unix/sysv/linux/include
 ../sysdeps/unix/sysv/linux
 ../sysdeps/nptl
 ../sysdeps/pthread
 ../sysdeps/gnu
 ../sysdeps/unix/inet
 ../sysdeps/unix/sysv
 ../sysdeps/unix/i386
 ../sysdeps/unix
 ../sysdeps/posix
 ../sysdeps/i386/i686/fpu/multiarch
 ../sysdeps/i386/i686/fpu
 ../sysdeps/i386/i686/multiarch
 ../sysdeps/i386/i686
 ../sysdeps/i386/fpu
 ../sysdeps/x86/fpu/include
 ../sysdeps/x86/fpu
 ../sysdeps/i386
 ../sysdeps/x86
 ../sysdeps/wordsize-32
 ../sysdeps/ieee754/float128
 ../sysdeps/ieee754/ldbl-96/include
 ../sysdeps/ieee754/ldbl-96
 ../sysdeps/ieee754/dbl-64
 ../sysdeps/ieee754/flt-32
 ../sysdeps/ieee754
 ../sysdeps/generic
 ..
 ../libio
 .
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
 /usr/include
End of search list.
GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
	compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: be889270f9d56816f14b353acf5e36b0
In file included from ../include/sys/types.h:1:0,
                 from ../include/string.h:6,
                 from ../sysdeps/gnu/ldsodefs.h:24,
                 from ../sysdeps/unix/sysv/linux/ldsodefs.h:25,
                 from <stdin>:2:
../posix/sys/types.h:145:10: fatal error: stddef.h: No such file or directory
 #include <stddef.h>
          ^~~~~~~~~~
compilation terminated.
Comment 5 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-09 22:42:38 UTC
Aha! And for completeness the following outputs:

$ echo '#include <stddef.h>' | gcc -x c -c -m32 -v - -o a.o

$ ls -ld /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
Comment 6 Laslo Hunhold 2018-01-10 21:14:59 UTC
(In reply to Sergei Trofimovich from comment #5)
> Aha! And for completeness the following outputs:

The output is as follows:

> $ echo '#include <stddef.h>' | gcc -x c -c -m32 -v - -o a.o

Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0/gcc
Target: x86_64-pc-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0/configure --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0 --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0 --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/man --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/info --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/g++-v7 --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/python --enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt --disable-werror --with-system-zlib --disable-nls --enable-checking=release --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 7.2.0 p1.1' --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib --with-multilib-list=m32,m64 --disable-altivec
--disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx --enable-vtable-verify --enable-libvtv --enable-lto --without-isl --enable-libsanitizer --enable-default-pie --enable-default-ssp
Thread model: posix
gcc version 7.2.0 (Gentoo 7.2.0 p1.1)
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic' '-march=x86-64'
 /usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/cc1 -quiet -v -imultilib 32 - -quiet -dumpbase - -m32 -mtune=generic -march=x86-64 -auxbase-strip a.o -version -o /tmp/cc6LYq3R.s
GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
ignoring nonexistent directory "/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include
 /usr/local/include
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
 /usr/include
End of search list.
GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
        compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version 3.1.6, MPC version 1.0.3, isl version none
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
Compiler executable checksum: be889270f9d56816f14b353acf5e36b0
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic' '-march=x86-64'
 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/as -v --32 -o a.o /tmp/cc6LYq3R.s
GNU assembler version 2.29.1 (x86_64-pc-linux-gnu) using BFD version (Gentoo 2.29.1 p3) 2.29.1
COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/
LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic' '-march=x86-64'

> $ ls -ld /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
> /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed

drwxr-xr-x 3 root root 4096 Sep 19  2014 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
drwxr-xr-x 2 root root 4096 Jan  9 15:54 /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed

So yes, from what I noticed, the problem seems to be that it does not search in "/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include" during the glibc-emerge. Do you have any idea why that happens?
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-10 22:23:36 UTC
(In reply to Laslo Hunhold from comment #6)
> (In reply to Sergei Trofimovich from comment #5)
> > Aha! And for completeness the following outputs:
> 
> The output is as follows:
> 
> > $ echo '#include <stddef.h>' | gcc -x c -c -m32 -v - -o a.o
> 
> Using built-in specs.
> COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0/gcc
> Target: x86_64-pc-linux-gnu
> Configured with:
> /var/tmp/portage/sys-devel/gcc-7.2.0/work/gcc-7.2.0/configure
> --host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --prefix=/usr
> --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/7.2.0
> --includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include
> --datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0
> --mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/man
> --infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/info
> --with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/g++-v7
> --with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/7.2.0/python
> --enable-languages=c,c++,go,fortran --enable-obsolete --enable-secureplt
> --disable-werror --with-system-zlib --disable-nls --enable-checking=release
> --with-bugurl=https://bugs.gentoo.org/ --with-pkgversion='Gentoo 7.2.0 p1.1'
> --disable-esp --enable-libstdcxx-time --enable-shared --enable-threads=posix
> --enable-__cxa_atexit --enable-clocale=gnu --enable-multilib
> --with-multilib-list=m32,m64 --disable-altivec
> --disable-fixed-point --enable-targets=all --disable-libgcj --enable-libgomp
> --disable-libmudflap --disable-libssp --disable-libcilkrts --disable-libmpx
> --enable-vtable-verify --enable-libvtv --enable-lto --without-isl
> --enable-libsanitizer --enable-default-pie --enable-default-ssp
> Thread model: posix
> gcc version 7.2.0 (Gentoo 7.2.0 p1.1)
> COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic'
> '-march=x86-64'
>  /usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/cc1 -quiet -v -imultilib 32 -
> -quiet -dumpbase - -m32 -mtune=generic -march=x86-64 -auxbase-strip a.o
> -version -o /tmp/cc6LYq3R.s
> GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
>         compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version
> 3.1.6, MPC version 1.0.3, isl version none
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> ignoring nonexistent directory
> "/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/
> include"
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include
>  /usr/local/include
>  /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
>  /usr/include
> End of search list.
> GNU C11 (Gentoo 7.2.0 p1.1) version 7.2.0 (x86_64-pc-linux-gnu)
>         compiled by GNU C version 7.2.0, GMP version 6.1.2, MPFR version
> 3.1.6, MPC version 1.0.3, isl version none
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> Compiler executable checksum: be889270f9d56816f14b353acf5e36b0
> COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic'
> '-march=x86-64'
>  /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/
> as -v --32 -o a.o /tmp/cc6LYq3R.s
> GNU assembler version 2.29.1 (x86_64-pc-linux-gnu) using BFD version (Gentoo
> 2.29.1 p3) 2.29.1
> COMPILER_PATH=/usr/libexec/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/libexec/gcc/
> x86_64-pc-linux-gnu/7.2.0/:/usr/libexec/gcc/x86_64-pc-linux-gnu/:/usr/lib/
> gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/:/usr/lib/
> gcc/x86_64-pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/bin/
> LIBRARY_PATH=/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/32/:/usr/lib/gcc/x86_64-
> pc-linux-gnu/7.2.0/../../../../x86_64-pc-linux-gnu/lib/../lib/:/usr/lib/gcc/
> x86_64-pc-linux-gnu/7.2.0/../../../../lib/:/lib/../lib/:/usr/lib/../lib/:/
> usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.
> 0/../../../../x86_64-pc-linux-gnu/lib/:/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.
> 0/../../../:/lib/:/usr/lib/
> COLLECT_GCC_OPTIONS='-c' '-m32' '-v' '-o' 'a.o' '-mtune=generic'
> '-march=x86-64'
> 
> > $ ls -ld /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
> > /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
> 
> drwxr-xr-x 3 root root 4096 Sep 19  2014
> /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
> drwxr-xr-x 2 root root 4096 Jan  9 15:54
> /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include-fixed
> 
> So yes, from what I noticed, the problem seems to be that it does not search
> in "/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include" during the glibc-emerge.
> Do you have any idea why that happens?

Diffing against the empty chroot I've migrated to 17.1 I see the following differences:

1. I don't have this directory: /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include

Can you show what it resolves to? Say, via realpath:

    $ realpath /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include

And what is in there.

2. gcc did not ignore /usr/local/include for you. Do you have anything there that could fool system headers?

3. What does 'find /usr/ -name stddef.h' find?
Comment 8 Laslo Hunhold 2018-01-10 22:54:23 UTC
(In reply to Sergei Trofimovich from comment #7)

> Diffing against the empty chroot I've migrated to 17.1 I see the following
> differences:

> 1. I don't have this directory:
> /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
> 
> Can you show what it resolves to? Say, via realpath:
> 
>     $ realpath /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/../../../../lib/include
> 
> And what is in there.

It just resolves to

/usr/lib/include

and only contains an empty "sodium" directory, probably from the olden days when I tested out a local libsodium build.

> 2. gcc did not ignore /usr/local/include for you. Do you have anything there
> that could fool system headers?

No, /usr/local/include only contains some old headers for local things (wayland-headers for testing, toxcore-headers), but nothing that would fool system headers in any way.

> 3. What does 'find /usr/ -name stddef.h' find?

Modulo headers found within /usr/local/MATLAB, /usr/gnat and /usr/src/linux* (which are obviously not of interest), it finds stddef.h in the following places:

/usr/x86_64-pc-linux-musl/usr/include/linux/stddef.h
/usr/x86_64-pc-linux-musl/usr/include/stddef.h
/usr/lib/gcc/x86_64-pc-linux-musl/7.2.0/include/stddef.h
/usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/stddef.h
/usr/lib/clang/5.0.1/include/stddef.h
/usr/share/syslinux/com32/include/bitsize32/stddef.h
/usr/share/syslinux/com32/include/stddef.h
/usr/share/syslinux/com32/include/bitsize64/stddef.h
/usr/share/syslinux/com32/include/bitsize/stddef.h
/usr/include/linux/stddef.h
/usr/include/c++/v1/stddef.h
/usr/include/wine-vanilla-2.20/wine/msvcrt/stddef.h
/usr/include/wine-d3d9-2.19/wine/msvcrt/stddef.h
/usr/include/wine-staging-2.19/wine/msvcrt/stddef.h

Again, we can probably highlight the /usr/lib/gcc/x86_64-pc-linux-gnu/7.2.0/include/ folder we talked about before.
Comment 9 Laslo Hunhold 2018-01-10 22:56:44 UTC
Okay, I think I found the problem.

The glibc-emerge works as soon as I renamed the "/usr/lib/include" folder to something else. You might want to test this by issuing

mkdir /usr/lib/include

and then checking if the emerge fails for you on the 17.1 profile.


Of course I won't set this to resolved, as the emerge obviously should not fail when this folder is present.
Comment 10 Sergei Trofimovich (RETIRED) gentoo-dev 2018-01-11 22:16:07 UTC
(In reply to Laslo Hunhold from comment #9)
> Okay, I think I found the problem.
> 
> The glibc-emerge works as soon as I renamed the "/usr/lib/include" folder to
> something else. You might want to test this by issuing
> 
> mkdir /usr/lib/include
> 
> and then checking if the emerge fails for you on the 17.1 profile.

Yes, you've nailed it! Good work!

'mkdir /usr/lib/include' breaks glibc the same for me.

It's caused by the following code:

    https://sourceware.org/git/?p=glibc.git;a=blob;f=configure.ac;h=ca1282a6b3f8c5369c133a47f5c8239c3f2d32b5;hb=HEAD#l1018

where glibc tries hard to use only two system include paths (and not all include paths gcc knows about): one include and one include-fixed.
Comment 11 Laslo Hunhold 2018-01-12 04:56:52 UTC
(In reply to Sergei Trofimovich from comment #10)

> Yes, you've nailed it! Good work!

Thanks for your help! I'm glad I wasn't just imagining things.

> 'mkdir /usr/lib/include' breaks glibc the same for me.
> 
> It's caused by the following code:   
> https://sourceware.org/git/?p=glibc.git;a=blob;f=configure.ac;
> h=ca1282a6b3f8c5369c133a47f5c8239c3f2d32b5;hb=HEAD#l1018
> 
> where glibc tries hard to use only two system include paths (and not all
> include paths gcc knows about): one include and one include-fixed.

Very interesting.

Well, it seems like it made sense to test the 17.1 with an "old" Gentoo-system with a lot of cruft (it's now almost 6 years old). I'll stay tuned for the fix in the ebuild.
Comment 12 Jonas Stein gentoo-dev 2019-06-05 22:03:11 UTC
*** Bug 687468 has been marked as a duplicate of this bug. ***
Comment 13 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-10 08:57:53 UTC
I did not get to in in 2 years and did not come up with a cheap check in glibc or in ebuilds. Let's close it as WONTFIX and deal with user's build breakages on case-by-case basis.
Comment 14 Larry the Git Cow gentoo-dev 2022-03-20 21:14:05 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b522ecb1078aad753b3970d91699053974440e2f

commit b522ecb1078aad753b3970d91699053974440e2f
Author:     Sam James <sam@gentoo.org>
AuthorDate: 2022-03-20 21:13:16 +0000
Commit:     Sam James <sam@gentoo.org>
CommitDate: 2022-03-20 21:13:16 +0000

    sys-libs/glibc: add safety check for /usr/lib/include
    
    This directory isn't used by anything legitimate but
    it breaks the build in a confusing way.
    
    Add a check for it & bail out if it exists.
    
    If you do have this directory on your system,
    back up its contents, then move it away/delete it.
    
    Closes: https://bugs.gentoo.org/643302
    Closes: https://bugs.gentoo.org/833620
    Signed-off-by: Sam James <sam@gentoo.org>

 sys-libs/glibc/glibc-2.34-r10.ebuild | 8 ++++++++
 sys-libs/glibc/glibc-2.35.ebuild     | 8 ++++++++
 sys-libs/glibc/glibc-9999.ebuild     | 8 ++++++++
 3 files changed, 24 insertions(+)
Comment 15 Laslo Hunhold 2022-03-21 22:36:05 UTC
(In reply to Larry the Git Cow from comment #14)
>     sys-libs/glibc: add safety check for /usr/lib/include
>     
>     This directory isn't used by anything legitimate but
>     it breaks the build in a confusing way.
>     
>     Add a check for it & bail out if it exists.
>     
>     If you do have this directory on your system,
>     back up its contents, then move it away/delete it.

Very nice, thank you very much! This bug was definitely an oddity, and I'm glad to see it fixed.