Xcode 9.3 Beta安装Tesseract OCR Pods遇CLANG_CXX_LIBRARY配置问题求助
Hey there, let's work through this frustrating build setting conflict you're hitting with Tesseract OCR and Xcode 9.3 Beta. I've run into similar beta-specific quirks before, so here's how to tackle it:
First, Locating the CLANG_CXX_LIBRARY Setting
You mentioned searching for CLANG_CXX_LIB and not finding the right spot—let's adjust that search:
- Open your project in Xcode, select your main target, and switch to the Build Settings tab.
- Make sure you've selected All (not Basic) and Levels (not Combined) at the top of the tab—this reveals all nested build settings, including those inherited from Pods.
- Search for the full flag name:
CLANG_CXX_LIBRARY(not the abbreviated version). You should see it listed under the Apple Clang - Language - C++ section, labeled "C++ Standard Library".
If you can't edit the field directly, right-click the setting row and choose Edit Build Setting—sometimes beta versions hide the edit option behind a right-click menu.
Resolving the Override Conflict
Option 1: Force Inheritance Directly in Build Settings
- For your main target's
CLANG_CXX_LIBRARYsetting, replace the current value (compiler-default) with$(inherited). This tells Xcode to pull the setting from the Pods' configuration instead of overriding it. - If you want to keep
compiler-defaultas a fallback, you can set it to$(inherited) compiler-default, but usually just$(inherited)is enough to resolve the conflict.
Option 2: Use a Podfile Post-Install Hook
If the Build Settings UI is being uncooperative (thanks, beta!), you can force the inheritance via your Podfile:
Add this snippet at the end of your Podfile:
post_install do |installer| installer.pods_project.targets.each do |target| target.build_configurations.each do |config| # Ensure the C++ library setting inherits from Pods config.build_settings['CLANG_CXX_LIBRARY'] = '$(inherited)' end end end
Then run pod install again—this will automatically set the correct inheritance for all Pod targets and your main target.
Option 3: Beta-Specific Cleanup
Xcode betas often leave cached data that causes weird issues:
- Clean your build folder with
Cmd + Shift + K - Delete derived data (go to
Xcode > Preferences > Locations > Derived Dataand click the arrow to open the folder, then delete everything inside) - Close Xcode, delete your
Podfile.lock, and re-runpod installfrom scratch
Why This Happens Only in Xcode 9.3 Beta
This is almost certainly a compatibility quirk between the beta version of Xcode and the Tesseract Pod's build configuration. Apple often tweaks build setting inheritance logic in betas, which can break existing Pod setups that work fine in stable releases. Once the final version of Xcode 9.3 drops, this issue will likely disappear on its own.
内容的提问来源于stack exchange,提问作者Teja Nandamuri

