Bug 10062

Summary: 'make' for glibc-2.9 fails even though 'configure' is OK
Product: glibc Reporter: Sergei Steshenko <sergstesh>
Component: buildAssignee: Carlos O'Donell <carlos>
Status: RESOLVED FIXED    
Severity: critical CC: carlos, glibc-bugs
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu Last reconfirmed:
Attachments: autogenerated script used to run 'configure'
'configure' screen output
'make' gzipped screen output
'make' screen output with gcc-3.4.6
'make' screen output with -march=i586
'make' screen output with -march=native -mtune-native

Description Sergei Steshenko 2009-04-11 17:25:27 IST
I've tried to build glibc-2.9 using self-built gcc-4.3.3 (works fine in everyday
tasks) and self-built binutils-2.19.1, which were also built using the
self-built gcc-4.3.3 without a problem.

Even though 'configure' is OK, 'make' fails with the following messages:

"
gcc -L/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/binutils-2.19.1/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/bison-2.3/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/flex-2.5.35/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib/gcc/i686-pc-linux-gnu/4.3.3
-L/mnt/sdb8/sergei/AFSWD_debug/install/gmp-4.2.2/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/libtool-2.2.6a/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/mpfr-2.3.2/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/readline-5.1/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib/expect5.44.1
-L/mnt/sdb8/sergei/AFSWD_debug/install/tk-8.4.19/lib  -shared -static-libgcc
-Wl,-O1  -Wl,-z,defs
-Wl,-dynamic-linker=/mnt/sdb8/sergei/AFSWD_debug/install/glibc-2.9/lib/ld-linux.so.2
 -B/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/csu/ 
-Wl,--version-script=/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc.map
-Wl,-soname=libc.so.6 -Wl,-z,combreloc -Wl,-z,relro -Wl,--hash-style=both
-nostdlib -nostartfiles -e __libc_main
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/math
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/dlfcn
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nss
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nis
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/rt
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/resolv
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/crypt
-L/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nptl
-Wl,-rpath-link=/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/math:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/dlfcn:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nss:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nis:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/rt:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/resolv:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/crypt:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/nptl
-o /mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc.so -T
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/shlib.lds
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/csu/abi-note.o
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf/soinit.os
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf/sofini.os
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf/interp.os
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/elf/ld.so -lgcc
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function `__libc_fork':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/posix/../nptl/sysdeps/unix/sysv/linux/i386/../fork.c:79:
undefined reference to `__sync_bool_compare_and_swap_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`nscd_getpw_r':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd_getpw_r.c:232:
undefined reference to `__sync_fetch_and_add_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`__nscd_drop_map_ref':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd-client.h:320:
undefined reference to `__sync_fetch_and_add_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`nscd_getgr_r':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd_getgr_r.c:321:
undefined reference to `__sync_fetch_and_add_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`__nscd_drop_map_ref':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd-client.h:320:
undefined reference to `__sync_fetch_and_add_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`nscd_gethst_r':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd_gethst_r.c:400:
undefined reference to `__sync_fetch_and_add_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os:/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd-client.h:320:
more undefined references to `__sync_fetch_and_add_4' follow
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`__nscd_get_map_ref':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/nscd/nscd_helper.c:431:
undefined reference to `__sync_val_compare_and_swap_4'
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc_pic.os: In function
`*__GI___libc_freeres':
/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src/malloc/set-freeres.c:39:
undefined reference to `__sync_bool_compare_and_swap_4'
collect2: ld returned 1 exit status
make[1]: *** [/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9/libc.so] Error 1
make[1]: Leaving directory `/mnt/sdb8/sergei/AFSWD_debug/build/glibc-2.9.src'
make: *** [all] Error 2
".

I am about to upload files with detailed info on command line arguments and
environment variables settings.
Comment 1 Sergei Steshenko 2009-04-11 17:27:37 IST
Created attachment 3875 [details]
autogenerated script used to run 'configure'

In the attached script one can see environment variables settings and exact
'configure' command line.
Comment 2 Sergei Steshenko 2009-04-11 17:29:36 IST
Created attachment 3876 [details]
'configure' screen output
Comment 3 Sergei Steshenko 2009-04-11 17:32:39 IST
Created attachment 3877 [details]
'make' gzipped screen output

