mac 系统升级后,gcc/clang 提示 ld:malformed file 错误
问题
升级了系统到 macOS Mojave 10.14.4,使用gcc 和 clang 编译时,总是提示如下错误
➜ tmp gcc main.c
ld: malformed file
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd:4:18: error: unknown enumerated scalar
platform: zippered
^~~~~~~~
file '/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib/libSystem.tbd'
clang: error: linker command failed with exit code 1 (use -v to see invocation)
问题原因
这是因为xcode没有升级导致。系统中用的xcode还是9.x版本,需要升级到10.x 版本
解决方案
升级xcode。
app store -> 搜索 xcode -> 安装或升级
作者:JarvisChu
原文链接:mac 系统升级后,gcc/clang 提示 ld:malformed file 错误
版权声明:自由转载-非商用-非衍生-保持署名 | Creative Commons BY-NC-ND 3.0