compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Robert Hel » Fri, 26 Mar 2010 00:13:34



Compiles and runs fine on a 64-bit CentOS 5.4 system:

sauron.deepsoft.com% cat >hello.cc
#include <iostream>

int
main ()
{
std::cout << "Hello, world!\n";
return 0;
}
heller has logged on pts/2 from :0.0 at 24-Mar-2010 11:08.
sauron.deepsoft.com% g++ -Wall hello.cc -o hello
sauron.deepsoft.com% ./hello
Hello, world!
sauron.deepsoft.com% uname -a
Linux sauron.deepsoft.com 2.6.18-164.15.1.el5xen #1 SMP Wed Mar 17
12:04:23 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux
sauron.deepsoft.com% g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--enable-checking=release --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-libgcj-multifile
--enable-languages=c,c++,objc,obj-c++,java,fortran,ada
--enable-java-awt=gtk --disable-dssi --enable-plugin
--with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
--with-cpu=generic --host=x86_64-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-46)
sauron.deepsoft.com% rpm -q binutils
binutils-2.17.50.0.6-12.el5
sauron.deepsoft.com% ld -v
GNU ld version 2.17.50.0.6-12.el5 20061020
sauron.deepsoft.com% as -v
GNU assembler version 2.17.50.0.6-12.el5 (x86_64-redhat-linux) using BFD
version 2.17.50.0.6-12.el5 20061020



--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.yqcomputer.com/
XXXX@XXXXX.COM -- http://www.yqcomputer.com/
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Darrell St » Fri, 26 Mar 2010 00:45:06


The difference could be whether or not you have all the header, source and
development files installed.

--
Later,
Darrell

 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Richard Va » Fri, 26 Mar 2010 00:58:41

On Robert Heller's 64-bit centOS machine (above):
"g++ -v" provides:
Target: x86_64-redhat-linux
host=x86_64-redhat-linux

On my 64-bit ScientificLinux machine:
"g++ -v" provides:
Target: i386-redhat-linux
host=i386-redhat-linux

gcc versions are identical (gcc version 4.1.2 20080704 (Red Hat
4.1.2-46) ).

Outputs of "rpm -q binutils", "ld -v" and "as -v" commands are also
identical.

So.... why does my g++ have a Target/host *not* as x86_64?
And is that the problem?
And if so, how to proceed?

Thanks,
-Richard



> > std::cout<<< "Hello, world!\n"; >>>> return 0;> > > }> >> > > Same program compiles/runs fine on 32-bit Scientific Linux 5.4.> >> > > Is there an Assembler issue re 64-bit v. 32-bit?> >> > > Thanks,> > > -Richard Vaughn> >> > The difference could be whether or not you have all the header, source and> > development files installed.> >> > --> > Later,> > Darrell
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Robert Hel » Fri, 26 Mar 2010 01:44:21


Probably.


What does 'uname -a' show? Do you *really* have a 64-bit system
installed? Or have you installed the 32-bit system on a 64-bit
processor? If it really is a 64-bit system (as shown by 'uname -a'), it
appears that you have the *32-bit* compiler installed and the 64-bit
binutils installed. This is probably not good. You probably shoud
uninstall the 32-bit compiler(s) and install the 64-bit ones.




--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.yqcomputer.com/
XXXX@XXXXX.COM -- http://www.yqcomputer.com/
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Darrell St » Fri, 26 Mar 2010 01:56:52


Are you sure you have the 64-bit version of the software installed? What do
"uname -a" and "cat /etc/issue" give you?




--
Later,
Darrell
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Richard Va » Fri, 26 Mar 2010 04:58:46

I think I know what the problem is.

I had initially installed 32-bit Scientific Linux 5.4 on this machine.
Then I installed the 64-bit version; upgrade, not full re-install
(partitions, file systems, etc. remain).

Apparently in so doing, not all 32-bit software is over-written
by the 64-bit version.

So now I'll install the 64-bit version from the ground up
and suspect I'll be fine.

Thanks for all the assistance.

-Richard Vaughn



> >> > On my 64-bit ScientificLinux machine> >> > "g++ -v" provides> >> > arget: i386-redhat-lin>x> > > host=i386-redhat-l>nu> >>
> > gcc versions are identical (gcc version 4.1.2 20080704 (Red>H>t
> > 4.1.2-46> )> >>
> > Outputs of "rpm -q binutils", "ld -v" and "as -v" commands are >l>o
> > identi>al> >>
> > So.... hy does my g++ have a Target/host *not* as x86>6>?
> > And is that the prob>e>?
> > And if so, how to proc>ed> >>
> > Tha>k>,
> > -Ric>ar>
>
> Are you sure you have the 64-bit version of the software installed? ha> do
> "uname -a" nd "cat /etc/issue" give >ou>
> > On Mar 24, 11:45 am, Darrell<Stec wr>t>>
> >> Richard Vaughn wr>t>> >> >> > On a 64-bit Scientific Linux 5.4 machine, I get the follo>i>> >> >> > when I try to compile the basic "Hello world" prog>am> >> >> >> > [root]# g++ -Wall hello.cc -o h>l>> >> >> > /tmp/ccglIDXK.s: Assembler messa>e>> >> >> > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `p>s>> >> >> > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `>o>> >> >> > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `>op> >> >> >> > Contents of hello>c>> >> >> > #in<lude >> >>i>> >> >> > mai> >> >> >>>>>> >> >> > std:<<out << "Hello, world!>n>> >> >> > retur> >> >> >>>> > >> >> >> > Same program compiles/runs fine on 32-bit Scientific Linux >.4> >> >> >> > Is there an Assembler issue re 64-bit v. 32->it> >> >> >> > Tha>k>> >> >> > -Richard Va>gh> >>
> >> The difference could be whether or not you have all the header, so>r>>
> >> and development files instal>ed> >>
> >> >>
> >> La>e>>
> >> Dar>el>
>
> La>er,
> Darrell
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Robert Hel » Fri, 26 Mar 2010 07:17:38


Yep. 'Upgrading' from 32-bit to 64-bit is NOT a recomended procedure...


--
Robert Heller -- 978-544-6933
Deepwoods Software -- Download the Model Railroad System
http://www.yqcomputer.com/
XXXX@XXXXX.COM -- http://www.yqcomputer.com/
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Darrell St » Fri, 26 Mar 2010 07:18:06

ichard Vaughn wrote:

Good luck.


--
Later,
Darrell
 
 
 

compiling on 32-bit vs. 64-bit (gcc fails on 64-bit)

Post by Nico Kadel » Fri, 26 Mar 2010 20:49:37


*Ouch*. did that once by accident. I'd suggest backing it up, wiping
the disks and starting over. If not, Then install the 64-bit version
somewhere, git the list of all the standard RPM's, and use yum and rpm
to reinstall *everything*, including both i386 and x86_64 versions of
things, and discard the i386 versions lying around. But it would be
much faster to re-install.