Full 'make' screen output.
Comment 4 Ulrich Drepper 2009-04-11 17:36:39 IST

*** This bug has been marked as a duplicate of 333 ***
Comment 5 Sergei Steshenko 2009-04-11 18:33:07 IST
Regarding http://sourceware.org/bugzilla/show_bug.cgi?id=333 and


"
The developers do builds and
make check runs on a regular basis, and if there is any real problem they will
notice it and fix it quickly.
"

- this is ridiculous - the basic theorem about SW testing says: tests can only
prove presence of bugs, but not their absence.


I'm building glibc-2.9 in the framework of my AppsFromScratch (a tool written in
Perl) and using it I have found "countless" bugs in build scripts of FOSS projects.

I have replaced self-built gcc-4.3.3 with self-built gcc-3.4.6, leaving all the
rest the same.

Now the build completes, but there are errors in 'make check'.

I am about to upload the files.

FWIF, here is is the list of targets my tool so far successfully builds:

"
ls -1 /mnt/sdb8/sergei/AFSWD_debug/install/
AMD-2.2.0
aria2-1.1.0
aspell-0.60.6
aspell6-am-0.03-1
aspell6-ar-1.2-0
aspell6-az-0.02-0
aspell6-bg-4.1-0
aspell6-bn-0.01.1-1
aspell6-ca-20040130-1
aspell6-cs-20040614-1
aspell6-csb-0.02-0
aspell6-de-20030222-1
aspell6-de-alt-2.1-1
aspell6-en-6.0-0
aspell6-eo-2.1.20000225a-2
aspell6-es-1.9a-1
aspell6-et-0.1.21-1
aspell6-fa-0.11-0
aspell6-fi-0.7-0
aspell6-fy-0.12-0
aspell6-gl-0.5a-2
aspell6-gu-0.03-0
aspell6-he-1.0-0
aspell6-hi-0.02-0
aspell6-hsb-0.01-1
aspell6-hu-0.99.4.2-0
aspell6-hy-0.10.0-0
aspell6-it-2.2_20050523-0
aspell6-la-20020503-0
aspell6-lt-1.2.1-0
aspell6-lv-0.5.5-1
aspell6-ml-0.03-1
aspell6-mn-0.06-2
aspell6-mr-0.10-0
aspell6-nds-0.01-0
aspell6-or-0.03-1
aspell6-pa-0.01-1
aspell6-pl-6.0_20061121-0
aspell6-pt_BR-20080707-0
aspell6-pt_PT-20070510-0
aspell6-qq-0.03-0
aspell6-qu-0.02-0
aspell6-ru-0.99f7-1
aspell6-sk-2.00-0
aspell6-sr-0.02
aspell6-ta-20040424-1
aspell6-te-0.01-2
aspell6-uk-1.4.0-0
aspell6-uz-0.6-0
aspell6-vi-0.01.1-1
aspell6-yi-0.01.1-1
atk-1.22.0
atlas3.8.2
atlas_native-3.8.2
at-spi-1.22.1
audiofile-0.2.6
autoconf-2.63
autogen-5.9.5
automake-1.10.2
bash-3.0
bash-4.0
bc-1.06
binutils-2.19.1
binutils_mingw32-2.19.1
bison-2.3
blas_generic
bzip2-1.0.5
cabextract-1.2
Cairo-1.060
cairo-1.8.6
CAMD-2.2.0
c-ares-1.6.0
CCOLAMD-2.7.1
CHOLMOD-1.6.0
claws-mail-3.7.0
cln-1.2.0
COLAMD-2.7.1
coreutils-7.1
coreutils-7.2
cups-1.3.9-source
curl-7.19.3
curl-7.19.4
CXSparse-2.2.1
dbus-1.2.1
dbus-glib-0.76
dcraw-8.86
dejagnu-1.4.4
diacanvas2-0.14.4
djvulibre-3.5.20-5
ecasound-2.5.2
enchant-1.4.2
esound-0.2.38
expat-2.0.1
expect-5.44.1
ExtUtils-Depends-0.300
ExtUtils-PkgConfig-1.11
ffmpeg-0.5
fftw-2.1.5
fftw3_sse2-3.2
fftw3_sse-3.2
flac-1.2.1
flex-2.5.35
fltk-1.1.9-source
fontconfig-2.6.0
fontforge-20080927
freetype-2.3.8
freetype-2.3.9
gail-1.22.1
gcc-3.4.6
gcc-4.3.3
GConf-2.22.0
gd-2.0.35
gettext-0.17
ghostscript-8.64
ginac-1.4.4
glade-2.12.2
glade3-3.4.5
Glib-1.201
glib-1.2.10
Glib-1.220
Glib-1.221
glib-2.18.4
glpk-4.32
gmp-4.2.2
Gnome2-1.040
Gnome2-Canvas-1.002
Gnome2-Dia-0.04
Gnome2-GConf-1.043
Gnome2-Print-1.000
Gnome2-VFS-1.080
Gnome2-Vte-0.09
Gnome2-Wnck-0.13
gnome-icon-theme-2.22.0
gnome-keyring-2.20.1
gnome-mime-data-2.18.0
gnome-vfs-2.22.0
gnupg-2.0.11
gnupg-2.0.9
gnuplot-4.2.4
gnuplot-4.2.5
gnuplot-4.3.0-2008-11-21
gnutls-2.6.0
gperf-3.0.3
graphviz-2.20.3
gsl-1.12
gst-plugins-base-0.10.21
gst-plugins-good-0.10.10
gstreamer-0.10.21
GStreamer-0.15
gtk+-1.2.10
Gtk2-1.203
gtk+-2.12.12
Gtk2-1.220
Gtk2-GladeXML-1.006
Gtk2-Html2-0.04
Gtk2-TrayIcon-0.04
gtk-engines-2.14.0
gtkspell-2.0.13
guile-1.8.6
harminv-1.3.1
hdf5-1.8.1
HTML-Parser-3.59
HTML-Tagset-3.20
icon-naming-utils-0.8.6
icu4c-3_6-src
ilmbase-1.0.1
ImageMagick-6.4.8-10
intltool-0.40.5
jack-audio-connection-kit-0.109.2
jasper-1.900.1
jbig2dec-0.9
jbigkit-1.6
jpegsrc.v6b
kqemu-1.3.0pre11
ladspa_sdk
lame-398-2
lapack-3.2
lcms-1.17
lesstif-0.95.0
libao-0.8.8
libart_lgpl-2.3.20
libassuan-1.0.5
libavc1394-0.5.3
libbonobo-2.22.0
libbonoboui-2.22.0
libcroco-0.6.1
libetpan-0.57
libeXosip2-3.1.0
libfpx-1.3.0-0
libfreebob-1.0.3
libgcrypt-1.4.1
libggi-2.2.2
libggigcp-1.0.2
libggimisc-2.2.2
libggiwmh-0.3.2
libgii-1.0.2
libgiigic-1.1.2
libglade-2.6.2
libgnome-2.22.0
libgnomecanvas-2.20.1.1
libgnomecups-0.2.2
libgnomeprint-2.18.2
libgnomeprintui-2.18.2
libgnomeui-2.24.0
libgpg-error-1.6
libgsf-1.14.8
libgtkhtml-2.6.3
libiconv-1.11
libiconv_pre-1.11
libid3tag-0.15.1b
libIDL-0.8.12
libiec61883-1.1.0
libksba-1.0.3
libmad-0.15.1b
libmcrypt-2.5.8
libogg-1.1.3
liboil-0.3.15
libosip2-3.1.0
libpng-1.2.35
libraw1394-1.2.1
librsvg-2.22.2
libsamplerate-0.1.6
libsndfile-1.0.17
libtasn1-1.5
libtool-2.2.6a
libungif4_4.1.4.orig
libvorbis-1.2.0
libwmf-0.2.8.4
libwnck-2.14.2
libwww-perl-5.822
libxml2-2.7.3
libxslt-1.1.24
lzo-2.03
m4-1.4.12
m4-1.4.13
madplay-0.15.2b
make-3.80
mcrypt-2.6.8
MesaLib-7.0.3
metis-4.0
mhash-0.9.9
Module-Build-0.2805
Module-Pluggable-3.1
mpeg2dec-0.4.1
mpeg2vidcodec_v12
mpfr-2.3.2
mpg123-1.6.4
ncurses-5.7
nedit-5.5-src
netcdf-3.6.2
octave-3.0.3
octave-3.0.4
octave-forge-bundle-20080831
opencdk-0.6.6
openexr-1.6.1
openssl-0.9.8j
openssl-0.9.8k
ORBit2-2.14.12
ortp-0.13.1
Pango-1.220
pango-1.22.4
pa_snapshot_v18
pa_snapshot_v19
pcre-7.8
pd_fftw2-0.41-4
pidgin-2.5.4
pidgin-2.5.5
pixman-0.12.0
pjproject-0.8.0
pkg-config-0.23
popt-1.10.4
potrace-1.7
pth-2.0.7
qemu-0.9.1
qhull-2003.1
readline-5.1
scrollkeeper-0.3.14
SDL-1.2.12
sox-14.0.1
sox-14.2.0
speex-1.1.12
spiral-3.1
spiral-highland-feb04
spiral-may04
szip-2.1
tcl-8.4.19
texinfo-4.13
texlive
tiff-3.8.2
tk-8.4.19
UFconfig-3.1.0
UMFPACK-5.2.0
URI-1.37
vorbis-tools-1.2.0
vte-0.16.14
wavpack-4.50.1
wine-1.1.13
wxGTK-2.8.10
wxGTK-2.8.9
wxX11-2.8.10
wxX11-2.8.9
XML-LibXML-1.65
XML-LibXML-Common-0.13
XML-NamespaceSupport-1.09
XML-Parser-2.36
XML-SAX-0.16
XML-Simple-2.18
zlib-1.2.3
".

