铛链接程序命令失败,说找不到体系结构i386

时间:2018-10-12 08:07:39

标签: macos assembly linker

今天,我已将系统更新为Majove。当我想再次运行程序时,我遇到了这个问题。

我编写的代码是将源代码转换为汇编代码。程序集成功生成,但是当我尝试使用nasm和clang执行.s文件时,出现以下错误。

alu-mac:01-adder-MRVERNEY Alu$ clang --version
Apple LLVM version 10.0.0 (clang-1000.11.45.2)
Target: x86_64-apple-darwin18.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
alu-mac:01-adder-MRVERNEY Alu$ make tests/output/lets.run
nasm -f macho -o tests/output/lets.o tests/output/lets.s
clang  -g -m32 -o tests/output/lets.run c-bits/main.c tests/output/lets.o
ld: warning: The i386 architecture is deprecated for macOS (remove from the Xcode build setting: ARCHS)
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd, missing required architecture i386 in file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture i386:
  "_printf", referenced from:
      _main in main-4f8e04.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [tests/output/lets.run] Error 1
rm tests/output/lets.o
alu-mac:01-adder-MRVERNEY Alu$ make tests/output/lets.run -v
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

我认为这可能是铛故障,并尝试安装另一个LLVM版本,但效果不佳。而且我也尝试使用其他枪支/品牌,但仍然无法正常工作。

希望您能帮助我。感谢您的提前帮助:)

0 个答案:

没有答案