Skip to content
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

react-native run-ios build failure on XCode 12.5 beta #1365

Closed
bsk26 opened this issue Feb 9, 2021 · 30 comments
Closed

react-native run-ios build failure on XCode 12.5 beta #1365

bsk26 opened this issue Feb 9, 2021 · 30 comments
Labels
question Further information is requested stale

Comments

@bsk26
Copy link

bsk26 commented Feb 9, 2021

Ask your Question

I'm getting a build error while attempting to test our react-native app in XCode 12.5 beta. Apologies if this is inappropriate but it appears to be a real issue.

I'm running "react-native": "0.62.2" (however, it doesn't appear this is fixed in the lastest stable release)

It looks like this exact issue was fixed in facebook/react-native#28362, which is part of 0.63+. This PR indicates it was fixed for Clang 10 but as far as I can tell the clang/llvm version hasn't changed between 12.4 and 12.5. The app builds correctly when using 12.4 command line tools but not 12.5 beta command line tools (configured via XCode preferences).

The build error (with compiler):

** BUILD FAILED **

The following build commands failed:
        CompileC .../Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Core.build/Objects-normal/x86_64/RCTCxxBridge.o /Users/bkraft/Projects/zabo-mobile/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm normal x86_64 objective-c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

The stack trace is as follows,

/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:331:34: error: cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an rvalue of type 'NSArray<Class> *'
  (void)[self _initializeModules:RCTGetModuleClasses() withDispatchGroup:prepareBridge lazilyDiscovered:NO];
                                 ^~~~~~~~~~~~~~~~~~~~~
/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:771:82: note: passing argument to parameter 'modules' here
- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
                                                                                 ^
/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:776:79: error: cannot initialize a parameter of type 'NSArray<Class> *' with an lvalue of type 'NSArray<id<RCTBridgeModule>> *__strong'
  NSArray<RCTModuleData *> *moduleDataById = [self _registerModulesForClasses:modules lazilyDiscovered:lazilyDiscovered];
                                                                              ^~~~~~~
/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:618:76: note: passing argument to parameter 'moduleClasses' here
- (NSArray<RCTModuleData *> *)_registerModulesForClasses:(NSArray<Class> *)moduleClasses
                                                                           ^
/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:827:69: error: cannot initialize a parameter of type 'NSArray<id<RCTBridgeModule>> *' with an lvalue of type 'NSArray<Class> *__strong'
    NSArray<RCTModuleData *> *newModules = [self _initializeModules:modules withDispatchGroup:NULL lazilyDiscovered:YES];
                                                                    ^~~~~~~
/Users/bkraft/Projects/zabo-mobile/node_modules/react-native/React/CxxBridge/RCTCxxBridge.mm:771:82: note: passing argument to parameter 'modules' here
- (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id<RCTBridgeModule>> *)modules
@bsk26 bsk26 added the question Further information is requested label Feb 9, 2021
@uijunii
Copy link

uijunii commented Feb 25, 2021

Try this

  1. Edit Podfile in ios directory like this ↓
    ===========================
    use_flipper!

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

  1. npm install in project folder
  2. pod install in ios folder

@afixoftrix
Copy link

@bsk26 , did you ever find a solution to this?

@bsk26
Copy link
Author

bsk26 commented Mar 8, 2021

@bsk26 , did you ever find a solution to this?

I ended up removing flipper since we were hardly using it.

@best777
Copy link

best777 commented Apr 9, 2021

@bsk26 ,did you have other way ? I remove flipper , but not working.

@Atoyebs
Copy link

Atoyebs commented Apr 9, 2021

Hi all, is there any solution to this? I'm experiencing the exact same problem

@bsk26
Copy link
Author

bsk26 commented Apr 12, 2021

@Atoyebs @best777 We weren't actively using Flipper so our solution was to remove it from the app. I'm not sure if the issue has been fixed however the other underlying issues we were facing were resolved in the later versions of ios 14.5 beta.

@gcrozariol
Copy link

gcrozariol commented Apr 16, 2021

This might be the weirdest thing ever, but it worked for me.

I figured out that creating a project within a folder that contains a space i.e. ~/Documents/My Projects was the problem. When creating a project in a directory that has no spaces i.e. ~/Documents/Projects, you can run the project on both iOS and Android with no errors at all.

@joelvarty
Copy link

Seeing the same issue on 14.5... any ideas on how to fix this?

@nelsonchen5
Copy link

+1

2 similar comments
@Dassine
Copy link

Dassine commented Apr 28, 2021

+1

@smooney211993
Copy link

+1

@YanouHD
Copy link

YanouHD commented Apr 28, 2021

Hello,