So far, statistically, in a target doesn't build with my AppsFromScratch, most
likely it's a problem in the target, not in in AppsFromScratch or the way I
configure the target.

Comment 6 Sergei Steshenko 2009-04-11 18:33:28 IST
Created attachment 3878 [details]
'make' screen output with gcc-3.4.6
Comment 7 Sergei Steshenko 2009-04-11 21:50:44 IST
I am reopening the bug because now I am 100% sure there is a bug in the build
mechanism.

After some web search I've found this:
http://www.justpasha.org/links/soft/glibc.html :

"
# echo "CFLAGS += -march=i586" > configparms (otherwise one gets undefined
reference to `__sync_bool_compare_and_swap_4` and similar errors) 
".

So, I've added to configure arguments the following:

CFLAGS='-march=i586 -g -O2'

and now I can complete the build. This is what my OS is:

"
uname -a
Linux amdam2 2.6.22.19-0.2-default #1 SMP 2008-12-18 10:17:03 +0100 i686 athlon
i386 GNU/Linux
",

so why on earth should I add -march=i586 ?

I didn't have to do this for any other target of about 300 targets I've built.

I have also reread glibc-2.9/README file - it mentions neither 'march' nor
'586', so, if you are not going to fix the code, maybe you'll at least add this
tip to the INSTALL file ?

