Bug 48378 - gcc 4.6.0 fails to build from source
Summary: gcc 4.6.0 fails to build from source
Status: RESOLVED WORKSFORME
Alias: None
Product: gcc
Classification: Unclassified
Component: other (show other bugs)
Version: 4.6.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-31 00:01 UTC by nbi
Modified: 2011-04-03 02:48 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2011-03-31 09:54:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nbi 2011-03-31 00:01:56 UTC
Obtained 
http://ftp.de.debian.org/debian/pool/main/g/gcc-4.6/gcc-4.6_4.6.0.orig.tar.gz
from http://packages.debian.org/sid/gcc-4.6

Prerequisite libraries (gmp, mpfr, mpc) build ok without any problems.

'./configure' succeeds for gcc-4.6

'make' fails with:

make[3]: Entering directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
build/genhooks \
                        ../.././gcc/doc/tm.texi.in > tmp-tm.texi
(null): No place specified to document hook TARGET_ASM_OPEN_PAREN

make[3]: *** [s-tm-texi] Error 1
make[3]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
make: *** [all] Error 2 

How can this be corrected? Thanks.
Comment 1 Richard Biener 2011-03-31 09:54:09 UTC
Do not build in the source directory.
Comment 2 Jonathan Wakely 2011-03-31 10:38:30 UTC
this is documented at
http://gcc.gnu.org/install/configure.html
and
http://gcc.gnu.org/wiki/FAQ#configure
Comment 3 nbi 2011-03-31 17:35:44 UTC
My apologies, I should know better to RTFM for something of GCC's complexity. Have gotten too used to packages for which only in place configure & make are neccessary. Will update upon building the correct way.
Comment 4 nbi 2011-04-01 03:12:26 UTC
Followed the instructions for separate build directory. 'make' fails with the same error as before! Yes, I did a 'make distclean' before 'make'.
Comment 5 Jonathan Wakely 2011-04-01 08:36:20 UTC
Building in a separate dir has the advantage you don't need to make clean, you just remove the whole dir and start with an empty dir again.
I'm not sure 'make distclean' helps, does it make any difference if you start again extracting the source tarbal into an empty dir and build in an empty dir?
If not please provide your exact configure command (just ../gcc-4.6.0/configure?) and the error.
Comment 6 nbi 2011-04-02 21:16:47 UTC
I continue to get the originally reported error:

make[3]: Entering directory
`/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
build/genhooks \
                        ../.././gcc/doc/tm.texi.in > tmp-tm.texi
(null): No place specified to document hook TARGET_ASM_OPEN_PAREN

make[3]: *** [s-tm-texi] Error 1
make[3]: Leaving directory
`/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
make: *** [all] Error 2 

That's even with unpacking the source in an empty dir.

