Error: invalid instruction suffix for `push'

2019-08-02 15:39发布

问题:

I have been having issues with compiling a program. I am unsure what these mean and I would be grateful if anyone could help.

C:\Users\Joshua\Documents\GitHub\Zeus-TSO\_deps\libmpg123\dct64_sse.S: Assembler
 messages:
C:\Users\Joshua\Documents\GitHub\Zeus-TSO\_deps\libmpg123\dct64_sse.S:41: Error:
 invalid instruction suffix for `push'
C:\Users\Joshua\Documents\GitHub\Zeus-TSO\_deps\libmpg123\dct64_sse.S:46: Error:
 invalid instruction suffix for `push'
C:\Users\Joshua\Documents\GitHub\Zeus-TSO\_deps\libmpg123\dct64_sse.S:449: Error: invalid instruction suffix for `pop'
C:\Users\Joshua\Documents\GitHub\Zeus-TSO\_deps\libmpg123\dct64_sse.S:451: Error: invalid instruction suffix for `pop'
_deps\libmpg123\CMakeFiles\libmpg123_static.dir\build.make:378: recipe for targe
t '_deps/libmpg123/CMakeFiles/libmpg123_static.dir/dct64_sse.S.obj' failed
mingw32-make[2]:  [_deps/libmpg123/CMakeFiles/libmpg123_static.dir/dct64_sse.
S.obj] Error 1
CMakeFiles\Makefile2:225: recipe for target '_deps/libmpg123/CMakeFiles/libmpg12
3_static.dir/all' failed
mingw32-make[1]:  [_deps/libmpg123/CMakeFiles/libmpg123_static.dir/all] Error
 2
Makefile:74: recipe for target 'all' failed
mingw32-make:  [all] Error 2

回答1:

It appears that you are trying to build 32-bit assembly code with 64-bit assembler.

You have 2 options:

  1. Use 32-bit assembler, for example by utilizing --32 option;
  2. Change code by substituting 64-bit (extended) registers such as %rax, for example, instead of 32-bit registers such as %eax used with push/pop instructions.

Since the build system appears to be CMake, I'd refer you to this manual on how to configure the build for various Assembly dialects in CMake.

You could try:

set(CMAKE_ASM_FLAGS "--32")

but I haven't tested it.