Thanks in advance.

I am about to attach screen output of successful build.
Comment 8 Ulrich Drepper 2009-04-11 21:52:30 IST
There is nothing wrong.  If you are unable to configure glibc correctly you
shouldn't try it.
Comment 9 Sergei Steshenko 2009-04-11 21:52:54 IST
Created attachment 3879 [details]
'make' screen output with -march=i586
Comment 10 Sergei Steshenko 2009-04-11 22:00:15 IST
(In reply to comment #8)
> There is nothing wrong.  If you are unable to configure glibc correctly you
> shouldn't try it.

First of all, your attitude is wrong:

http://linux.slashdot.org/comments.pl?sid=1195585&cid=27539173 :

"
Wrong. Fail. Abort. Windows is swallowing up another market because Linux
doesn't belong on the average user's netbook, for the same reasons it doesn't
belong on the average user's desktop. It is a usability nightmare, you need to
be a network engineer AND programmer to fix it when it breaks, and perhaps most
importantly the Linux community is hostile and unhelpful toward non-techies.
".

Not only I am able to configure targets correctly, I have also written a FOSS
tool that makes configuration effort much easier. For example, this is what one
needs to do in the framework of my tool to describe 'binutils':

      binutils =>
        do{
          my $major_ver = '2';
          my $minor_ver = '19';
          my $micro_ver = '1';

          $shadow_targets_hash_refs{binutils} =
            {
            major_ver => $major_ver,
            minor_ver => $minor_ver,
            micro_ver => $micro_ver,

            base_urls => \@_gnu_binutils_mirrors,

            depends_on =>
              {
              targets =>
                {
                gcc4 => $shadow_targets_hash_refs{gcc4}
                }
              }
            }
          }, # do
             # binutils

, and this is what my tool generates automatically:

"
cat /mnt/sdb8/sergei/AFSWD_debug/build/binutils-2.19.1/config_wrapper.sh
#!/bin/sh

cd /mnt/sdb8/sergei/AFSWD_debug/build/binutils-2.19.1

PATH=/mnt/sdb8/sergei/AFSWD_debug/install/autoconf-2.63/bin:/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/bin:/mnt/sdb8/sergei/AFSWD_debug/install/bash-3.0/bin:/mnt/sdb8/sergei/AFSWD_debug/install/bison-2.3/bin:/mnt/sdb8/sergei/AFSWD_debug/install/dejagnu-1.4.4/bin:/mnt/sdb8/sergei/AFSWD_debug/install/expect-5.44.1/bin:/mnt/sdb8/sergei/AFSWD_debug/install/flex-2.5.35/bin:/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/bin:/mnt/sdb8/sergei/AFSWD_debug/install/gperf-3.0.3/bin:/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/bin:/mnt/sdb8/sergei/AFSWD_debug/install/libtool-2.2.6a/bin:/mnt/sdb8/sergei/AFSWD_debug/install/m4-1.4.13/bin:/mnt/sdb8/sergei/AFSWD_debug/install/make-3.80/bin:/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/bin:/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/bin:/mnt/sdb8/sergei/AFSWD_debug/install/texinfo-4.13/bin:/mnt/sdb8/sergei/AFSWD_debug/install/tk-8.4.19/bin:/mnt/sdb8/sergei/AFSWD_debug/install/pkg-config-0.23/bin:/opt/kde3/bin:/home/sergei/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/usr/lib/jvm/jre/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin
export PATH

LD_LIBRARY_PATH=/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/lib:/mnt/sdb8/sergei/AFSWD_debug/install/bison-2.3/lib:/mnt/sdb8/sergei/AFSWD_debug/install/flex-2.5.35/lib:/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib:/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib/gcc/i686-pc-linux-gnu/4.3.3:/mnt/sdb8/sergei/AFSWD_debug/install/gmp-4.2.2/lib:/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/lib:/mnt/sdb8/sergei/AFSWD_debug/install/libtool-2.2.6a/lib:/mnt/sdb8/sergei/AFSWD_debug/install/mpfr-2.3.2/lib:/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/lib:/mnt/sdb8/sergei/AFSWD_debug/install/readline-5.1/lib:/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib:/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib/expect5.44.1:/mnt/sdb8/sergei/AFSWD_debug/install/tk-8.4.19/lib
export LD_LIBRARY_PATH

PKG_CONFIG_PATH=/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/lib/pkgconfig:/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/lib/pkgconfig:/usr/lib/pkgconfig
export PKG_CONFIG_PATH

LDFLAGS='-L/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/bison-2.3/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/flex-2.5.35/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/lib/gcc/i686-pc-linux-gnu/4.3.3
-L/mnt/sdb8/sergei/AFSWD_debug/install/gmp-4.2.2/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/libtool-2.2.6a/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/mpfr-2.3.2/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/readline-5.1/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib
-L/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/lib/expect5.44.1
-L/mnt/sdb8/sergei/AFSWD_debug/install/tk-8.4.19/lib'
export LDFLAGS

CPPFLAGS='-I/mnt/sdb8/sergei/AFSWD_debug/install/autoconf-2.63/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/autogen-5.9.5/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/bash-3.0/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/bison-2.3/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/dejagnu-1.4.4/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/expect-5.44.1/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/flex-2.5.35/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/gcc-4.3.3/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/gmp-4.2.2/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/gperf-3.0.3/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/guile-1.8.6/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/libtool-2.2.6a/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/m4-1.4.13/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/make-3.80/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/mpfr-2.3.2/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/ncurses-5.7/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/readline-5.1/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/tcl-8.4.19/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/texinfo-4.13/include
-I/mnt/sdb8/sergei/AFSWD_debug/install/tk-8.4.19/include'
export CPPFLAGS

./configure  --prefix=/mnt/sdb8/sergei/AFSWD_debug/install/binutils-2.19.1
".

And I even read documentation before trying. So, if the provided documentation
does not prescribe me to use some options, but I must use them, the
documentation is wrong.
Comment 11 Ulrich Drepper 2009-04-11 22:17:24 IST
There is nothing wrong.  There are lots of people constantly compiling glibc
correctly.  This means your environment doesn't match the supported one.  Stuop
wasting people's time.  You're apparently not able to do any work on glibc so stop.
Comment 12 Sergei Steshenko 2009-04-11 23:27:17 IST
I have just checked that CFLAGS='-march=native -mtune=native -g -O2' the build
is also successful.

I am about to upload screen output of this successful build too.(In reply to
comment #11)
> There is nothing wrong.  There are lots of people constantly compiling glibc
> correctly.  This means your environment doesn't match the supported one.  Stuop
> wasting people's time.  You're apparently not able to do any work on glibc so
stop.

Comment 13 Sergei Steshenko 2009-04-11 23:29:40 IST
Created attachment 3880 [details]
'make' screen output with -march=native -mtune-native
Comment 14 Sergei Steshenko 2009-04-11 23:35:42 IST
(In reply to comment #11)
> There is nothing wrong.  There are lots of people constantly compiling glibc
> correctly.  This means your environment doesn't match the supported one.  Stuop
> wasting people's time.  You're apparently not able to do any work on glibc so
stop.

Do you understand English ?

I have made a number of statements which you so far failed to disprove or at
least to meaningfully comment. Let me summarize the statements for you:

1) I did read the INSTALL file before trying;
2) the INSTALL file say nothing about specifying architecture - TRUE or FALSE ?
3) in the vast majority of typical cases there is no need to specify
architecture for native builds - TRUE or FALSE ?
4) as my experiments show, both '-march=i586' and '-march=native -mtune=native'
work, which suggests 'configure' has severe problems with guessing correctly,
i.e. instead of correctly guessing the default like with majority of other FOSS
packages in case of 'glibc' user has to specify the architecture explicitly, and
this defeats 'configure' purpose.
Comment 15 Ulrich Drepper 2009-04-12 16:22:21 IST
Stop this nonsense.  This is no package for everybody to install.  There is no
handholding in the installation process.
Comment 16 Sergei Steshenko 2009-04-12 21:53:58 IST
Oh, it's not nonsense, it user-unfriendly (to say the least) 'configure' script
and incomplete documentation.