Maybe there's something wrong with the packaging of the source?
Comment 7 Jonathan Wakely 2011-04-02 21:25:35 UTC
(In reply to comment #6)
> I continue to get the originally reported error:

It looks as though you continue to build in the source dir, but I can't know for sure as you didn't say how you're running configure.

> make[3]: Entering directory
> `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
> build/genhooks \
>                         ../.././gcc/doc/tm.texi.in > tmp-tm.texi
> (null): No place specified to document hook TARGET_ASM_OPEN_PAREN
> 
> make[3]: *** [s-tm-texi] Error 1
> make[3]: Leaving directory
> `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
> make[2]: *** [all-stage1-gcc] Error 2
> make[2]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
> make[1]: *** [stage1-bubble] Error 2
> make[1]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
> make: *** [all] Error 2 
> 
> That's even with unpacking the source in an empty dir.
> 
> Maybe there's something wrong with the packaging of the source?

It works for everyone else.
Comment 8 Jonathan Wakely 2011-04-02 21:26:28 UTC
(In reply to comment #7)
> > 
> > Maybe there's something wrong with the packaging of the source?
> 
> It works for everyone else.

Actually maybe that's not true, you're not using the official sources, I have no idea what's in the Debian package.
Comment 9 nbi 2011-04-02 22:24:00 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > I continue to get the originally reported error:
> 
> It looks as though you continue to build in the source dir, but I can't know
> for sure as you didn't say how you're running configure.

../gcc-4.6.0/configure with_gmp_lib=/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/gmp-5.0.1/.libs with_mpfr_lib=/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/mpfr-3.0.0/.libs with_mpc_lib=/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/mpc-0.8.2/src/.libs




> 
> > make[3]: Entering directory
> > `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
> > build/genhooks \
> >                         ../.././gcc/doc/tm.texi.in > tmp-tm.texi
> > (null): No place specified to document hook TARGET_ASM_OPEN_PAREN
> > 
> > make[3]: *** [s-tm-texi] Error 1
> > make[3]: Leaving directory
> > `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0/host-x86_64-unknown-linux-gnu/gcc'
> > make[2]: *** [all-stage1-gcc] Error 2
> > make[2]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
> > make[1]: *** [stage1-bubble] Error 2
> > make[1]: Leaving directory `/usr/src/gcc-4.6-4.6.0.orig/gcc-4.6.0'
> > make: *** [all] Error 2 
> > 
> > That's even with unpacking the source in an empty dir.
> > 
> > Maybe there's something wrong with the packaging of the source?
> 
> It works for everyone else.
Comment 10 Jonathan Wakely 2011-04-02 22:52:32 UTC
(In reply to comment #9)
> (In reply to comment #7)
> > (In reply to comment #6)
> > > I continue to get the originally reported error:
> > 
> > It looks as though you continue to build in the source dir, but I can't know
> > for sure as you didn't say how you're running configure.
> 
> ../gcc-4.6.0/configure

which is the directory you're building in too, right?
i.e. the same as ./configure
So you're still building in the source directory.

You need TWO directories, one for the sources, and one you build in.

And why are you using with_xxx_lib instead of using --with-gmp ?

Try the makefile at http://advogato.org/person/redi/diary/229.html which will do it all for you correctly:
make -f config-gcc.mk GCC_VERSION=4.6.0 GMP_VERSION=5.0.1
Comment 11 nbi 2011-04-02 23:18:08 UTC
(In reply to comment #10)
> (In reply to comment #9)
> > (In reply to comment #7)
> > > (In reply to comment #6)
> > > > I continue to get the originally reported error:
> > > 
> > > It looks as though you continue to build in the source dir, but I can't know
> > > for sure as you didn't say how you're running configure.
> > 
> > ../gcc-4.6.0/configure
> 
> which is the directory you're building in too, right?
> i.e. the same as ./configure
> So you're still building in the source directory.

NO!!
gcc-4.6-4.6.0.orig/gcc-4.6.0 contains the source
gcc-4.6-4.6.0.orig/build     is the build directory

> 
> You need TWO directories, one for the sources, and one you build in.
> 
> And why are you using with_xxx_lib instead of using --with-gmp ?

What's the difference?


> 
> Try the makefile at http://advogato.org/person/redi/diary/229.html which will
> do it all for you correctly:
> make -f config-gcc.mk GCC_VERSION=4.6.0 GMP_VERSION=5.0.1

I am making progress. I downloaded the 3/25 snapshot from one of the mirrors and I'm not getting the "texi" error any more. It appears there is something amiss with the Debian packaging. However, now I get the "cannot compute suffix of object files" error. Hopefully that will go away by use of your advogato recommendation. Sigh. Why is this so convoluted?
Comment 12 Jonathan Wakely 2011-04-02 23:26:24 UTC
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #9)
> > > (In reply to comment #7)
> > > > (In reply to comment #6)
> > > > > I continue to get the originally reported error:
> > > > 
> > > > It looks as though you continue to build in the source dir, but I can't know
> > > > for sure as you didn't say how you're running configure.
> > > 
> > > ../gcc-4.6.0/configure
> > 
> > which is the directory you're building in too, right?
> > i.e. the same as ./configure
> > So you're still building in the source directory.
> 
> NO!!
> gcc-4.6-4.6.0.orig/gcc-4.6.0 contains the source
> gcc-4.6-4.6.0.orig/build     is the build directory

But the error you're getting shows you are in the gcc-4.6.0 directory.

> > You need TWO directories, one for the sources, and one you build in.
> > 
> > And why are you using with_xxx_lib instead of using --with-gmp ?
> 
> What's the difference?

One is the documented, supported way to build gcc, one isn't.

> > Try the makefile at http://advogato.org/person/redi/diary/229.html which will
> > do it all for you correctly:
> > make -f config-gcc.mk GCC_VERSION=4.6.0 GMP_VERSION=5.0.1
> 
> I am making progress. I downloaded the 3/25 snapshot from one of the mirrors
> and I'm not getting the "texi" error any more. It appears there is something
> amiss with the Debian packaging. However, now I get the "cannot compute suffix
> of object files" error. Hopefully that will go away by use of your advogato
> recommendation. Sigh. Why is this so convoluted?

http://gcc.gnu.org/wiki/FAQ#configure_suffix

Yes, if you use my config-gcc.mk makefile that won't be a problem.
Comment 13 Jonathan Wakely 2011-04-02 23:32:10 UTC
The docs for --with-gmp also point out you might need to use LD_LIBRARY_PATH so the gmp/mpfr/mpc libs will be found, which is the cause of the "cannot compute suffix" error, but I assume you didn't read those docs since you're not using --with-gmp

I have no idea how you'll get the installed gcc to find those shared libs if you haven't bothered to install them and are giving the path to the build dir as with_gmp_lib, you're pretty much on your own if you don't want to follow the installation instructions.  That's why you're finding it convoluted.

I suggest just using my config-gcc.mk instead
Comment 14 Jonathan Wakely 2011-04-02 23:39:58 UTC
what my makefile does is put the gmp sources in the gcc tree as gcc-4.6.0/gmp (not as gcc-4.6.0/gmp-5.0.1 as you seem to have it) and similarly for mpfr and mpc. Then just configure gcc, it will detect and build the prerequisite libs, and link to them statically.

You seem to have put the source under the gcc tree, then built them there yourself?  I don't think that will work.
Comment 15 nbi 2011-04-02 23:42:13 UTC
(In reply to comment #13)
> The docs for --with-gmp also point out you might need to use LD_LIBRARY_PATH so
> the gmp/mpfr/mpc libs will be found, which is the cause of the "cannot compute
> suffix" error, but I assume you didn't read those docs since you're not using
> --with-gmp
> 
> I have no idea how you'll get the installed gcc to find those shared libs if
> you haven't bothered to install them and are giving the path to the build dir
> as with_gmp_lib, you're pretty much on your own if you don't want to follow the
> installation instructions.  That's why you're finding it convoluted.
> 
> I suggest just using my config-gcc.mk instead

That doesn't work neither:

make -f config-gcc.mk GCC_VERSION=4.6.0 GMP_VERSION=5.0.1
ln -s ../mpfr-3.0.0 gcc-4.6.0/mpfr
ln -s ../mpc-0.8.2 gcc-4.6.0/mpc
curl -O http://www.mpfr.org/mpfr-current/mpfr-3.0.0.tar.gz

curl: (7) couldn't connect to host
make: *** [mpfr-3.0.0.tar.gz] Error 7
Comment 16 Jonathan Wakely 2011-04-02 23:44:47 UTC
you can tell it to use local copies of the files if you've already downloaded them, look at the LOCAL_SRC variable
Comment 17 nbi 2011-04-03 00:13:45 UTC
(In reply to comment #16)
> you can tell it to use local copies of the files if you've already downloaded
> them, look at the LOCAL_SRC variable

Thanks for your help.
Your recommendation almost works (at least it got further than previous attempts). Since you claim it does everything for me (which presumably spares me several days of reading) I'm afraid to report it must be flawed:

make[5]: Entering directory `/usr/src/gcc/advogato/objdir-4.6.0/x86_64-unknown-linux-gnu/32/libgcc'
# If this is the top-level multilib, build all the other
# multilibs.
/usr/src/gcc/advogato/objdir-4.6.0/./gcc/xgcc -B/usr/src/gcc/advogato/objdir-4.6.0/./gcc/ -B/usr/local/x86_64-unknown-linux-gnu/bin/ -B/usr/local/x86_64-unknown-linux-gnu/lib/ -isystem /usr/local/x86_64-unknown-linux-gnu/include -isystem /usr/local/x86_64-unknown-linux-gnu/sys-include    -g -O2 -m32 -O2  -g -O2 -DIN_GCC   -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition  -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -fno-stack-protector   -I. -I. -I../../.././gcc -I../../../../gcc-4.6.0/libgcc -I../../../../gcc-4.6.0/libgcc/. -I../../../../gcc-4.6.0/libgcc/../gcc -I../../../../gcc-4.6.0/libgcc/../include -I../../../../gcc-4.6.0/libgcc/config/libbid -DENABLE_DECIMAL_BID_FORMAT -DHAVE_CC_TLS  -DUSE_TLS -o _muldi3.o -MT _muldi3.o -MD -MP -MF _muldi3.dep -DL_muldi3 -c ../../../../gcc-4.6.0/libgcc/../gcc/libgcc2.c \
          -fvisibility=hidden -DHIDE_EXPORTS
In file included from /usr/include/features.h:378:0,
                 from /usr/include/stdio.h:28,
                 from ../../../../gcc-4.6.0/libgcc/../gcc/tsystem.h:87,
                 from ../../../../gcc-4.6.0/libgcc/../gcc/libgcc2.c:29:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory
compilation terminated.
make[5]: *** [_muldi3.o] Error 1
make[5]: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0/x86_64-unknown-linux-gnu/32/libgcc'
make[4]: *** [multi-do] Error 1
make[4]: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0/x86_64-unknown-linux-gnu/libgcc'
make[3]: *** [all-multi] Error 2
make[3]: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0/x86_64-unknown-linux-gnu/libgcc'
make[2]: *** [all-stage1-target-libgcc] Error 2
make[2]: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0'
make: *** [all] Error 2
make: Leaving directory `/usr/src/gcc/advogato/objdir-4.6.0'

And why is it trying to build a 32 bit version when my architecture is obviously 64 bit??
Comment 18 Jonathan Wakely 2011-04-03 00:21:32 UTC
because x86_64 builds a multilib compiler by default, which is what most people want.

use CONFIGARGS=--disable-multilib if you don't want that, or install the 32buig glibc headers and libs if you want a compiler that can produce 32bit or 64bit output

I think you should continue this on the gcc-help mailing list, there's no gcc bug here
Comment 19 nbi 2011-04-03 02:48:01 UTC
(In reply to comment #18)
> because x86_64 builds a multilib compiler by default, which is what most people
> want.
> 
> use CONFIGARGS=--disable-multilib if you don't want that, or install the 32buig
> glibc headers and libs if you want a compiler that can produce 32bit or 64bit
> output
> 
> I think you should continue this on the gcc-help mailing list, there's no gcc
> bug here

After installing the 32 bit headers it built cleanly. Thanks for your help. I'll let the Debian folks know that they need to give the packaging a look.