This is now an issue with Xcode 12.5 final, released today... Can't build my app anymore, any workaround ?

@honia19
Copy link

honia19 commented Apr 28, 2021

+1 XCode Final version 12.5 react-native 0.61.5

@aparedes
Copy link
Contributor

This is a Flipper-Folly issue.
Commenting useFlipper out from Podfile should work.

facebook/folly#1527
facebook/flipper#2215

another workaround facebook/flipper#2215 (comment)

@joelvarty
Copy link

Since my project has other packages like Firebase that rely on Flipper (I believe) removing it did not work. The workaround I'm using for now is to use XCode 12.4.

@daffigusti
Copy link

Got this issues after upgrade XCode to 12.5. Any workaround for this issue?

@teajohnson90
Copy link

same here, react native no longer working after updating to XCode 12.5

@waqasrasheed86
Copy link

build failure on XCode 12.5 , any workaround
Cannot initialize a parameter of type 'NSArray<id> *' with an rvalue of type 'NSArray

@3DJakob
Copy link

3DJakob commented Apr 28, 2021

Same issue on XCode 12.5 really frustrating. facebook/flipper#2215 (comment) worked as a workaround for me.

@AilsonFreire
Copy link

I'm facing the same problem, but my RN version is .62 so its not related with flipper

@pjivers-bom
Copy link

I've got the same issue with XCode 12.5 and RN 0.61.5

@WebTarantul
Copy link

Seeing the same issue on 14.5... any ideas on how to fix this?

https://stackoverflow.com/questions/67290697/react-native-0-64-wont-build-ios-app-after-updating-xcode-to-12-5-and-ios-to-14

@rodrigofeijao
Copy link

Try to upgrade to 0.64.1: https://github.com/facebook/react-native/releases/v0.64.1
Worked fine for me.

@lfoliveir4
Copy link

Try to upgrade to 0.64.1: https://github.com/facebook/react-native/releases/v0.64.1
Worked fine for me.

Solved to me!

@rpc1910
Copy link

rpc1910 commented May 5, 2021

to other versions -> facebook/react-native#31480

@habovh
Copy link

habovh commented May 6, 2021

@gcrozariol said

This might be the weirdest thing ever, but it worked for me.

I figured out that creating a project within a folder that contains a space i.e. ~/Documents/My Projects was the problem. When creating a project in a directory that has no spaces i.e. ~/Documents/Projects, you can run the project on both iOS and Android with no errors at all.

This might not be the weirdest thing at all. As it turns out, I had a space in my project path at some point.

Let's consider this folder for my project:

  • ~/Repositories/SOME COMPANY/react-native-app/

After trying to get the app to compile a dozen a few times, I noticed a couple new folders had appeared and they did not make any sense whatsoever:

  • ~/Repositories/SOME/
  • ~/Repositories/SOME COMPANY/react-native-app/react-native/React/FBReactNativeSpec/COMPANY

So I indeed renamed my SOME COMPANY folder to SOMECOMPANY and it seemed to help. It only seemed because I did so much things at the same time it's difficult to pinpoint exactly what did the trick.

My Xcode update happened to while I was also updating React Native. Maybe it is relevant, maybe not, but another thing I did is actually pay attention to the changes in the project.pbxproj on the upgrade helper tool. It is collapsed by default because most of the changes it contains are applied automatically when running pod install. However, most is not all, and sometimes it needs manual intervention (either via the Xcode UI or in plain text).

As it turns out, some LD_RUNPATH_SEARCH_PATHS changed from a single string to an array of strings using double quotes. Since these path are supposed to expand to the project's location, my guess is that it could (I cannot emphasise more, I'm not sure if this change actually fixes the space in the path issue) resolve your nasty libraries errors.

Hope this can help someone!

@Ericgou3
Copy link

Ericgou3 commented May 14, 2021

Modify the func at line 746 in RCTCxxBridge.mm from

  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id< RCTBridgeModule > > *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    to
  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    It works for me!

@lyrpromax
Copy link

修改 RCTCxxBridge.mm 中第 746 行的 func 来自

  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id< RCTBridgeModule > > *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    to
  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    它对我有用!

perfect!

@jerrychoux
Copy link

Modify the func at line 746 in RCTCxxBridge.mm from

  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray<id< RCTBridgeModule > > *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    to
  • (NSArray<RCTModuleData *> *)_initializeModules:(NSArray *)modules
    withDispatchGroup:(dispatch_group_t)dispatchGroup
    lazilyDiscovered:(BOOL)lazilyDiscovered
    It works for me!

可以解决,谢谢

@github-actions
Copy link

There hasn't been any activity on this issue in the past 3 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested stale
Projects
None yet
Development

No branches or pull requests