Closed 7er0 closed 5 years ago
I found a few problems with this issue:
Your project is misconfigured.
The compilation failure you're seeing here is that your project is finding leveldb's block.h
when CoreFoundation's CFBase.h
is actually trying to include the system's Block.h
. leveldb is C++ and it includes <string>
, a C++ system header that's not available when compiling Objective-C (or Swift using a bridging header).
Somehow 'Pods/leveldb-library/table' has gotten in your system header search path. Check your header search paths, use header maps, and related settings.
A few other things may be contributing: what version of CocoaPods are you using? What's your Podfile look like?
If you can do so, please share your project file.
I am using the current version 1.6.0, I also tried it on several previous versions (1.5.0, etc.).
I manually added the frameworks I needed, now the problem disappears. However, obviously, I still like to use Firebase with CocoaPods.
My Podfile looked like this:
# Uncomment the next line to define a global platform for your project
# platform :ios, ’9.0’
target '0' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
use_frameworks!
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/DynamicLinks’
pod 'Firebase/Database'
pod 'Firebase/Storage’
pod 'Firebase/Invites'
pod 'FirebaseMessaging'
pod 'FirebaseInstanceID'
pod 'FBSDKLoginKit'
pod 'Stripe'
pod 'AFNetworking', '~> 3.0'
pod 'Alamofire'
pod 'ActionSheetPicker-3.0'
pod 'ChameleonFramework'
pod 'CCTextFieldEffects'
pod 'DZNEmptyDataSet'
pod 'MZFormSheetPresentationController'
pod 'HMSegmentedControl'
pod 'HCSStarRatingView', '~> 1.5'
pod 'libPhoneNumber-iOS', '~> 0.8'
pod 'BEMCheckBox'
pod 'SZTextView'
pod 'MBProgressHUD', '~> 1.0.0'
pod "QBImagePickerController"
pod 'FSCalendar'
pod 'RSKImageCropper'
pod 'TTTAttributedLabel'
pod 'CountryPickerView'
# Pods for 0
target '0Tests' do
inherit! :search_paths
# Pods for testing
end
target '0UITests' do
inherit! :search_paths
# Pods for testing
end
end
@7er0 can you share your project? There's most likely some bad config in your xcodeproj file that's difficult to pinpoint without looking at the project.
What you're trying to do should work in a new project without issues.
I think this is an issue with misconfiguration of HEADER_SEARCH_PATHS or related settings by CocoaPods. Removing $(SRCROOT)/Pods/
from TARGETS -> Build Settings -> Header Search Paths
will fix this issue.
@7er0 let us know if this is still an issue.
@morganchen12 I have the same issue:
While building module 'UIKit' imported from /Users/vasily/Documents/projects/ios/iosdp24/drumpads24/Drumpads-Prefix.pch:12: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8: While building module 'CoreFoundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6: In file included from <module-includes>:1: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h:43: In file included from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:72: In file included from Pods/leveldb-library/table/Block.h:10: In file included from Pods/leveldb-library/include/leveldb/iterator.h:18: Pods/leveldb-library/include/leveldb/slice.h:21:10: fatal error: 'string' file not found
#include <string> ^~~~~~~~ 1 error generated. While building module 'UIKit' imported from /Users/vasily/Documents/projects/ios/iosdp24/drumpads24/Drumpads-Prefix.pch:12: While building module 'Foundation' imported from /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:8: In file included from <module-includes>:1: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: fatal error: could not build module 'CoreFoundation'
I don't have $(SRCROOT)/Pods/
in my TARGETS -> Build Settings -> Header Search Paths
Error happens when I add pod 'Firebase/Database' in my podfile
In your example, Pods/leveldb-library/include/leveldb
is on your header search path when compiling Objective-C and CoreFoundation includes a system Block.h
but it's finding the leveldb C++ block.h
instead. Your project is misconfigured we just don't have concrete advice on what to change to fix it.
Please share a complete project (including xcode project files and your Pods
tree) from after you run pod install
and it should be possible to figure this out. I don't need your actual code though it wouldn't hurt.
If you're not comfortable sharing here, feel free to email me a zip file at mcg@firebase.com.
Hi @wilhuff ! Thank you for your reply. I create a test project that reproduces this error. Link: https://github.com/bacc3/firebaseTestApp
When I try to build this project, I get the error:
Pods / leveldb-library / include / leveldb / slice.h: 21: 10: fatal error: 'string' file not found
If you have any ideas or ways to solve this problem, please let me know.
Your project includes the following in firebaseTestApp.xcodeproj/project.pbxproj
:
HEADER_SEARCH_PATHS = (
"$(inherited)",
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
"$PROJECT_DIR/**",
);
The problem is "$PROJECT_DIR/**"
, which is picking up all sources recursively from the root of the project including all files in the Pods
directory. Removing this entry allows the build to succeed (at least in this test--YMMV once you add your sources back in the mix).
The problematic setting appears in your Build Settings UI for the firebaseTestApp project as $PROJECT_DIR
with recursive
. Remove this.
Accessing Pods headers this way shouldn't be necessary and is likely harmful: you should be getting access to the headers for the frameworks you depend upon via the frameworks themselves. Doing so via HEADER_SEARCH_PATHS creates the possibility of importing a file via multiple names which can defeat #import
's uniqueness checking.
Also note that modifying HEADER_SEARCH_PATHS
modifies both the system- and user-search paths. This is unlikely to be what you want. It's rarely useful to have your local project files substitute for system headers. If you must modify the search path, consider changing USER_HEADER_SEARCH_PATHS
which will only affect headers included via quotes.
Also, if you really want your project's local headers to be accessible this way, take only the ones from firebaseTestApp
(i.e. "$PROJECT_DIR/firebaseTestApp/**"
).
Yes, it fixed my problem.
Thanks for the help and practical advice, I really appreciate it.
I am having problems with updating my Firebase Pods
For months now I can't update my Firebase, because all the new versions give me 2 errors:
Swift Compiler Error
Already tried:
Where is the problem? With the swift bridging header (but why does it work then when I revert back to 4.0.2? Firebase version?
The same issue was posted here (link below), but the solutions suggested did not work for me. github.com/google/leveldb/issues/515
Related Message in Xcode (10.1)