-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix ios build error when use_frameworks is on and fabric is off (v2) #33409
Conversation
Base commit: 009d80b |
Base commit: 009d80b |
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
@mikehardy could you help to verify this solution for your cases when you get a chance? |
It's all green interally so we should be good to go 👍 |
Fantastic! Verifying now @Kudo |
It appears to work, applying this patch https://gist.githubusercontent.com/Kudo/7a590cbd6f8ca33fdf9f706ac96049ea/raw/00ff89b8c56b30f0db90bf1c74d4cdbe7c9f1612/react-native+0.68.0-rc.2.patch during my normal test of static frameworks build on iOS resulted in successful compilation + execution of the app Nice! |
@@ -37,7 +36,7 @@ NS_ASSUME_NONNULL_BEGIN | |||
- (void)reportFatalException:(nullable NSString *)message | |||
stack:(nullable NSArray<NSDictionary *> *)stack | |||
exceptionId:(double)exceptionId; | |||
- (void)reportEarlyJsException:(std::string)errorMap; | |||
- (void)reportEarlyJsException:(nullable NSString *)errorMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Kudo please revert this change. It is not related to the original issue, and it breaks our internal tests.
Other than that, this solution looks good!
- (void)reportEarlyJsException:(NSString *)errorMap | ||
{ | ||
NSString *errprStr = [NSString stringWithUTF8String:errorMap.c_str()]; | ||
NSString *errprStr = errorMap; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would these also need revert @dmitryrykun ? just scanning this after seeing your comment and they seem similar
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I meant all the changes in RCTExceptionsManager.
…t be exported" This reverts commit 7a0398c.
reverted the commit. thanks @dmitryrykun for review and @mikehardy for kindly help to verify the fix 💛 |
@cortinico has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Thank you all for the great work addressing this issue 🙏 |
This pull request was successfully merged by @Kudo in a6c2846. When will my fix make it into a release? | Upcoming Releases |
…33409) Summary: alternative solution for #33379 > when `use_frameworks!` is on, there are errors like: > ``` > 'FBReactNativeSpec/FBReactNativeSpec.h' file not found > #import <FBReactNativeSpec/FBReactNativeSpec.h> > ``` > this error may come from from f7e4c07c84b6 regression. > > when `use_frameworks!` is on, xcode will search headers from framework directories, the correct imports would be `#import <React_Codegen/FBReactNativeSpec/FBReactNativeSpec.h>` (xcode will transform dash to underscore, so it is `React_Codegen` but not `React-Codegen`). in the other hand, when `use_frameworks!` is off, the correct import is `#import <React-Codegen/FBReactNativeSpec/FBReactNativeSpec.h>`. > > > this fix is specific for old architecture (fabric is off). > > when fabric is on, there are other errors from duplicated headers when copying to build folder. [the reason is that framework build would try to flatten headers](https://mkonrad.net/2015/03/29/xcode-static-libraries-preserving-header-directory-structure.html). we have `primitives.h` in different folders and they would be flattened into `React_Fabric.framework/Headers`. to be honest, i don't know how to deal with the problem in the meantime, maybe subspecs are not enough, we should separate them from subspecs to dedicated podspecs so that we can have these targets as different frameworks. in this alternative fix, i try to add `React-Codegen/React_Codegen.framework/Headers` into header search paths and make original `#import <FBReactNativeSpec/FBReactNativeSpec.h>` reachable. [this change](7a0398c) in the pr is just a workaround to solve breaking in latest main branch and this is not important to the `use_frameworks!` fix at all. this breaking was coming from 1804951. [iOS] [Fixed] - Fix iOS build error when Podfile `use_frameworks!` is on and Fabric is off Pull Request resolved: #33409 Test Plan: verify with rn-tester 1. change `fabric_enabled` to false in `packages/rn-tester/Podfile` 2. `USE_FRAMEWORKS=1 pod install` 3. build rn-tester in xcode Reviewed By: dmitryrykun Differential Revision: D34817041 Pulled By: cortinico fbshipit-source-id: 4d1a610e99a807793eb3f64461e0d735c0a9ca9c
…acebook#33409) Summary: alternative solution for facebook#33379 > when `use_frameworks!` is on, there are errors like: > ``` > 'FBReactNativeSpec/FBReactNativeSpec.h' file not found > #import <FBReactNativeSpec/FBReactNativeSpec.h> > ``` > this error may come from from facebook@f7e4c07c84b6 regression. > > when `use_frameworks!` is on, xcode will search headers from framework directories, the correct imports would be `#import <React_Codegen/FBReactNativeSpec/FBReactNativeSpec.h>` (xcode will transform dash to underscore, so it is `React_Codegen` but not `React-Codegen`). in the other hand, when `use_frameworks!` is off, the correct import is `#import <React-Codegen/FBReactNativeSpec/FBReactNativeSpec.h>`. > > > this fix is specific for old architecture (fabric is off). > > when fabric is on, there are other errors from duplicated headers when copying to build folder. [the reason is that framework build would try to flatten headers](https://mkonrad.net/2015/03/29/xcode-static-libraries-preserving-header-directory-structure.html). we have `primitives.h` in different folders and they would be flattened into `React_Fabric.framework/Headers`. to be honest, i don't know how to deal with the problem in the meantime, maybe subspecs are not enough, we should separate them from subspecs to dedicated podspecs so that we can have these targets as different frameworks. in this alternative fix, i try to add `React-Codegen/React_Codegen.framework/Headers` into header search paths and make original `#import <FBReactNativeSpec/FBReactNativeSpec.h>` reachable. [this change](facebook@7a0398c) in the pr is just a workaround to solve breaking in latest main branch and this is not important to the `use_frameworks!` fix at all. this breaking was coming from facebook@1804951. ## Changelog [iOS] [Fixed] - Fix iOS build error when Podfile `use_frameworks!` is on and Fabric is off Pull Request resolved: facebook#33409 Test Plan: verify with rn-tester 1. change `fabric_enabled` to false in `packages/rn-tester/Podfile` 2. `USE_FRAMEWORKS=1 pod install` 3. build rn-tester in xcode Reviewed By: dmitryrykun Differential Revision: D34817041 Pulled By: cortinico fbshipit-source-id: 4d1a610e99a807793eb3f64461e0d735c0a9ca9c
Summary
alternative solution for #33379
in this alternative fix, i try to add
React-Codegen/React_Codegen.framework/Headers
into header search paths and make original#import <FBReactNativeSpec/FBReactNativeSpec.h>
reachable.this change in the pr is just a workaround to solve breaking in latest main branch and this is not important to the
use_frameworks!
fix at all. this breaking was coming from 1804951.Changelog
[iOS] [Fixed] - Fix iOS build error when Podfile
use_frameworks!
is on and Fabric is offTest Plan
verify with rn-tester
fabric_enabled
to false inpackages/rn-tester/Podfile
USE_FRAMEWORKS=1 pod install