LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   xgcc error while installing gcc 4.4 on RHEL 5.3 (http://www.linuxquestions.org/questions/linux-software-2/xgcc-error-while-installing-gcc-4-4-on-rhel-5-3-a-844704/)

someshpr 11-16-2010 04:52 PM

xgcc error while installing gcc 4.4 on RHEL 5.3
 
While installing gcc 4.4, I get an error during "make" which says
Code:

...
checking for x86_64-unknown-linux-gnu-gcc... /scratch/objdir/./gcc/xgcc -B/scratch/objdir/./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 
checking for suffix of object files... configure: error: in `/scratch/objdir/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
make[2]: *** [configure-stage1-target-libgcc] Error 1
...

config.log in `/scratch/objdir/x86_64-unknown-linux-gnu/libgcc' says (somewhere in the middle):

Code:

...
configure:3004: $? = 0
configure:2993: /scratch/objdir/./gcc/xgcc -B/scratch/objdir/./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    -V >&5
xgcc: error: unrecognized option '-V'
xgcc: fatal error: no input files
compilation terminated.
...

Here are the steps I followed:
Code:

[root@mesozoic /]# cd /scratch
[root@mesozoic scratch]# mkdir gcc
[root@mesozoic scratch]# cd gcc
[root@mesozoic gcc]# svn co svn://gcc.gnu.org/svn/gcc/trunk .
...
[root@mesozoic gcc]# cd ../
[root@mesozoic scratch]# mkdir objdir
[root@mesozoic scratch]# cd objdir
[root@mesozoic objdir]# ../gcc/configure
...
[root@mesozoic objdir]# make

`configure' ends with
Code:

checking whether -fkeep-inline-functions is supported... yes
configure: creating ./config.status
config.status: creating Makefile

My kernel version is 2.6.18-164 and am running RHEL 5.3 on X86_64

What is going wrong here?

TIA,

knudfl 11-16-2010 06:55 PM

# yum install gcc44 : will provide gcc-4.4.0

And # 'yum install gcc44-c++ : the g++ version 4.4.0 .


Compiling gcc on EL5 / CentOS 5 / SL 55 : Post # 2 here
http://www.linuxquestions.org/questi...-1-a-842567/#2
..

knudfl 11-17-2010 03:57 AM

# 1
Quote:

What is going wrong here ?
The answer is :
Everything seems to be done in a way, that will cause errors.
* None of your commands are to be done as root.
( Only 'make install', when you eventually come to that.)
* The "svn gcc" is version 4.6.x , I think :
May not work, for EL5 a stable version like 4.5.1 is recommendable.
* gmp, mpfr, mpc files are missing in the gcc/ folder. ?
* Plain " ../gcc/configure " will never work.
Minimum is like the ../gcc-4.5.1/configure line shown in the link, #2.
..

someshpr 11-17-2010 10:20 PM

Thanks a lot for the guides, knudfl!
I started from scratch, checked out the branch 4.5; and also downloaded the mpc, mpfr and gmp and untar-ed them in respective directories.

Here is the sequence:
Code:

spr177@mesozoic spr177$ cd /scratch/GCC
spr177@mesozoic GCC$ svn co svn://gcc.gnu.org/svn/gcc/branches/gcc-4_5-branch gcc
spr177@mesozoic GCC$ mv gcc gcc-4.5.1
spr177@mesozoic GCC$ cp -r ../gmp gcc-4.5.1/gmp
spr177@mesozoic GCC$ cp -r ../mpc gcc-4.5.1/mpc
spr177@mesozoic GCC$ cp -r ../mpfr gcc-4.5.1/mpfr
spr177@mesozoic GCC$ mkdir gcc-build
spr177@mesozoic GCC$ cd gcc-build

Then I first followed your post on the thread you linked, and got these errors during make:
Code:

spr177@mesozoic gcc-build$ ../gcc-4.5.1/configure --prefix=/usr/local/gcc451 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --with-system-zlib --libexecdir=/usr/lib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
...
spr177@mesozoic gcc-build$ make
...
gcc -c  -g -fkeep-inline-functions -DIN_GCC  -W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wc++-compat -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc-4.5.1/gcc -I../../gcc-4.5.1/gcc/. -I../../gcc-4.5.1/gcc/../include -I../../gcc-4.5.1/gcc/../libcpp/include -I/scratch/GCC/gcc-build/gmp -I/scratch/GCC/gcc-build/./mpfr -I/scratch/GCC/gcc-4.5.1/mpfr -I/scratch/GCC/gcc-4.5.1/mpc/src  -I../../gcc-4.5.1/gcc/../libdecnumber -I../../gcc-4.5.1/gcc/../libdecnumber/bid -I../libdecnumber  -I/usr/include/libelf  ../../gcc-4.5.1/gcc/lto-compress.c -o lto-compress.o
../../gcc-4.5.1/gcc/lto-compress.c:28:18: error: zlib.h: No such file or directory
../../gcc-4.5.1/gcc/lto-compress.c: In function ‘lto_zalloc’:
../../gcc-4.5.1/gcc/lto-compress.c:61: error: ‘Z_NULL’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:61: error: (Each undeclared identifier is reported only once
../../gcc-4.5.1/gcc/lto-compress.c:61: error: for each function it appears in.)
../../gcc-4.5.1/gcc/lto-compress.c: In function ‘lto_zfree’:
../../gcc-4.5.1/gcc/lto-compress.c:70: error: ‘Z_NULL’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c: In function ‘lto_normalized_zlib_level’:
../../gcc-4.5.1/gcc/lto-compress.c:83: error: ‘Z_DEFAULT_COMPRESSION’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:85: error: ‘Z_NO_COMPRESSION’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:87: error: ‘Z_BEST_COMPRESSION’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c: In function ‘lto_end_compression’:
../../gcc-4.5.1/gcc/lto-compress.c:174: error: ‘z_stream’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:174: error: expected ‘;’ before ‘out_stream’
../../gcc-4.5.1/gcc/lto-compress.c:175: warning: ISO C90 forbids mixed declarations and code
../../gcc-4.5.1/gcc/lto-compress.c:180: error: ‘out_stream’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:186: error: ‘Z_NULL’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:188: warning: implicit declaration of function ‘deflateInit’
../../gcc-4.5.1/gcc/lto-compress.c:189: error: ‘Z_OK’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:190: warning: implicit declaration of function ‘zError’
../../gcc-4.5.1/gcc/lto-compress.c:190: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
../../gcc-4.5.1/gcc/lto-compress.c:196: warning: implicit declaration of function ‘deflate’
../../gcc-4.5.1/gcc/lto-compress.c:196: error: ‘Z_FINISH’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:197: error: ‘Z_STREAM_END’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:198: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
../../gcc-4.5.1/gcc/lto-compress.c:217: warning: implicit declaration of function ‘deflateEnd’
../../gcc-4.5.1/gcc/lto-compress.c:219: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
../../gcc-4.5.1/gcc/lto-compress.c: In function ‘lto_end_uncompression’:
../../gcc-4.5.1/gcc/lto-compress.c:266: error: ‘z_stream’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:266: error: expected ‘;’ before ‘in_stream’
../../gcc-4.5.1/gcc/lto-compress.c:267: warning: ISO C90 forbids mixed declarations and code
../../gcc-4.5.1/gcc/lto-compress.c:270: error: ‘in_stream’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:276: error: ‘Z_NULL’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:278: warning: implicit declaration of function ‘inflateInit’
../../gcc-4.5.1/gcc/lto-compress.c:279: error: ‘Z_OK’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:280: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
../../gcc-4.5.1/gcc/lto-compress.c:286: warning: implicit declaration of function ‘inflate’
../../gcc-4.5.1/gcc/lto-compress.c:286: error: ‘Z_SYNC_FLUSH’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:287: error: ‘Z_STREAM_END’ undeclared (first use in this function)
../../gcc-4.5.1/gcc/lto-compress.c:288: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
../../gcc-4.5.1/gcc/lto-compress.c:307: warning: implicit declaration of function ‘inflateEnd’
../../gcc-4.5.1/gcc/lto-compress.c:309: warning: format ‘%s’ expects type ‘char *’, but argument 2 has type ‘int’
make[3]: *** [lto-compress.o] Error 1
make[3]: Leaving directory `/scratch/GCC/gcc-build/gcc'
make[2]: *** [all-stage1-gcc] Error 2
make[2]: Leaving directory `/scratch/GCC/gcc-build'
make[1]: *** [stage1-bubble] Error 2
make[1]: Leaving directory `/scratch/GCC/gcc-build'
make: *** [all] Error 2

Then I checked whether zlib is present in the system or not. It seems it is there.
Code:

[root@mesozoic ~]# yum list installed | grep zlib
zlib.i386                                1.2.3-3                      installed
zlib.x86_64                              1.2.3-3                      installed

I do not know why it couldn't find zlib.
Anyway, next thing I tried was to run configure with zlib of the gcc-4.5.1 directory.
Code:

spr177@mesozoic gcc-build$ make distclean
spr177@mesozoic gcc-build$ ../gcc-4.5.1/configure --prefix=/usr/local/gcc451 --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++ --disable-multilib --with-zlib-include=$(pwd)/zlib --with-zlib-lib=$(pwd)/zlib --with-gmp-include=$(pwd)/gmp --with-gmp-lib=$(pwd)/gmp/.libs
...
spr177@mesozoic gcc-build$ make

And it worked!

However, not all tests passed in the make check. Here is the summary
Code:

spr177@mesozoic gcc-build$ ../gcc-4.5.1/contrib/test_summary | grep -A7 Summ
                === gcc Summary ===

# of expected passes                71605
# of unexpected failures        33
# of unexpected successes        16
# of expected failures                189
# of unsupported tests                1703
/scratch/GCC/gcc-build/gcc/xgcc  version 4.5.2 20101117 (prerelease) (GCC)
--
                === g++ Summary ===

# of expected passes                23001
# of expected failures                151
# of unsupported tests                305
/scratch/GCC/gcc-build/gcc/testsuite/g++/../../g++  version 4.5.2 20101117 (prerelease) (GCC)

                === libgomp tests ===
--
                === libgomp Summary ===

# of expected passes                1029
                === libmudflap tests ===


Running target unix
FAIL: libmudflap.c/pass46-frag.c (-O2) (test for excess errors)
--
                === libmudflap Summary ===

# of expected passes                1880
# of unexpected failures        14
                === libstdc++ tests ===


Running target unix
--
                === libstdc++ Summary ===

# of expected passes                7719
# of expected failures                95
# of unsupported tests                13

Compiler version: 4.5.2 20101117 (prerelease) (GCC)
Platform: x86_64-unknown-linux-gnu

Two things:
First, I read earlier that that some tests will fail! But from this result how do I figure out if this configuration/make is ok to install?
Second, while doing `make install' is it advisable to be root? I want to be installed globally, but do not want to change the global gcc installation. That means I want to have two versions of gcc available globally. I believe new gcc will be treated as gcc541 (guessing from the configure flags).

TIA,

knudfl 11-18-2010 02:47 AM

Please have a look at this thread again, to read how you are installing
and using multiple gcc :
http://www.linuxquestions.org/questi...-1-a-842567/#5


About your zlib error : zlib is not installed !
I.e. the package "zlib" is only a small part of the complete zlib.
Libraries come in two or more packages.
To compile something, e.g. gcc with zlib : # yum install zlib-devel


About tests: '4.5.2 pre' is not a final version. So it's a "don't know".
An example, stable gcc source code SRC RPM ( Redhat EL6, gcc-4.4.4 ) :
http://ftp.redhat.com/pub/redhat/lin...13.el6.src.rpm
( Unpack with 'rpm2cpio gcc-4.4.4-13.el6.src.rpm | cpio -idmv' ).
..

someshpr 11-18-2010 06:55 PM

DONE!
 
Quote:

Originally Posted by knudfl (Post 4162822)
Please have a look at this thread again, to read how you are installing
and using multiple gcc :
http://www.linuxquestions.org/questi...-1-a-842567/#5

Thanks a lot knudfl!
Installed gcc as per the instructions, and everything seem to work fine!

Quote:

Originally Posted by knudfl (Post 4162822)
About your zlib error : zlib is not installed !
I.e. the package "zlib" is only a small part of the complete zlib.
Libraries come in two or more packages.
To compile something, e.g. gcc with zlib : # yum install zlib-devel

So is that why always there are a regular version and a devel version of some packages? I guess the devel package is needed for development tools and libraries.

Quote:

Originally Posted by knudfl (Post 4162822)
About tests: '4.5.2 pre' is not a final version. So it's a "don't know".
An example, stable gcc source code SRC RPM ( Redhat EL6, gcc-4.4.4 ) :
http://ftp.redhat.com/pub/redhat/lin...13.el6.src.rpm
( Unpack with 'rpm2cpio gcc-4.4.4-13.el6.src.rpm | cpio -idmv' ).
..

Just a quick question, is there way to check out the exact version (say, 4.5.1) not the current version (4.5.2-pre in this case) by svn for gcc? As per the gcc website, svn list only gives branch number, i.e., 4.5-branch.
Also how do I check which version am I checking out? svn log and info doesn't seem to help!

Thank a lot,

knudfl 11-18-2010 10:38 PM

GCC, all versions : Google, gcc → → releases

http://gcc.gnu.org/releases.html

E.g. 4.5.1 http://gcc.gnu.org/gcc-4.5/
> > 'our mirror sites' http://gcc.gnu.org/mirrors.html
> Example UK http://gcc-uk.internet.bs/ >> releases :
http://gcc-uk.internet.bs/releases/
... where 4.5.1 appears as the latest stable : gcc-4.5.1.tar.bz2
...

someshpr 11-18-2010 10:59 PM

Quote:

Originally Posted by knudfl (Post 4163873)
GCC, all versions : Google, gcc → → releases

http://gcc.gnu.org/releases.html

E.g. 4.5.1 http://gcc.gnu.org/gcc-4.5/
> > 'our mirror sites' http://gcc.gnu.org/mirrors.html
> Example UK http://gcc-uk.internet.bs/ >> releases :
http://gcc-uk.internet.bs/releases/
... where 4.5.1 appears as the latest stable : gcc-4.5.1.tar.bz2
...

Yes I can download the tarballs, but I was thinking if there is anyway to check out a particular version using svn (subversion) ... just curious!

TIA,

knudfl 11-19-2010 05:13 AM

Quote:

.. but I was thinking if there is anyway to check out a
particular version using svn (subversion) ... just curious !
None, that I know about.
But then again : There are lots of things, I know nothing about.


# 6 :
Quote:

So is that why always there are a regular version and a devel version
of some packages? I guess the devel package is needed for development
tools and libraries.
Only libraries come as "lib<name>-devel".
And they are mostly used for compiling only.
I.e. when you never compile, only the runtime library is required.
To see, what they contain, please try these commands :
'rpm -ql zlib' , 'rpm -ql zlib-devel'.

Example content in a lib<name>-devel package :
/usr/lib/lib<name>.so ( a symlink to "real name" or to "so name" )
/usr/lib/pkgconfig/<name>.pc : The "package config file"
/usr/bin/<name>-config
/usr/include/headers.h : Code required for compilation.
..

someshpr 11-19-2010 08:23 AM

Thanks a lot knudfl, for all the clarifications!


All times are GMT -5. The time now is 12:28 PM.