And this is just another

./configure <ARGS>
make
make check
make install

package - like thousands of others.

I still see no answers to my very simple questions.
Comment 17 Petr Baudis 2010-06-01 04:04:41 IST
*** Bug 10063 has been marked as a duplicate of this bug. ***
Comment 18 Petr Baudis 2010-06-01 04:06:07 IST
I'm marking this bug as suspended as it's rather clear that no current developer
is going to work on this for the time being and anyone wishing this bug to be
fixed will have to provide patches.
Comment 19 Carlos O'Donell 2012-02-22 20:57:46 IST
Trivial to reproduce. 

This is a long-standing classic configuration bug.

We should have a configure check to tell you "Sorry, your compiler, in combination with the selected flags, is unable to support the atomic operations which are required for libc. Consider adding -march=i486 or higher to your CFLAGS/CXXFLAGS."
Comment 20 joseph@codesourcery.com 2012-02-22 21:12:32 IST
FWIW, my inclination would be to refine that solution: if the compiler 
generates out-of-line __sync_* calls, but we are building for an i486-* 
triplet, add -march=i486 automatically (likewise i586-*, i686-*; use 
-march=i686 also for i786-* which glibc accepts as well), and only give 
the error if the configuration is i386-* *and* the compiler generates 
out-of-line calls for __sync_* operations.

