【发布时间】:2018-09-28 23:05:38
【问题描述】:
查看source 设置CMAKE_ASM_NASM_OBJECT_FORMAT 应该就足够了,但似乎并非如此。
我希望以下内容能够使用 macho64 文件格式为 macOS 应用程序创建有效的构建配置。
project(hello_world ASM_NASM)
set(CMAKE_ASM_NASM_OBJECT_FORMAT macho64)
add_executable(hello_world source/main.asm)
但是,当使用 VERBOSE=1 运行 make 时
/usr/local/bin/nasm -f macho -o CMakeFiles/main.dir/source/main.asm.o /hello-world/source/main.asm
/hello-world/source/main.asm:6: error: instruction not supported in 32-bit mode
/hello-world/source/main.asm:7: error: instruction not supported in 32-bit mode
/hello-world/source/main.asm:8: error: instruction not supported in 32-bit mode
/hello-world/source/main.asm:9: error: instruction not supported in 32-bit mode
/hello-world/source/main.asm:12: error: instruction not supported in 32-bit mode
/hello-world/source/main.asm:13: error: instruction not supported in 32-bit mode
make[2]: *** [CMakeFiles/main.dir/source/main.asm.o] Error 1
make[1]: *** [CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
我们可以清楚地看到 32 位版本的 mach-o 被传递给格式标志,而不是预期的 64 位版本:macho64。
版本
- CMake 3.12.2
- NASM 2.13.03
- macOS 10.14
【问题讨论】:
-
在
project()调用中检查编译器。可能,您需要在调用之前移动设置CMAKE_ASM_NASM_OBJECT_FORMAT变量。 -
原来如此,呵呵!如果您创建答案,我会继续接受。谢谢@Tsyvarev
标签: macos assembly cmake nasm mach-o