Dusted off an iPhone project that hasn't had changes in the past three months. When trying to run the iPhone8 simulator, the build fails with:
<unknown>:0: error: missing required module 'CgRPC'
CgRPC is a dependency of the library I'm using. When the project attempts to build, I see it building CgRPC, so am not quite sure what the problem is.
I've tried, for grins, adding explicit CgRPC as an explicit dependency, but that didn't resolve anything.
Any tips from the XCode experts out there?
I'm not sure what changed, but adding the CgRPC headers to the compiler search path resolved the issue.
Related
I have a react-native app with bridged Swift code that is building, running, and archiving without issue with Xcode 10.0 with the default Release and Debug build configurations. I use Xcode -> Product -> Archive or the "Play" button and everything works as expected. Great!
Then today I added a new build configuration that is an exact duplicate of Release. It is named Release copy. I did the same for Debug as well, and its duplicate is Debug copy.
If I try to run the same Archive or Run tasks using the copies, the tasks fail at Precompile bridging header.
/Users/whaley/dev/app/theApp/theApp-Bridging-Header.h:5:9: error: 'React/RCTBridgeModule.h' file not found
#import <React/RCTBridgeModule.h>
^
1 error generated.
<unknown>:0: error: failed to emit precompiled header '/Users/whaley/Library/Developer/Xcode/DerivedData/theApp-ckvpglaqydwzhadbbyqoprcjvnod/Build/Intermediates.noindex/ArchiveIntermediates/theApp/PrecompiledHeaders/theApp-Bridging-Header-swift_320079J7441HX-clang_QK5YQQC41WXA.pch' for bridging header '/Users/whaley/dev/theApp/ios/theApp-Bridging-Header.h'
Odd, in my opinion, since this should be an exact copy of a build configuration that was working fine.
If I switch back to the original Build Configurations everything is fine. The originals consistently work and the copies consistently fail.
I tried disabling the Precompile bridging header task, but just encountered a different, and similar error. Again, the original build configs worked where the copies failed.
I'm already using Find implicit dependencies, the bridging header is named properly, I'm not using Cocoapods, I've rebooted and cleared Xcode's Derived Data, and please bear in mind that it does work fine normally. It's only these duplicate build configurations that fail.
Why might this be happening? Am I missing a step here? Is this perhaps a limitation of react-native and it only supports the default build configs?
Naturally, the moment I posted my question I managed to find the answer I needed via Google
Thanks to Mateusz Klimczak for clearly illustrating the problem and resolution on their website.
Add an entry to Headers Search Paths for each new Release build configuration:
$(BUILD_DIR)/Release-$(PLATFORM_NAME)/include
Add an entry to Library Search Paths for each new Release build configuration:
$(BUILD_DIR)/Release$(EFFECTIVE_PLATFORM_NAME)
One might wonder why this is needed when we only change build configuration name and it was already working for Release. React Native supports Debug and Release build configurations out of the box, while any other configuration needs to be set up manually.
Sure enough, that fixed it. The answer is that only Release and Debug are supported out of the box, so that additional config is required for non-standard Build Configurations.
I upgraded my project to Swift 2 in Xcode 7 beta (7A120f) and get this error when trying to po self at the lldb prompt:
warning: Swift error in module myApp:
Swift had fatal errors constructing the ast context for this module: cannot load underlying module for 'UIKit'
Debug info from this module will be unavailable in the debugger.
I'm then left with a crippled debugger (no values). This happens regardless of where I place a breakpoint. I've tried:
clearing derived data
Product > Clean
restarting xcode
restarting mac
I'm able to create a new project and see debug output in it, so this probably has something to do with how my project was migrated by xcode.
What is the ast context and how can I correct it?
Edit: ast is 'Abstract Syntax Tree'. Still no idea how to fix it though.
I'm having the same issue in my project. The error that lldb spits out when attempting to po an object highlights the issue:
(lldb)po fileURL
warning: Swift error in module <APP_NAME>:
Swift had fatal errors constructing the ast context for this module: <module-includes>:1:9: note: in file included from <module-includes>:1:
#import "Headers/Crashlytics.h"
^
<APP_PATH>/Pods/Crashlytics/Crashlytics.framework/Headers/Crashlytics.h:10:9: error: include of non-modular header inside framework module 'Crashlytics'
#import <Fabric/FABAttributes.h>
^
The Crashlytics.h umbrella header in Crashlytics.framework is importing Fabric/FABAttributes.h, which is not part of the Crashlytics module (i.e. not in its module.modulemap). This is Crashlytics 3.1.0 installed using CocoaPods.
Why Xcode 7 treats this as a fatal error is beyond me (it was just a warning in 6). In Xcode 6 you could work around this sort of "non-modular header include" by enabling the "Allow Non-modular includes in Framework Modules" (CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES) build setting in your application target.
I've had no luck getting the Xcode 7 betas to honor the above flag (rdar://22044453 <-- please dup).
The only solution I've found to get the debugger working is to remove the Crashlytics pod. I comment out the Crashlytics and Fabric pods, run pod install, resume debugging and then reinstall the pods before a release.
I really hope this is fixed in Xcode 7 by the time it comes out of beta.
Check your bridging header and if you have
#import Crashlytics;
(or any other frameworks that cause the error. In my case it was GoogleMobileAds)
try replacing with
#import <Crashlytics/Crashlytics.h>
To fix this I manually migrated all my files and settings to a new xcode project. Nothing else worked. There is probably a better fix but I couldn't spend any more time looking for it.
I had the same issue.
In the most cases this issues appears when you use objective-c frameworks or libraries in Swift project.
The issue was fixed by importing objective-c frameworks or libraries in Bridging-Header only.
#import <SampleFramework/SampleFramework.h>
and remove all imports of this framework from Swift files
import SampleFramework // <-- Remove it
Then Clean and Build.
Make sure that you did this procedure for all objective-c frameworks or libraries in your projects.
Hope this helps!
Upon updating to Xcode 6, I can no longer build my app. Xcode is throwing errors and warnings like the following:
Error:
/Applications/Xcode-6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/CoreData.framework/Headers/NSManagedObjectContext.h:121:5:
Pointer to non-const type 'id' with no explicit ownership
Warning:
/Applications/Xcode-6.0.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/Foundation.framework/Headers/NSString.h:206:4:
warning: '__strong' only applies to Objective-C object or block
pointer types; type here is 'const char *' [-Wignored-attributes]
The error is in CoreData.framework, the warning is in Foundation.framework.
Here's a link to my build log: http://pastebin.com/RCgV8Pj1
I've tried deleting and re-adding my frameworks using both drag and drop from the Frameworks directory, and the add button in Project->Build Phases. Neither fixes the error. I also tried deleting the SharedPrecompiledHeaders directory. I also saw this, but his fix doesn't work for me. I have no "Frameworks" directory in my project. I even went as far as re-installing Xcode 6.
I assume this is an error with a build setting someplace, but I don't know what would have changed or what I should update. Initially after using Xcode 6 I couldn't build in Xcode 5 either, but I reverted my xcodeproj and it works fine in the older version.
Make sure you don't have a Frameworks path in your FRAMEWORK_SEARCH_PATHS in project settings or target settings, as it can cause headers to be read from both iPhoneOS.platform and iPhoneSimulator.platform, causing warnings during compilation and errors during linking.
The problem can arise spontaneously if you add/change frameworks in your project and once Xcode's caches have been rebuilt, you also lose the ability to compile backups of your project because the bug is at the Xcode level.
See:
My answer in '__strong' only applies to objective-c object or block pointer types; type here is XXX" warning
This appears to have been fixed by upgrading to OS X 10.10 GM and reinstalling Xcode 6. Not sure which one actually allowed the project to build.
[UPDATE]This didn't permanently fix the issue. It came back after about 5 days.
Has anyone run into this issue? I was experimenting with porting an existing obj-c app to Swift, and after quite a few successful builds the project will no longer build and immediately gives the error: Unable to run command 'CompileSwift normal' - this target might include its own product. Along with many other 'target might include it's own product errors'.
What I've Tried:
Checking Target Dependencies: There is nothing listed as a target dependency in Build Phases.
I've tried completely deleting the product folders, and have went through all the files multiple times but with no luck.
If I simply replace the Swift files with the old obj-c files it builds fine, no errors at all.
Restoring to a snapshot prior to any Swift modifications results in building as normal, but even if I add a brand new Swift boilerplate file and bridging header, then click build, it fails with the same errors.
I had the same issue. I couldn't work out exactly what was causing it, but realised the same code would build find on a different Xcode 6 install on a different machine.
I solved it by deleting my cached builds, etc, in ~/Library/Developer/Xcode, while Xcode is not running. "Clean" alone from within Xcode didn't do it.
You should find that when you re-launch Xcode your app will build fine.
Deleting my app target from "Build Phases -> Copy Bundle Resources" worked for me. (Somehow it was being included for bundling?)
I could reproduce the problem. In the objc-to-swift bridge header I imported a header of an objc class, which also imports swift-to-objc header. There was a cycle of imports and this could be the reason Xcode complaint.
I think for now it is best to avoid such cyclic importing between swift and objc. You might want to check that out.
I'm hitting this error after upgrading to Xcode 4.4.1 + 10.8.2. (Both were done at the same time). This is when validating an archive from an Xcode project for the mac app store.
The full error is :
CFBundleexecutable of two bundles may not point to the same file. The following shared bundle path have been found: MyAppName.app/Contents.
I'm not really sure what this means, the same exact source compiled without errors on 10.7.x Xcode 4.3.x. However I need to compile on 10.8.x & XCode 4.4.x+.
After trying a few things, I was able to fix it. The issue here was the Info.plist file was included in the 'copy bundle resources' build phase. Since this file is already copied by XCode elsewhere, it was causing the conflict. I removed the Info.plist from the 'copy bundle resources' build phase, and that fixed the issue.
Due to the unclear message given by XCode, hopefully this will at least help others a bit more quickly in the future.