The sysdeps directories for i486 etc. have assembly sources that use i486 
etc.-specific instructions, so adding -march like that (if glibc would 
otherwise fail to build) is safe.
Comment 21 Carlos O'Donell 2012-02-23 16:49:09 IST
(In reply to comment #20)
> FWIW, my inclination would be to refine that solution: if the compiler 
> generates out-of-line __sync_* calls, but we are building for an i486-* 
> triplet, add -march=i486 automatically (likewise i586-*, i686-*; use 
> -march=i686 also for i786-* which glibc accepts as well), and only give 
> the error if the configuration is i386-* *and* the compiler generates 
> out-of-line calls for __sync_* operations.
> 
> The sysdeps directories for i486 etc. have assembly sources that use i486 
> etc.-specific instructions, so adding -march like that (if glibc would 
> otherwise fail to build) is safe.

That sounds like a good solution.

The only case I can think where it matters is if the user tries to use i686-* target and specifies -march=i386 (which will be ignored).
Comment 22 Carlos O'Donell 2013-04-06 15:38:42 IST
The final solution I'm going with is as follows:

- If configuring for i386-* then build for i686, since that's what the distributions all want. Everyone is using i386-* to mean "generic 32-bit support" instead of actually building for an i386. We issue a warning in the configure phase to indicate we are building for i686.

- If the set of flags and options the user specified would cause __sync_* builtins to become out-of-line function calls then fail the configure. This would be the case of the user actually passed --march=i386 or --mtune=i386 *or* the compiler defaults to i386 code generation. We can't support this configuration, and the user asked for it, so we error out.

I did not implement Joseph's suggestion to add --march=i?86 if configuring for i?86-*.

Either way this bug is now fixed since you will get either a configure error (for a compiler that defaults to i386 code-gen and/or a set of flags that request i386 code-gen), or a correct build (for a configured target of i386-* you get i686 code being used).
Comment 23 Carlos O'Donell 2013-04-06 16:31:07 IST
Fixed with:

commit a01f19c8fb12eef419d4112879bc715e2ab6f6d7
Author: Carlos O'Donell <carlos@redhat.com>
Date:   Sat Apr 6 12:00:35 2013 -0400

    i386: Fail at configure time for i386 builds.
    
    This change does two things:
    
    * Treats a target i386-* as if it were i686.
    * Fails configure if the user is generating code
      for i386.
    
    We no longer support i386 code-generation because the i386
    lacks the atomic operations we need in glibc.
    
    You can still configure for i386-*, but you get i686 code.
    
    You can't build with --march=i386, --mtune=i386 or a compiler
    that defaults to i386 code-generation.
    
    I've added two i386 entries in the master todo list to discuss
    merging and renaming:
    http://sourceware.org/glibc/wiki/Development_Todo/Master#i386
    
    The failure modes are fail-safe here. You compile for i386,
    get i686, and try to run on i386 and it fails. The configure
    log has a warning saying we elided to i686. There is no situation
    that I can see where we run into any serious problems.
    
    The patch makes the current state better in that we get less
    confused users and we build successfully in more default
    configurations.
    
    The next enhancement would be to add --march=i?86
    as suggested in #c20 of BZ#10062 for any i?86-* builds, which
    would solve the problem of a 32-bit compiler that defaults to
    i386 code-gen and glibc configured for i686-* target. Which
    previously failed at build time, and now will fail at configure
    time (requires adding --march=i686).
    
    Updated NEWS with BZ #10060 and #10062.
    
    No regressions.
    
    ---
    
    2013-04-06  Carlos O'Donell  <carlos@redhat.com>
    
        [BZ #10060, #10062]
        * aclocal.m4 (LIBC_COMPILER_BUILTIN_INLINED): New macro.
        * sysdeps/i386/configure.in: Use LIBC_COMPILER_BUILTIN_INLINED and
        fail configure if __sync_val_compare_and_swap is not inlined.
        * sysdeps/i386/configure: Regenerate.
        * configure.in: Build for i686 when configured for i386.
        * configure: Regenerate.
        * README: Remove i386 reference.