简体   繁体   English

"为 iOS 模拟器构建时如何强制 Xcode 编译器忽略库"

[英]How do I force the Xcode compiler to ignore a library when building for the iOS simulator

I am getting a series of linker errors when building a specific library for the iOS simulator.在为 iOS 模拟器构建特定库时,我遇到了一系列链接器错误。 The source of the issue seems to the be architecture that the library was build for which seems to cause issue when compiling for the iOS simulator.问题的根源似乎是构建库的架构,在为 iOS 模拟器编译时似乎会导致问题。 The specific library is the Aurasma augmented reality library.具体的库是 Aurasma 增强现实库。

My question would be this, is there a way to not compile a library when the code is being compiled for the iOS simulator?我的问题是,有没有办法在为 iOS 模拟器编译代码时不编译库? Although I do have some code that is dependent on that library I could easily use an #ifdef statement to only use that code when NOT in the iOS simulator.尽管我确实有一些依赖于该库的代码,但我可以轻松地使用#ifdef 语句仅在不在 iOS 模拟器中时使用该代码。

I can easily admit I may not understand the full root of the issue.我可以很容易地承认我可能不了解问题的全部根源。 I have attempted some solutions using a -weak_library linker flag with no specific progress or success.我尝试了一些使用 -weak_library 链接器标志的解决方案,但没有具体进展或成功。

"

In XCode, you can configure a separate library list for each iOS\/simulator sdk.在 XCode 中,您可以为每个 iOS\/模拟器 sdk 配置单独的库列表。 Here are the step to configure this:以下是配置此的步骤:

  • Click on your peoject->Target->Build Settings->Linking->Other Linker Flags单击您的项目->目标->构建设置->链接->其他链接器标志<\/li>
  • Click "+" for your build configuration (eg Debug) under Other Linker Flags.在 Other Linker Flags 下为您的构建配置(例如 Debug)单击“+”。<\/li>
  • For the new entry under your build configuration select "Any iOS Simulator SDK" and remove the library that you don't want to link.对于构建配置下的新条目,选择“Any iOS Simulator SDK”并删除您不想链接的库。<\/li>
  • You can add as many entries as you want by clicking the "+" button on the build configuration and configure the libraries that you want for any particular sdk.您可以通过单击构建配置上的“+”按钮添加任意数量的条目,并为任何特定 sdk 配置所需的库。<\/li><\/ul>

    Same technique can be applied for other settings in XCode for a target.相同的技术可以应用于 XCode 中针对目标的其他设置。

    "

我遇到了同样的问题,我所做的是将统一项目配置为编译为模拟器 SDK,然后在 Xcode 中我将目标>构建设置更改为编译为发布,如果我记得清楚并且宾果游戏项目工作并且我有未签名ipa 文件。

"

\/\/:configuration = ReleaseForProfiling CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] = \/\/:configuration = ReleaseForProfiling CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] =

\/\/:configuration = Release CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] = \/\/:configuration = Release CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] =

\/\/:configuration = Debug CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] = \/\/:配置 = 调试 CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] =

\/\/:configuration = ReleaseForRunning CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] = \/\/:configuration = ReleaseForRunning CODE_SIGN_IDENTITY = CODE_SIGN_IDENTITY[sdk=iphoneos*] = DEVELOPMENT_TEAM = PROVISIONING_PROFILE_SPECIFIER[sdk=iphonesimulator*] = PROVISIONING_PROFILE[sdk=iphonesimulator*] =

\/\/:completeSettings = some CODE_SIGN_ENTITLEMENTS CODE_SIGN_IDENTITY CODE_SIGN_STYLE DEVELOPMENT_TEAM OTHER_CODE_SIGN_FLAGS PROVISIONING_PROFILE_SPECIFIER PROVISIONING_PROFILE \/\/:completeSettings = some CODE_SIGN_ENTITLEMENTS CODE_SIGN_IDENTITY CODE_SIGN_STYLE DEVELOPMENT_TEAM OTHER_CODE_SIGN_FLAGS PROVISIONING_PROFILE_SPECIFIER PROVISIONING_PROFILE

"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在为iOS模拟器构建时,使Xcode忽略静态库 - Making Xcode ignore static library when building for iOS Simulator 在Xcode中构建iOS模拟器时,如何激活死代码剥离? - How do I activate Dead Code Stripping when building for the iOS Simulator in Xcode? 如何忽略iOS模拟器的一些静态库 - How to ignore some static library for iOS simulator 构建iOS模拟器目标时忽略.metal文件 - Ignore .metal files when building for iOS Simulator target 如何在Xcode 4.5上安装iOS 4.3模拟器? - How do I install the iOS 4.3 Simulator on Xcode 4.5? 如何从 Xcode 中删除多余的 iOS 模拟器条目? - How do I remove redundant iOS simulator entries from Xcode? Xcode:体系结构i386的未定义符号:为iOS模拟器构建Unity项目时,DebugStringToFile - Xcode: Undefined symbols for architecture i386: DebugStringToFile when building Unity Project for iOS Simulator 我可以向 Xcode iOS Simulator 添加音乐库吗? - Can I add a music library to the Xcode iOS Simulator? 在 XCode 之外启动模拟器时,有没有办法强制 iOS 模拟器以横向模式启动? - Is there a way to force the iOS Simulator to start in landscape mode, when launching the simulator outside of XCode? xcode iOS模拟器提示我“打开时选择包含iOS模拟器SDK的文件夹”。 我如何找到它? - The xcode iOS Simulator is prompting me to “choose the folder containing the iOS Simulator SDK” on open. How do I find it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM