LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   compiling gcc-2.95.3 on centos 5.3 x86_64 (https://www.linuxquestions.org/questions/linux-software-2/compiling-gcc-2-95-3-on-centos-5-3-x86_64-a-754176/)

Van Der Berg 09-10-2009 10:40 AM

compiling gcc-2.95.3 on centos 5.3 x86_64
 
hi all,

i am having problems compiling gcc-2.95.3 on new version of CentOS linux on 8-core intel server, which is, of course, 64bit.
(i know the first answer will be 'why the hell would you want to compile gcc-2.95.3 there?', but the source code of runitme environment i am working on is very old, and it won't compile with any gcc newer than 2.95).

first problem is that configure script doesn't recognize x86_64 architecture, which is natural, since gcc 2.95.3 is about 11 years old.
when i do something like
./configure i386-linux --prefix=...
Makefile is generated and i can start compiling, but, of course, this doesn't work. i get the following error :

/tmp/ccChnwOy.s: Assembler messages:
/tmp/ccChnwOy.s:282: Error: suffix or operands invalid for `push'
/tmp/ccChnwOy.s:285: Error: suffix or operands invalid for `push'
/tmp/ccChnwOy.s:286: Error: suffix or operands invalid for `push'
/tmp/ccChnwOy.s:305: Error: suffix or operands invalid for `pop'
/tmp/ccChnwOy.s:306: Error: suffix or operands invalid for `pop'

ok, i figured out the problem is with 32bit assembly code. so, i have edited Makefile and inserted something like CFLAGS=-m32 -g -O2, and also CXXFLAGS=-m32 -g -O2. i got rid of the previous error message, but now the error is

/usr/bin/ld: warning: i386 architecture of input file `../libiberty/libiberty.a(choose-temp.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `../libiberty/libiberty.a(pexecute.o)' is incompatible with i386:x86-64 output
/usr/bin/ld: warning: i386 architecture of input file `../libiberty/libiberty.a(mkstemps.o)' is incompatible with i386:x86-64 output
../libiberty/libiberty.a(choose-temp.o): In function `try':
choose-temp.c:(.text+0x30): undefined reference to `access'
../libiberty/libiberty.a(choose-temp.o): In function `make_temp_file':
choose-temp.c:(.text+0x51): undefined reference to `getenv'
choose-temp.c:(.text+0x66): undefined reference to `getenv'
choose-temp.c:(.text+0x7b): undefined reference to `getenv'
choose-temp.c:(.text+0xb8): undefined reference to `strlen'
choose-temp.c:(.text+0xd5): undefined reference to `strlen'
choose-temp.c:(.text+0xe4): undefined reference to `xmalloc'
choose-temp.c:(.text+0xf2): undefined reference to `strcpy'
choose-temp.c:(.text+0x131): undefined reference to `strcat'
choose-temp.c:(.text+0x140): undefined reference to `mkstemps'
choose-temp.c:(.text+0x14d): undefined reference to `close'
choose-temp.c:(.text+0x16b): undefined reference to `abort'
../libiberty/libiberty.a(choose-temp.o): In function `choose_temp_base':
choose-temp.c:(.text+0x181): undefined reference to `getenv'
choose-temp.c:(.text+0x196): undefined reference to `getenv'
choose-temp.c:(.text+0x1ab): undefined reference to `getenv'
choose-temp.c:(.text+0x1e4): undefined reference to `strlen'
choose-temp.c:(.text+0x1f1): undefined reference to `xmalloc'
choose-temp.c:(.text+0x1ff): undefined reference to `strcpy'
choose-temp.c:(.text+0x230): undefined reference to `mktemp'
choose-temp.c:(.text+0x24b): undefined reference to `abort'
../libiberty/libiberty.a(mkstemps.o): In function `mkstemps':
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:102: undefined reference to `__umoddi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:103: undefined reference to `__udivdi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:104: undefined reference to `__umoddi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:105: undefined reference to `__udivdi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:106: undefined reference to `__umoddi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:107: undefined reference to `__udivdi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:108: undefined reference to `__umoddi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:109: undefined reference to `__udivdi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:110: undefined reference to `__umoddi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:112: undefined reference to `__udivdi3'
/scratch/vj/build2/libiberty/../../gcc-2.95.3/libiberty/mkstemps.c:112: undefined reference to `__umoddi3'
collect2: ld returned 1 exit status
make[2]: *** [xgcc] Error 1

i have read somewhere that the problem is that -m32 flag needs to be passed to ld also, so i have tried to set both LDFLAGS=-m32 and LDFLAGS_FOR_TARGET=-m32 in Makefile, but then i got the oposite thing:

/usr/bin/ld: warning: i386:x86-64 architecture of input file `gcc.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `gccspec.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `intl.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `prefix.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `version.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `obstack.o' is incompatible with i386 output
gcc -DIN_GCC -g -DHAVE_CONFIG_H -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95.3/gcc/../include \
-DGCC_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/i386-linux/2.95.3/include\" \
-DGPLUSPLUS_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/i386-linux/2.95.3/../../../..`echo /usr/local | sed -e 's|^/usr/local||' -e 's|/[^/]*|/..|g'`/include/g++-3\" \
-DLOCAL_INCLUDE_DIR=\"/usr/local/include\" \
-DCROSS_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/i386-linux/2.95.3/../../../../i386-linux/sys-include\" \
-DTOOL_INCLUDE_DIR=\"/usr/local/lib/gcc-lib/i386-linux/2.95.3/../../../../i386-linux/include\" \
-c `echo ../../gcc-2.95.3/gcc/cccp.c | sed 's,^\./,,'`
gcc -DIN_GCC -g -DHAVE_CONFIG_H -I. -I../../gcc-2.95.3/gcc -I../../gcc-2.95.3/gcc/config -I../../gcc-2.95.3/gcc/../include -c ../../gcc-2.95.3/gcc/cexp.c
gcc -DIN_GCC -g -DHAVE_CONFIG_H -m32 -o cccp cccp.o cexp.o intl.o prefix.o version.o mbchar.o obstack.o ../libiberty/libiberty.a
/usr/bin/ld: warning: i386:x86-64 architecture of input file `cccp.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `cexp.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `intl.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `prefix.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `version.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `mbchar.o' is incompatible with i386 output
/usr/bin/ld: warning: i386:x86-64 architecture of input file `obstack.o' is incompatible with i386 output
rm -f cpp0
ln cccp cpp0
echo "int xxy_us_dummy;" >tmp-dum.c
./xgcc -B/usr/local/i386-linux/bin/ -B./ -I/usr/local/i386-linux/include -S tmp-dum.c
make[2]: *** [s-under] Segmentation fault
make[2]: Leaving directory `/scratch/vj/build2/gcc'
make[1]: *** [bootstrap] Error 2
make[1]: Leaving directory `/scratch/vj/build2/gcc'
make: *** [bootstrap] Error 2



so, does anybody have any ideas what else should i try to do?
thanks in advance

Valery Reznic 09-11-2009 01:13 AM

'why the hell would you want to compile gcc-2.95.3 there?'

Why you don't create virual machine with Linux old distro which has "native" gcc-2.95 and make your build in this VM ?

knudfl 09-11-2009 03:38 AM

Ref. @ Valery Reznic : I agree.
Virtual ... or use a spare computer.
But "old" should be as new as possible ?
to make your application run on CentOS 5.x.
( Fedora 2 , x86 , not x86_64 still had :
compat-gcc-7.3-2.96 + compat-gcc-c++-7.3-2.96 .)

Debian Etch is the newest with a gcc-2.95 , not native
but optional gcc-2.95 , g++-2.95 , both working perfectly.

To be used with e.g. './configure CC=gcc-2.95 CXX=g++-2.95'
and / or 'make CC=gcc-2.95 CXX=g++-2.95'

An application made on Debian Etch would only require some
few libs.so.x files from Etch to run on CentOS5x ( Usually.)

GCC-2.95 : only available as i386. GCC-2.95.x cannot be
compiled for x86_64 . AFAIK.
( Also extremely difficult to compile for 32 bit
on a modern system like yours, if at all possible.)
.....

Van Der Berg 09-11-2009 05:22 AM

thanks for the answers...

i am somewhat paranoid about creating virtual machine, because server is to be used for *very* high-performance computing, and i assume that virtual machine would slow down things compared to 'native' installation.

i think i will just spend a couple of days adapting the code so it can be compiled with gcc 4 and on 64bit machine, which will involve rewriting portions of assembly code...but that's another story anyway

Van Der Berg 09-11-2009 05:30 AM

just to make something clear...

suppose that i install virtual machine and i compile my program on it using gcc 2.95.3 and produce a binary...does it mean that i must also run that binary under that virtual machine, or i can transfer binary to host system (centos) and, using some magic, run it there?

Valery Reznic 09-11-2009 05:55 AM

Quote:

Originally Posted by Van Der Berg (Post 3678507)
just to make something clear...

suppose that i install virtual machine and i compile my program on it using gcc 2.95.3 and produce a binary...does it mean that i must also run that binary under that virtual machine, or i can transfer binary to host system (centos) and, using some magic, run it there?

Sure it will run under virtual machine and also good chances that it will run on your host.

If not you can resort to statifier (http://statifier.sf.net) or ermine
(http://magicErmine.com)

knudfl 09-11-2009 06:58 AM

One other possible option :
The Deb. Etch gcc-2.95 compiler works on CentOS 5.x 32-bit x86.
( just forgot, long time since I used it.)
http://packages.debian.org/etch/cpp-2.95
http://ftp.de.debian.org/debian/pool....4-27_i386.deb
http://packages.debian.org/etch/gcc-2.95
http://ftp.de.debian.org/debian/pool....4-27_i386.deb

alien -r gcc-2.95_2.95.4-27_i386.deb cpp-2.95_2.95.4-27_i386.deb
providing
gcc-2.95-2.95.4-28.i386.rpm cpp-2.95-2.95.4-28.i386.rpm
Please install with # 'rpm -Uvh .... ' , and use it.
.....
If it works on x86_64, you have an easier situation with libs etc.
.....

mba56 10-05-2009 01:31 PM

Hi Van Der Berg
Did you get your problem fixed,if yes,kindly let me know how?because i am facing same kind of problem.
Did you try last option which is proposed by knudfl,does it work for you?

lazlow 10-05-2009 01:49 PM

You might try installing the compat-gcc-296 package. The jump from 295 to 296 was pretty small and most software written for 295 will compile fine on 296.

Beyond that, you are probably better off updating the software. The advances made in the compilers will buy you a lot of performance(multithreading if nothing else).

mba56 10-05-2009 03:22 PM

thanks but are you sure it would work on x86_64 machine.

Quote:

Originally Posted by lazlow (Post 3708628)
You might try installing the compat-gcc-296 package. The jump from 295 to 296 was pretty small and most software written for 295 will compile fine on 296.

Beyond that, you are probably better off updating the software. The advances made in the compilers will buy you a lot of performance(multithreading if nothing else).


lazlow 10-05-2009 04:46 PM

Works fine on 64bit Centos 5.0-5.3.


All times are GMT -5. The time now is 01:06 PM.