LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   why get compiler error: suffix or operands invalid for 'push' (or 'pop') (https://www.linuxquestions.org/questions/programming-9/why-get-compiler-error-suffix-or-operands-invalid-for-push-or-pop-661771/)

maxreason 08-10-2008 09:05 AM

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.

PTrenholme 08-10-2008 10:42 AM

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


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