react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Mac Catalyst builds are broken for x86_64 arch

Open birdofpreyru opened this issue 10 months ago • 14 comments

Description

Image

Steps to reproduce

Just try to build a project for mac Catalyst.

React Native Version

0.78.1

Affected Platforms

Build - MacOS

Output of npx @react-native-community/cli info

N/A

Stacktrace or Logs

N/A

Reproducer

N/A

Screenshots and Videos

No response

birdofpreyru avatar Mar 30 '25 19:03 birdofpreyru

[!WARNING] Missing reproducer: We could not detect a reproducible example in your issue report. Please provide either:

react-native-bot avatar Mar 30 '25 19:03 react-native-bot

@birdofpreyru thanks for the issue, but I can't reproduce it, as you can see below.

Image

Can you try by creating a new app with:

npx @react-native-community/cli init NewApp --version latest

and report back? Have you tried cleaning the pods and node_modules?

cipolleschi avatar Mar 31 '25 08:03 cipolleschi

Sorry @cipolleschi , my bad, indeed it works with a clean project. Does not work in my project even after cleaning all artifacts from previous builds... but, I guess, it is on me then, to figure out what has got screwed in my case.

birdofpreyru avatar Apr 01 '25 10:04 birdofpreyru

@cipolleschi actually, it happens in the clean project as well, when building for x86_64 architecture (i.e. created a new app, set Mac Catalyst as the destination, selected Any Mac (Mac Catalyst, arm64, x86_64) build, and built the project). The arm64 part of the build works just fine.

birdofpreyru avatar Apr 01 '25 13:04 birdofpreyru

We have the same issue as @birdofpreyru. New project init using @react-native-community/cli fails to build for Mac. We get the following error message. TransformError [SyntaxError]: <redacted>/node_modules/react-native/Libraries/Components/Pressable/Pressable.js: Unexpected token, expected ","

duralabs avatar Apr 03 '25 13:04 duralabs

@birdofpreyru is it because you are on an intel machine? I don't have that option on my machine. I don't know how to debug it. I'll have to ask you to provide more info on where the compiler fails. We are probably missing a @() wrapping around some variable. It should fail to build also on arm64, tbh.

@duralabs your is a different problem You r app built natively but then it fails when you try to load the bundle. Please clean node modules and reinstall the js dependencies and try again. Also, please search in the issue tracker as we already discussed and solved the problem in other issues.

cipolleschi avatar Apr 03 '25 19:04 cipolleschi

@cipolleschi no, that's on M3 Pro MacBook, with the latest macOS 15.4 and Xcode 16.3. Though, I believe I started to experience this problem a month or two ago, with a previous version of RN, OS, Xcode, just did not reported it immediately.

birdofpreyru avatar Apr 03 '25 19:04 birdofpreyru

Here is a little screen recording, to also show you that it does something weird — when I click the build error, it is first highlighted as the error in the code, but shortly after the highlight disappears, as if Xcode changes opinion and thinks the code is just fine.

https://github.com/user-attachments/assets/eac6bbff-267f-426e-bc77-60c8fa920371

birdofpreyru avatar Apr 03 '25 19:04 birdofpreyru

@birdofpreyru is it because you are on an intel machine? I don't have that option on my machine. I don't know how to debug it. I'll have to ask you to provide more info on where the compiler fails. We are probably missing a @() wrapping around some variable. It should fail to build also on arm64, tbh.

@duralabs your is a different problem You r app built natively but then it fails when you try to load the bundle. Please clean node modules and reinstall the js dependencies and try again. Also, please search in the issue tracker as we already discussed and solved the problem in other issues.

We've removed and rebuilt js dependencies a number of times and the issues persist. We searched the issues list for Mac Catalyst build errors and nothing we found matches our issue. Can you link one of the previously opened issues that you are referring to?

duralabs avatar Apr 03 '25 21:04 duralabs

@duralabs please open another issue. the problem is different. Your build is not failing on mac catalyst.

@birdofpreyru can you try to replace line 527 like this:

                 originalMessage:errorData[@"originalMessage"]
                            name:errorData[@"name"]
                  componentStack:errorData[@"componentStack"]
                     exceptionId:error.id
-                         isFatal:errorData[@"isFatal"]
+ 						  isFatal: @(error.isFatal);
                       extraData:errorData[@"extraData"]]) {

and try again?

we set the errorData[@"isFatal"] property some lines above. It could be that the compiler for other archs struggles from outo-boxing the id to BOOL.

cipolleschi avatar Apr 04 '25 09:04 cipolleschi

@cipolleschi nope, but this replacement turns out to work for me:

                 originalMessage:errorData[@"originalMessage"]
                            name:errorData[@"name"]
                  componentStack:errorData[@"componentStack"]
                     exceptionId:error.id
-                         isFatal:errorData[@"isFatal"]
+ 			 isFatal:error.isFatal
                       extraData:errorData[@"extraData"]]) {

birdofpreyru avatar Apr 04 '25 15:04 birdofpreyru

this one as well works:

                 originalMessage:errorData[@"originalMessage"]
                            name:errorData[@"name"]
                  componentStack:errorData[@"componentStack"]
                     exceptionId:error.id
-                         isFatal:errorData[@"isFatal"]
+ 			isFatal:[errorData[@"isFatal"] boolValue]
                       extraData:errorData[@"extraData"]]) {

birdofpreyru avatar Apr 04 '25 15:04 birdofpreyru

Cool, we can go with the latest! https://github.com/facebook/react-native/pull/50514

cipolleschi avatar Apr 07 '25 10:04 cipolleschi

Works for me too, thanks

this one as well works:

             originalMessage:errorData[@"originalMessage"]
                        name:errorData[@"name"]
              componentStack:errorData[@"componentStack"]
                 exceptionId:error.id
  •                     isFatal:errorData[@"isFatal"]
    
  • 		isFatal:[errorData[@"isFatal"] boolValue]
                     extraData:errorData[@"extraData"]]) {
    

kesha-antonov avatar May 22 '25 14:05 kesha-antonov

I think we can close this as the crash is fixed

cipolleschi avatar Jun 09 '25 09:06 cipolleschi