Linked dylibs built for GC-only but object files built for retain/release for architecture x86_64

时间:2023-02-06 15:01:24

编译开源Xcode 插件 SCXcodeSwitchExpander

Linked dylibs built for GC-only but object files built for retain/release for architecture x86_64

源码地址: https://github.com/stefanceriu/SCXcodeSwitchExpander

编译环境:Xcode5.1

系统版本:OSX 10.8.5

提示下面错误

Linked dylibs built for GC-only but object files built for retain/release for architecture x86_64

考虑是不是ARC引起的,发现building setting 已经设置了开启arc,项目中也没有使用dylib,只有下面的几个静态库

Linked dylibs built for GC-only but object files built for retain/release for architecture x86_64

尝试寻找这几个库文件,发现SDK的Frameworks中并不存在。

通过building setting 中Framework search paths 发现库文件是在Xcode应用程序里面,路径如下

$(SYSTEM_APPS_DIR)/Xcode.app/Contents/SharedFrameworks
$(SYSTEM_APPS_DIR)/Xcode.app/Contents/Frameworks
$(SYSTEM_APPS_DIR)/Xcode.app/Contents/OtherFrameworks

发现原因,由于本机的应用程序中安装了多个版本的Xcode,默认自动搜索framework在Xcode.app中,如下

Linked dylibs built for GC-only but object files built for retain/release for architecture x86_64

将Framework search paths中的路径修改为当前编译使用的Xcode,成功编译。