LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-10-2009, 10:40 AM   #1
Van Der Berg
LQ Newbie
 
Registered: May 2006
Posts: 11

Rep: Reputation: 0
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
 
Old 09-11-2009, 01:13 AM   #2
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
'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 ?
 
Old 09-11-2009, 03:38 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,425

Rep: Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622
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.)
.....

Last edited by knudfl; 09-11-2009 at 04:03 AM.
 
Old 09-11-2009, 05:22 AM   #4
Van Der Berg
LQ Newbie
 
Registered: May 2006
Posts: 11

Original Poster
Rep: Reputation: 0
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
 
Old 09-11-2009, 05:30 AM   #5
Van Der Berg
LQ Newbie
 
Registered: May 2006
Posts: 11

Original Poster
Rep: Reputation: 0
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?
 
Old 09-11-2009, 05:55 AM   #6
Valery Reznic
ELF Statifier author
 
Registered: Oct 2007
Posts: 676

Rep: Reputation: 137Reputation: 137
Quote:
Originally Posted by Van Der Berg View Post
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)
 
Old 09-11-2009, 06:58 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,425

Rep: Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622Reputation: 3622
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.
.....
 
Old 10-05-2009, 01:31 PM   #8
mba56
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
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?
 
Old 10-05-2009, 01:49 PM   #9
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
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).
 
Old 10-05-2009, 03:22 PM   #10
mba56
LQ Newbie
 
Registered: Oct 2009
Posts: 2

Rep: Reputation: 0
thanks but are you sure it would work on x86_64 machine.

Quote:
Originally Posted by lazlow View Post
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).
 
Old 10-05-2009, 04:46 PM   #11
lazlow
Senior Member
 
Registered: Jan 2006
Posts: 4,363

Rep: Reputation: 172Reputation: 172
Works fine on 64bit Centos 5.0-5.3.
 
  


Reply

Tags
gcc295


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Xen 3.2 on CentOS 5.2 x86_64 / RHEL 5.2 x86_64 LXer Syndicated Linux News 0 07-12-2008 05:51 PM
k3b doesn't run on Centos 5 x86_64 dralexpe Linux - Software 7 08-05-2007 11:37 AM
CentOS 4 (x86_64 or i386) Mithrilhall Linux - Newbie 2 07-14-2006 10:36 AM
gcc 2.96 on x86_64 balaji.k Linux - Software 3 02-21-2006 09:34 PM
Kernel compiling: gcc-3.3 is 586, should be gcc-3.3 386 Erik Plaggenmar Linux - Software 0 10-01-2004 11:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration