【问题标题】:iPhone static library distribution and release build errors (but not for debug)iPhone 静态库分发和发布构建错误(但不适用于调试)
【发布时间】:2010-10-29 03:13:49
【问题描述】:

更新

Daniel 很接近,只是不是搜索路径。 GCC 4.2 下的 Prefix Header 设置为: $(SYSTEM_LIBRARY_DIR)/Frameworks/AppKit.framework/Headers/AppKit.h

我在梳理前 2 次时错过了这一点。 我删除了它,现在一切都很好。


原始问题

我已经使用/构建带有静态库的产品大约一周了,没有任何问题。

我第一次尝试构建发行版(用于临时测试),但我发现到处都是错误。

错误,奇怪的是找不到Appkit标头。这很奇怪,因为它是一个 iPhone 应用程序,不应该链接到 Appkit 标头

此外,当我从调试切换到分发/发布时,库名称“libFJSCodeDebug.a”会变为红色。我想这一定是个大线索。

为了测试,我复制了调试配置并将其重命名为 release。这建得很好。所以看来问题出在配置的某个地方。下面是我在构建时在 Xcode 中得到的 sn-p。 (注意:我将我的目标命名为 FJSCodeDebug,尽管它将同时用于调试和发布版本)

Building target “FJSCodeDebug” of project “FJSCode” with configuration “Release” — (169 errors)
    Checking Dependencies
        cd /[redacted]/FJSCode
    setenv PATH "/DeveloperBeta/Platforms/iPhoneOS.platform/Developer/usr/bin:/DeveloperBeta/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /DeveloperBeta/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 -x objective-c-header -arch armv6 -fmessage-length=0 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -fasm-blocks -Os -Wreturn-type -Wunused-variable -isysroot /DeveloperBeta/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.0.sdk -gdwarf-2 -mthumb -miphoneos-version-min=3.0 -iquote /[redacted]/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/FJSCodeDebug-generated-files.hmap -I/[redacted]/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/FJSCodeDebug-own-target-headers.hmap -I/[redacted]/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/FJSCodeDebug-all-target-headers.hmap -iquote /U[redacted]/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/FJSCodeDebug-project-headers.hmap -F/[redacted]/build/Release-iphoneos -I/[redacted]/build/Release-iphoneos/include -I/Users/coreyfloyd/Xcode/ProductionProjects/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/DerivedSources/armv6 -I/[redacted]/build/FJSCode.build/Release-iphoneos/FJSCodeDebug.build/DerivedSources -c /System/Library/Frameworks/AppKit.framework/Headers/AppKit.h -o /var/folders/R+/R+ofDLtuH1GOYQ1ZQ2C5mk+++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/AppKit-gihvhjsfuggoevbehiszhgrzcska/AppKit.h.gch
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:11:33: error: AppKit/AppKitDefines.h: No such file or directory
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:12:32: error: AppKit/AppKitErrors.h: No such file or directory
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:13:37: error: AppKit/NSGraphicsContext.h: No such file or directory
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:14:35: error: AppKit/NSAccessibility.h: No such file or directory
/System/Library/Frameworks/AppKit.framework/Headers/AppKit.h:15:32: error: AppKit/NSActionCell.h: No such file or directory

...... (continues for everything in AppKit)......


Build failed (169 errors)

我正在寻找 2 个解决方案中的 1 个: 显然,修复发布版本不会出现这些错误 要么 调整调试配置以获得发布配置所需的所有重要设置。

有什么想法吗??

【问题讨论】:

    标签: iphone cocoa-touch xcode


    【解决方案1】:

    这个

    -c /System/Library/Frameworks/AppKit.framework/Headers/AppKit.h
    

    让我相信你的构建目标正试图编译 AppKit.h 出于某种原因(虽然我认为它根本不应该这样做),和/或它在错误的地方寻找它(即在根 /System 而不是 SDK /Developer/Platforms/...)。

    您应该仔细检查您的构建设置库/框架搜索路径,并且 AppKit.h 未处于编译阶段。

    【讨论】:

    • 感谢您的提示...这不是我预期的。
    【解决方案2】:

    您的项目是否包含 Mac OS 产品?你确定你没有不小心在你的框架组中包含一个 Mac 库/框架吗?

    在 SDK2.2.1 中,我不知道为什么,但总是让我感到困惑的是,当“Active SDK”和“Active Executable”不同步时(在构建配置下拉列表中)。这会导致奇怪的链接器错误,iPhone 会尝试动态地 链接到它的库。每当我从调试/发布或设备/模拟器切换时,此设置似乎偶尔会不同步。

    也许是类似的情况,如果不看实际的项目设置就很难判断。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-06-03
      • 2015-12-07
      • 1970-01-01
      • 1970-01-01
      • 2018-10-16
      • 2020-05-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多