f



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

On a 64-bit Scientific Linux 5.4 machine, I get the following
when I try to compile the basic "Hello world" program:

[root]# g++ -Wall hello.cc -o hello
/tmp/ccglIDXK.s: Assembler messages:
/tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
/tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
/tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'

Contents of hello.cc:
#include <iostream>

int
main ()
{
  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
0
Richard
3/24/2010 2:37:18 PM
comp.os.linux.misc 33599 articles. 1 followers. amosa69 (78) is leader. Post Follow

9 Replies
2368 Views

Similar Articles

[PageSpeed] 53

At Wed, 24 Mar 2010 07:37:18 -0700 (PDT) Richard Vaughn <rvaughn9@gmail.com> wrote:

> 
> On a 64-bit Scientific Linux 5.4 machine, I get the following
> when I try to compile the basic "Hello world" program:
> 
> [root]# g++ -Wall hello.cc -o hello
> /tmp/ccglIDXK.s: Assembler messages:
> /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
> /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
> 
> Contents of hello.cc:
> #include <iostream>
> 
> int
> main ()
> {
>   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?

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


> 
> Thanks,
> -Richard Vaughn
>           

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
heller@deepsoft.com       -- http://www.deepsoft.com/ModelRailroadSystem/
                                                                                      
0
Robert
3/24/2010 3:13:34 PM
Richard Vaughn wrote:

> On a 64-bit Scientific Linux 5.4 machine, I get the following
> when I try to compile the basic "Hello world" program:
> 
> [root]# g++ -Wall hello.cc -o hello
> /tmp/ccglIDXK.s: Assembler messages:
> /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
> /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
> /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
> 
> Contents of hello.cc:
> #include <iostream>
> 
> int
> main ()
> {
>   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
0
Darrell
3/24/2010 3:45:06 PM
On Robert Heller's 64-bit centOS machine (above):
"g++ -v" provides:
   Target: x86_64-redhat-linux
    host=3Dx86_64-redhat-linux

On my 64-bit ScientificLinux machine:
"g++ -v" provides:
   Target: i386-redhat-linux
    host=3Di386-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

On Mar 24, 11:45=A0am, Darrell Stec <dars...@neo.rr.com> wrote:
> Richard Vaughn wrote:
> > On a 64-bit Scientific Linux 5.4 machine, I get the following
> > when I try to compile the basic "Hello world" program:
>
> > [root]# g++ -Wall hello.cc -o hello
> > /tmp/ccglIDXK.s: Assembler messages:
> > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
> > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
> > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
>
> > Contents of hello.cc:
> > #include <iostream>
>
> > int
> > main ()
> > {
> > =A0 std::cout << "Hello, world!\n";
> > =A0 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 an=
d
> development files installed.
>
> --
> Later,
> Darrell

0
Richard
3/24/2010 3:58:41 PM
At Wed, 24 Mar 2010 08:58:41 -0700 (PDT) Richard Vaughn <rvaughn9@gmail.com> wrote:

> 
> On Robert Heller's 64-bit centOS machine (above):
> "g++ -v" provides:
>    Target: x86_64-redhat-linux
>     host=3Dx86_64-redhat-linux
> 
> On my 64-bit ScientificLinux machine:
> "g++ -v" provides:
>    Target: i386-redhat-linux
>     host=3Di386-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?

Probably.

> And if so, how to proceed?

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.

> 
> Thanks,
> -Richard
> 
> On Mar 24, 11:45=A0am, Darrell Stec <dars...@neo.rr.com> wrote:
> > Richard Vaughn wrote:
> > > On a 64-bit Scientific Linux 5.4 machine, I get the following
> > > when I try to compile the basic "Hello world" program:
> >
> > > [root]# g++ -Wall hello.cc -o hello
> > > /tmp/ccglIDXK.s: Assembler messages:
> > > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
> > > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
> > > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
> >
> > > Contents of hello.cc:
> > > #include <iostream>
> >
> > > int
> > > main ()
> > > {
> > > =A0 std::cout << "Hello, world!\n";
> > > =A0 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 an=
> d
> > development files installed.
> >
> > --
> > Later,
> > Darrell
> 
>                          

-- 
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Download the Model Railroad System
http://www.deepsoft.com/  -- Binaries for Linux and MS-Windows
heller@deepsoft.com       -- http://www.deepsoft.com/ModelRailroadSystem/
                                                                                            
0
Robert
3/24/2010 4:44:21 PM
Richard Vaughn wrote:

> 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
> 

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

> On Mar 24, 11:45 am, Darrell Stec <dars...@neo.rr.com> wrote:
>> Richard Vaughn wrote:
>> > On a 64-bit Scientific Linux 5.4 machine, I get the following
>> > when I try to compile the basic "Hello world" program:
>>
>> > [root]# g++ -Wall hello.cc -o hello
>> > /tmp/ccglIDXK.s: Assembler messages:
>> > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
>> > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
>> > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
>>
>> > Contents of hello.cc:
>> > #include <iostream>
>>
>> > int
>> > main ()
>> > {
>> > 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

-- 
Later,
Darrell
0
Darrell
3/24/2010 4:56:52 PM
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 Mar 24, 12:56=A0pm, Darrell Stec <dars...@neo.rr.com> wrote:
> Richard Vaughn wrote:
> > On Robert Heller's 64-bit centOS machine (above):
> > "g++ -v" provides:
> > =A0 =A0Target: x86_64-redhat-linux
> > =A0 =A0 host=3Dx86_64-redhat-linux
>
> > On my 64-bit ScientificLinux machine:
> > "g++ -v" provides:
> > =A0 =A0Target: i386-redhat-linux
> > =A0 =A0 host=3Di386-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.... =A0why does my g++ have a Target/host *not* as x86_64?
> > And is that the problem?
> > And if so, how to proceed?
>
> > Thanks,
> > -Richard
>
> Are you sure you have the 64-bit version of the software installed? =A0Wh=
at do
> "uname -a" =A0and "cat /etc/issue" give you?
>
>
>
> > On Mar 24, 11:45 am, Darrell Stec <dars...@neo.rr.com> wrote:
> >> Richard Vaughn wrote:
> >> > On a 64-bit Scientific Linux 5.4 machine, I get the following
> >> > when I try to compile the basic "Hello world" program:
>
> >> > [root]# g++ -Wall hello.cc -o hello
> >> > /tmp/ccglIDXK.s: Assembler messages:
> >> > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
> >> > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
> >> > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
>
> >> > Contents of hello.cc:
> >> > #include <iostream>
>
> >> > int
> >> > main ()
> >> > {
> >> > 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
>
> --
> Later,
> Darrell

0
Richard
3/24/2010 7:58:46 PM
At Wed, 24 Mar 2010 12:58:46 -0700 (PDT) Richard Vaughn <rvaughn9@gmail.com> wrote:

> 
> 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.

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.deepsoft.com/  -- Binaries for Linux and MS-Windows
heller@deepsoft.com       -- http://www.deepsoft.com/ModelRailroadSystem/
                                                                                                   
0
Robert
3/24/2010 10:17:38 PM
Richard Vaughn wrote:

> 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
>
Good luck.

> On Mar 24, 12:56 pm, Darrell Stec <dars...@neo.rr.com> wrote:
>> Richard Vaughn wrote:
>> > 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
>>
>> Are you sure you have the 64-bit version of the software installed?  What
>> do "uname -a"  and "cat /etc/issue" give you?
>>
>>
>>
>> > On Mar 24, 11:45 am, Darrell Stec <dars...@neo.rr.com> wrote:
>> >> Richard Vaughn wrote:
>> >> > On a 64-bit Scientific Linux 5.4 machine, I get the following
>> >> > when I try to compile the basic "Hello world" program:
>>
>> >> > [root]# g++ -Wall hello.cc -o hello
>> >> > /tmp/ccglIDXK.s: Assembler messages:
>> >> > /tmp/ccglIDXK.s:10: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:38: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:55: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:79: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:81: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:85: Error: suffix or operands invalid for `push'
>> >> > /tmp/ccglIDXK.s:94: Error: suffix or operands invalid for `pop'
>> >> > /tmp/ccglIDXK.s:95: Error: suffix or operands invalid for `pop'
>>
>> >> > Contents of hello.cc:
>> >> > #include <iostream>
>>
>> >> > int
>> >> > main ()
>> >> > {
>> >> > 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
>>
>> --
>> Later,
>> Darrell

-- 
Later,
Darrell
0
Darrell
3/24/2010 10:18:06 PM
On Mar 24, 6:17=A0pm, Robert Heller <hel...@deepsoft.com> wrote:
> At Wed, 24 Mar 2010 12:58:46 -0700 (PDT) Richard Vaughn <rvaug...@gmail.c=
om> wrote:
>
>
>
> > 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.
>
> Yep. =A0'Upgrading' from 32-bit to 64-bit is NOT a recomended procedure..=
..

*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.
0
Nico
3/25/2010 11:49:37 AM
Reply: