我的设置:
Mac OS X 10.7.4
Xcode 4.3.2
我有一个 Mac OS X 应用程序,它加载嵌入式 Cocoa 可加载捆绑包以用作插件。插件包含在.app
标准位置 ( MyApp.app/Contents/PlugIns
) 的 Mac 应用程序包中,并通过标准 Cocoa NSBundle
API 加载。插件被复制到标准“复制文件”构建阶段中的最终 Mac 应用程序包中,目标设置为PlugIns
. 我会将其描述为 Mac 应用程序的标准 Cocoa 插件设置。
然而,有一件事有点不寻常。我正在使用该-bundle_loader
选项在构建时将插件包链接到我的主应用程序中的公共符号。我最初是在 Xcode 3 中设置的,它一直运行良好。
以下是 Xcode 的描述-bundle_loader
:
Bundle Loader
BUNDLE_LOADER
Specifies the executable that will be loading the bundle output file being linked. Undefined symbols from the bundle are checked against the specified executable like it was one of the dynamic libraries the bundle was linked with. [BUNDLE_LOADER, -bundle_loader]
在 Xcode 4 中,我仍然可以在调试和发布构建配置中成功构建和运行我的 Mac 应用程序。没问题。(我通过将默认运行操作的构建配置设置为调试或发布来做到这一点)。两种配置都可以正常构建和运行。
这是我的问题:在 Xcode 4 中,我无法成功归档我的 Mac 应用程序。插件包不会在链接时链接到主应用程序可执行文件(在构建过程中编译后立即)。
我的存档操作设置为使用发布构建配置进行构建(当然)。正如我所提到的,使用Run Action使用 Release Build Configuration 构建没有问题。该问题仅在执行存档操作时出现。
这是我在尝试存档时收到的链接错误(在编译第一个插件包的源代码后立即发生):
Ld /Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/InstallationBuildProductsLocation/Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release/Fake.app/Contents/PlugIns/Tabs.fluidplugin/Contents/MacOS/Tabs normal x86_64
cd /Volumes/SystemY/Users/<myusername>/work/fluidium/trunk/Fluidium
setenv MACOSX_DEPLOYMENT_TARGET 10.6
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch x86_64 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.6.sdk -L/Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release -F/Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release -filelist /Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/IntermediateBuildFilesPath/Fluidium.build/Release/TabsPlugIn.build/Objects-normal/x86_64/Tabs.LinkFileList -mmacosx-version-min=10.6 -bundle_loader /Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release/FluidApp.app/Contents/MacOS/FluidApp /Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release/TDAppKit.framework/TDAppKit -framework Quartz -framework WebKit -framework Cocoa -o /Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/InstallationBuildProductsLocation/Users/<myusername>/Library/Developer/Xcode/DerivedData/Fluidium-ajljctlwoiqpcodskkcwxrxngeyo/Build/Intermediates/ArchiveIntermediates/Fake/BuildProductsPath/Release/Fake.app/Contents/PlugIns/Tabs.fluidplugin/Contents/MacOS/Tabs
Undefined symbols for architecture x86_64:
"_OBJC_IVAR_$_FUPlugIn.aboutInfoDictionary", referenced from:
-[FUTabsPlugIn aboutInfoDictionary] in FUTabsPlugIn.o
"_OBJC_CLASS_$_FUPlugIn", referenced from:
_OBJC_CLASS_$_FUTabsPlugIn in FUTabsPlugIn.o
"_OBJC_METACLASS_$_FUPlugIn", referenced from:
_OBJC_METACLASS_$_FUTabsPlugIn in FUTabsPlugIn.o
"_FUTabControllerProgressDidStartNotification", referenced from:
-[FUTabsViewController startObserveringTabController:] in FUTabsViewController.o
-[FUTabsViewController stopObserveringTabController:] in FUTabsViewController.o
"_FUTabControllerProgressDidChangeNotification", referenced from:
-[FUTabsViewController startObserveringTabController:] in FUTabsViewController.o
-[FUTabsViewController stopObserveringTabController:] in FUTabsViewController.o
"_FUTabControllerProgressDidFinishNotification", referenced from:
-[FUTabsViewController startObserveringTabController:] in FUTabsViewController.o
-[FUTabsViewController stopObserveringTabController:] in FUTabsViewController.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
最后一点:我在用作“捆绑加载器”的 Mac App 目标上设置了以下构建设置:
复制期间剥离调试符号:否(对于调试和发布)
默认隐藏符号:否(对于调试和发布)