LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 08-10-2008, 09:05 AM   #1
maxreason
Member
 
Registered: Dec 2007
Location: phobos, mars
Distribution: 64-bit ubuntu 12.04 LTS
Posts: 205

Rep: Reputation: 15
Question why get compiler error: suffix or operands invalid for 'push' (or 'pop')


I am trying to compile a program with the current 64-bit ubuntu (8.04.1 LTS) and current "ganymede" eclipse IDE/CDT (5.0), but it generates the following strange error message on every line with "pushl %ebp" or "popl %ebp":

suffix or operands invalid for 'push'
suffix or operands invalid for 'pop'

This exact project compiles and runs fine in 32-bit fedora8 with eclipse IDE/CDT (v3.3, I believe). I suspect the problem has something to do with me trying to compile a 32-bit application on a 64-bit system - even though I have added -m32 compiler switch to tell the build-tools to generate a 32-bit application. But I'm not sure.

Here are the important background facts. Any ideas? Note: I find this error reported many, many places on a search of the internet, but none of the first couple dozen links have suggested an answer - though they all seem to involve people with a 64-bit OS.

-----

1: Every file in the project is identical, except whatever eclipse may have done when it imported the entire project.

2: I added a -m32 switch to the compilation process to make sure the compiler and build tools understand I am trying to generate a 32-bit application.

3: The original system that contained fedora8 + eclipse + this program was running on a different motherboard, but I doubt that makes any difference, since the old motherboard had a dual-core Athlon64 CPU and the new motherboard has a quad-core Phenom64 CPU.

4: The new system contains the current 64-bit ubuntu (v8.04.1 LTS) and the current "ganymede" eclipse, both downloaded and installed just days ago.

5: The errors are being reported in MY assembly-language file, not code generated by the compiler or in some C or OpenGL library.

6: In a lame attempt to solve the problem, I made sure I had the "ia32-libs" and "gcc-multilibs" packages installed with "apt-get install", but that changed nothing.
 
Old 08-10-2008, 10:42 AM   #2
PTrenholme
Senior Member
 
Registered: Dec 2004
Location: Olympia, WA, USA
Distribution: Fedora, (K)Ubuntu
Posts: 4,150

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Just a suspicion, but "push" and "pop" are assembly-language commands, and it's possible that the application you're trying to compile has some assembly code sections. At the assembly language level you may need to set additional (or different) options to compile 32-bit code for a 64-bit processor. (Note: I'm just guessing here, not speaking from any experience.)
 
  


Reply


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
glibc in capter 6 -- error: cannot compute suffix of object files Yoyo302 Linux From Scratch 23 05-21-2010 08:28 AM
Error: suffix or operands invalid for `push' in 64 machine arya Linux - General 1 04-19-2007 10:32 AM
configure error : cannot compute suffix of object files status1 Linux From Scratch 1 10-14-2006 10:18 AM
what does "prog7.c:11: error: invalid operands to binary %" mean hubabuba Programming 6 11-16-2004 11:13 AM
gcc: invalid operands ajacques Linux - General 1 10-25-2004 07:31 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration