-
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
0.73 fails to build on iOS with use_frameworks! :static due to yoga header path issue #41938
Comments
I can't run successfully iOS build even with default Readme.md
❯ npm run ios
info A dev server is already running for this project on port 8081. info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor error Failed to build iOS project. "xcodebuild" exited with error code '65'. To debug build logs further, consider building your app with Xcode.app, by opening 'RnTemplate.xcworkspace'. |
@iron-leo I think that's a totally separate issue. Did you run |
cc @cipolleschi |
Hi @evelant thanks for the report.
and then ⌘+B, it works properly. |
@cipolleschi I think I bumped into the same issue react-native-webview/react-native-webview#3263 when building a project using |
And the project I was building is this one: https://github.com/birdofpreyru/react-native-static-server/tree/master, more specifically its Example App: https://github.com/birdofpreyru/react-native-static-server/tree/master/example |
@cipolleschi This same issue has happened in previous releases. I had a PR for 0.72 that fixed it then. It seems like it just keeps creeping back in due to the way cocoapods handles symlinks when given a relative path in a podfile. See the older PR here #38158 and an explanation of the problem here #38140 (comment) It would be great if pnpm could be added to the automated tests. It should require zero extra setup. Just substitute yarn or npm for pnpm, that's all. |
yeah, i remember. But we had to revert those changes because they were failing on other test cases, now I don't remember the specifics, unfortunately, as some weeks has passed. :( |
I've observed something very similar with lottie-react-native. I made a simple repro: https://github.com/heath-clink/rn73-lottie-repro |
For folks maintaining webview and lottie Fabric native components, does the problem go away if you add |
33ebb5d made changes to Yoga header structure with new architecture. There is a lot of manual finagling of header search paths happening right now. |
I think there are different problems:
|
For webview, there is already a PR pending with the fixes: https://github.com/react-native-webview/react-native-webview/pull/3231/files |
I created the PR for Lottie as well: lottie-react-native/lottie-react-native#1139 |
Monorepo setup are not officially supported, unfortunately. Monorepo setups put those files in different paths w.r.t. the standard setup, and the podspecs layout is not handling that case. |
I'm creating a "SDK", using cocoapods lib create. I'm having this issue: Here is my podfile: `platform :ios, '13.4' source 'https://github.com/jveronezi/sdk-specs.git' use_frameworks! This is my Yoga.podspec.json |
You should not use For React Native, there is much more running under the hoods. The tool you should use to create a library compatible with React Native is Bob that will properly setup the podspec and the whole folder structure for you. It will also create an Example folder with a React Native sample app that you can use to test your library. |
Any way we can get around this? why |
The problem is that
While static libraries doesn't. On top of that, Monorepos usually moves the whole frameworks in a different location and uses symlinks to connect the expected position on disk to the monorepo location. Those links get broken in our current setup. The specific details of what get broken depend on the monorepo that is used, but what I saw happening is that, with use frameworks, not all the symlink are set up correctly and that broke it. |
Same issue here. I see it's mentioned that monorepos aren't officially supported, but also I saw this comment which says symlinks are stable in |
Getting this issue in an Nx monorepo Related: nrwl/nx#20115 |
@slapbox symlink is stable for Metro, but not for the whole framework. My colleague that worked on simlinks for metro is now tackling monorepo scenarios, so, hopeful, we are going to have them working soon. |
@cipolleschi my app fails to be archived for macOS (Catalyst) release with the seemingly similar error: at the same time it builds and works fine if I just build it in release or debug mode to run locally on macOS, and it also works fine for iOS (both local builds & archiving for Apple.Store release). I am a bit lost in this thread, thus maybe you can hint me please, how to fix / temporary workaround it? I am not using expo; I am using npm; and I have P.S.: I mean, I figured out I can just ad-hoc edit path includes in the pod source code, to make the build pass... which I guess works as a workaround, but might there be an easier method? |
I solved my issue by going into the podspec.json and fixing the paths |
Unfortunately the changes mentioned by @cipolleschi on April 3rd (767330f) are already integrated in the version we're using, but the problem persists:
|
@cipolleschi can you offer any advice or insights? Or is there anything else I can do to help get this resolved? We're on |
Can anyone offer any advice on this? Even @cnorman1977's approach which everyone seems to agree worked for |
Ogh… the patch solved the issue for me, and seemingly for everyone else but you; hence it reads like you do something wrong in your code. |
Thanks for your reply @birdofpreyru. Unfortunately we use Expo in a managed workflow so there's not much in terms of what I personally could be doing wrong, but perhaps something upstream from us. Is there anything in your mind that Expo might need to do to resolve this? There's an unresolved issue there with several people struggling with it: expo/expo#25942 |
I never used Expo, and I am very disappointed it is the officially recommended way to use RN since 0.74 🤷♂️ I’m glad to learn it doesn’t work smooth, unlike the barebone RN 😁 |
Not a good look to gloat while someone's facing a problem. |
I tried removing the patch from #42847 and doing so restores the originally reported issue:
But are we sure it really resolves There are quite a few thumbs up on the comment here from long after the patch was theoretically applied, as well as #44340 which was closed as a duplicate - although I'm not sure that it really is. It seems like for some people, the patch just got them one step closer to building, but exposed a new issue which is not addressed? |
Friendly bump. I do not believe this issue has truly been resolved for the reasons stated in the comment immediately prior. Right now we can hang on on |
@Nantris - I am facing the same issue. I am upgrading a managed project from Expo 49 (RN 0.72.x) to Expo 51 (RN 0.74.2). The patch was able to clear some errors related to header path mappings to Yoga from other RN podspecs, and progress the build further. However, I also believe there are additional errors to do with locating the Yoga files during the linking phase of the iOS build. It is not immediately clear to me at the moment what the issue is - but it is clear that the patch seems to fix header path mappings from packages inside the projects node_modules directory. The new error that I am seeing indicates that it is not able to find the Yoga file from the Build/Products directory as you are seeing in your above comment here. VSCode throws this error during linking: While Xcode throws this error for the same build: I will be actively working on this for the next few weeks, and will keep you updated with any new discoveries. |
@Nantris @caustin24345 If you are using Expo, I strongly suggest to open an issue in their repo. Expo performs some configuration changes in the app that they support. |
Thanks @cipolleschi - I'm going to create a minimal reproducible example to find out exactly where this issue is coming from. My understanding is that Expo is now working directly with the RN team for their releases to ensure compatibility between RN versions and Expo SDK's. I will confirm that Expo 51 works out of the box with RN 0.74. I'm using pnpm as my package manager and also understand that it is not fully supported by react-native since it stores its packages in a separate location to alternatives like yarn and npm. I found a patch for Cocoapods which addresses this issue for RN > 0.73 but I'm aware that there could still be additional issues around this. Since other people might run into this issue using any combination of RN with Expo + pnpm, npm, yarn etc - and since the discussion is already started about this issue on this thread, I am inclined to post my findings here (for the next guy). However, I will also be active on Expo's repo for any findings directly related to that. |
@caustin24345 I had thought there was already an issue for this, but I couldn't find it, so perhaps it was only a related issue. Please do share here when you create an issue on the Expo tracker and I'll be sure to join you there. Fwiw we're using Yarn and our error is identical to yours, so I don't think it's |
@caustin24345 thanks for opening the issue on Expo.
Yes, that's true. We control the React Native core part and we ensure that everything works without Expo. Let us know how it goes. |
Thank you for the info @cipolleschi, it is much appreciated. To update you - I created a new Expo 51, RN 0.74 project using pnpm as the dependency manager and was able to build and run the project almost immediately. I slowly transferred packages and build configs across from my existing project to see what was causing the build issue that we have discussed. I was not able to reproduce it after replicating the package.json, and app.json - however, I was able to replicate it after moving to a monorepo structure and using nx to manage dependency caching. My hunch is that there is some confusion from the monorepo project as to which packages to reference when linking iOS frameworks i.e the packages in the node_modules directory at the project level, or the packages in the nx cached node_modules/.pnpm directory at the monorepo root. With that being said, it is clear to me that this is NOT a react native, Expo or pnpm specific build issue and very likely related to caching and project infrastructure. I'm happy to move this conversation elsewhere now that I understand that it is not related to the react native package itself. I am however wondering if you are using similar tools or structure in your application @Nantris? |
@caustin24345 I don't use pnpm anymore but when I did I ran into issues like this frequently (which is why I opened it originally). They generally fell within a couple categories of problems:
I hope that summary is useful! Like I said however, I don't use pnpm anymore, I've been using
@cipolleschi I know it's difficult due to JS tooling being the wild west but isn't it a little silly that react-native itself is a monorepo yet monorepo setups are not "officially" supported? I wonder if we can figure out what the real root cause of these repeated issues is and get it fixed. It seems to me it's primarily bad symlink behavior in cocoapods/rubygems. Might it be possible to get that fixed upstream so this whole class of problems could go away? |
@caustin24345 and @evelant, thank you so much for your investigations and for sharing your findings. Those are extremely valuable and we really appreciate them.
I completely agree with you and I share the same frustrations and perplexities. @robhogan was working on monorepo support some month ago, but now our internal priorities changed a bit and I'm pretty sure we won't have capacity to work on these topics in the very short term. |
Yes we use an I really wish we could get proper support for monorepo. When I started with React Native in 2018, it seemed right around the corner. Literally tens of thousands of developer hours end up wasted on this sort of stuff every year - including their own developers' time. It worked with just a slightly older version of React Native and Expo. To me, that screams that it's a React Native or Expo problem.
Indeed, in React Native 0.72 making these path changes as a patch resolved all of our issues, but now with nothing having changed but React Native and Expo, it fails to work either with or without the patch. So it's got to be React Native, no?
I feel very confident this is not an
|
Using nrwl/nx and 767330f solved the problem for us |
Thanks for sharing @dieguezz! Are you saying you used |
@Nantris i am sorry, i was wrong. That solved the yoga issue, but i started having similar errors for other items inside react-native module. I think they changed something in the way routes are resolved at build time, which conflicts with the way nx or any other monorepos manage dependencies. Maybe there is a better way to do this, but for the moment what worked for me (apart of applying the patch) was to manually map modules in podfile like:
|
Thank you so much for sharing @dieguezz! This issue has been plaguing us and I'm excited to try your approach. Would you mind sharing your React Native version? I noticed sometimes even patch-level version differences affect these workarounds. |
@Nantris i was using 0.73.6, but this also works in 0.74.xx. In the end i freezed 0.72.x because i was having problems with other dependencies we use (like react-native-contacts, which is not prepared for the new platform), but the yoga and all other react-native module import problems were solved. |
So finally i needed to upgrade react native so i had to find a different workaround. What i did is remove
And then add
@Nantris let me know if this works for you |
Thanks very much for sharing @dieguezz! Invertase super-strongly recommends you do not rely on I think there was another approach in one of these many threads that I haven't had time to try but now I can't even find it :( I'll certainly report back with my findings as soon as I get a chance to try this. There always seems to be some other fire to fight first. Thank you again! |
@Nantris I am just using BTW, why should i not rely on modular_header? |
@dieguezz I think you're probably in the clear with this approach? I'm the furthest thing from an expert though. I think I'm certainly looking forward to giving it a try! |
We started having this exact same issue after adding firebase to a project, and the only thing that fixed it for us was @dieguezz 's modular headers fix for the affected packages. Thank you so much! One thing that may or may not contribute to any ongoing investigation into the issue though; in our case it was odd because the mentioned build errors only happened on some of our devs machines, while for others everything was totally fine. After merging the podfile changes though our project is working for everybody on the team, so not really sure what happened there. |
Old Version
0.72.7
New Version
0.73.0
Description
As seems to happen with every new version, header paths are broken on iOS with
use_frameworks! :static
pnpm install
pnpm expo start
eas build -p ios --profile development --local
fails to compile due to header paths issue
Steps to reproduce
https://github.com/evelant/expo50upgrade/
git clone https://github.com/evelant/expo50upgrade/
cd expo50upgrade
pnpm install
pnpm expo start
eas build -p ios --profile development --local
Affected Platforms
Build - MacOS
Output of
npx react-native info
Stacktrace or Logs
Reproducer
https://github.com/evelant/expo50upgrade/
Screenshots and Videos
N/A
The text was updated successfully, but these errors were encountered: