Using ASM (x86) with Qt on MacOS with CMake. How?
-
Hello all!
Trying to find any examples of how to setup using ASM (x86) in Qt project with CMake. Is there any manuals or examples?
For now trying to run this examples https://firexfly.com/clang-inline-assembly/
Have this kind of errors:
error: unknown register name '%eax' in asm
or
error: unrecognized instruction mnemonic, did you mean: fmov, mov, movi, movk, movn, movz, smov, umov?
What is missing by me?
-
Hello all!
Trying to find any examples of how to setup using ASM (x86) in Qt project with CMake. Is there any manuals or examples?
For now trying to run this examples https://firexfly.com/clang-inline-assembly/
Have this kind of errors:
error: unknown register name '%eax' in asm
or
error: unrecognized instruction mnemonic, did you mean: fmov, mov, movi, movk, movn, movz, smov, umov?
What is missing by me?
@bogong said in Using ASM (x86) with Qt on MacOS with CMake. How?:
What is missing by me?
That the error messages imply that you try to use x86 assembly but your compilation is targeting arm64 (hence the assembler's complaints about the
eax
register not existing; and you getting offered ARM mnemonics likemovz
, probably in response to you trying to use themovl
mnemonic which is x86 only).- Make sure you target only x86_64 in your build (in CMake, you have
CMAKE_OSX_ARCHITECTURES
). - Or if you want to target ARM, you need to use ARM assembly code which is completely different to x86 assembly.
- If you are building universal binaries, then you need to write a different version of the inline assembly block for each architecture, and direct to the correct one with preprocessor macros.
May I ask why you think you need inline assembly? There is quite possibly an easier approach.
- Make sure you target only x86_64 in your build (in CMake, you have