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

After update to 0.57.1 limits file not found and could not build CoreFoundation errors #21482

Closed
fdobre opened this issue Oct 4, 2018 · 28 comments
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tool: Xcode

Comments

@fdobre
Copy link

fdobre commented Oct 4, 2018

Environment

React Native Environment Info:
System:
OS: macOS High Sierra 10.13.6
CPU: x64 Intel(R) Core(TM) i7-6567U CPU @ 3.30GHz
Memory: 170.61 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 8.10.0 - ~/.nvm/versions/node/v8.10.0/bin/node
Yarn: 1.7.0 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v8.10.0/bin/npm
Watchman: 4.7.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 11.4, macOS 10.13, tvOS 11.4, watchOS 4.3
Android SDK:
Build Tools: 19.1.0, 20.0.0, 23.0.1, 23.0.2, 23.0.3, 24.0.0, 24.0.1, 24.0.2, 24.0.3, 25.0.0, 25.0.1, 25.0.2, 25.0.3, 26.0.0, 26.0.1, 26.0.2, 26.0.3, 27.0.0, 27.0.1, 27.0.2, 27.0.3, 28.0.3
API Levels: 22, 23, 24, 25, 26, 27
IDEs:
Android Studio: 3.1 AI-173.4907809
Xcode: 9.4.1/9F2000 - /usr/bin/xcodebuild
npmPackages:
react: 16.5.0 => 16.5.0
react-native: ^0.57.1 => 0.57.1

Description

RN 0.57.1

RN-cli 2.0.1

xCode: 9.4.1 (9F2000) or xCode 10

"babel-core": "7.0.0-bridge.0",
"babel-plugin-transform-runtime": "7.0.0-beta.3",
"babel-preset-latest": "7.0.0-alpha.7",
"babel-preset-stage-0": "7.0.0-beta.3",
"babel-register": "7.0.0-beta.3",
"metro-react-native-babel-preset": "^0.45.6",

After an update of RN from 0.56 to 0.57.0 (or 0.57.1) I get a lot of could not build module 'CoreFoundation' or could not build module Foundation or limits file not found

I followed exactly the steps from RN doc for this update.

I tried removing ios/build folder, cleaning cache, re-installing everything but nothing worked.

▸ Building BunteMobile/OneSignalNotificationServiceExtension [Debug] ▸ Check Dependencies ▸ Compiling NotificationService.m

/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found

#include

/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found

#include

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CoreFoundation.h>

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CFBase.h>

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CoreFoundation.h>

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/UserNotifications.framework/Headers/NSString+UserNotifications.h:8:9: could not build module 'Foundation'

#import <Foundation/Foundation.h>

If I remove the OneSignalNotificationServiceExtension instead of 7 errors I get another 15 errors in other parts of the project:

/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found

#include

/Users/myuser/Desktop/projects/mobileapp/ios/../node_modules/react-native/ReactCommon/fabric/graphics/platform/ios/float.h:8:10: 'limits' file not found

#include

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:6:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CoreFoundation.h>

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/Security.framework/Headers/SecBase.h:28:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CFBase.h>

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator11.4.sdk/System/Library/Frameworks/CFNetwork.framework/Headers/CFNetwork.h:18:10: could not build module 'CoreFoundation'

#include <CoreFoundation/CoreFoundation.h>

/Users/myuser/Desktop/projects/mobileapp/ios/build/Build/Products/Debug-iphonesimulator/include/React/RCTBridgeModule.h:8:9: could not build module 'Foundation'

#import <Foundation/Foundation.h>

The only workaround that I found is to downgrade RN back to 0.56...

I also added a question in stack overflow here:
https://stackoverflow.com/questions/52649586/react-native-0-57-ios-could-not-build-module-corefoundation-or-foundation

I am not sure if this is a bug in RN 0.57 or a problem with the update steps or some cache issue

Reproducible Demo

I cannot provide a reproducible demo

@kelset
Copy link
Contributor

kelset commented Oct 5, 2018

I cannot provide a reproducible demo

Without that it's borderline impossible for us to help you.

That said, it seems to me that you need to update your babel related dependencies: in 0.57 as said in the Changelog we have moved to the stable release, while instead you are still on the alpha/beta phases as you wrote

"babel-plugin-transform-runtime": "7.0.0-beta.3",
"babel-preset-latest": "7.0.0-alpha.7",
"babel-preset-stage-0": "7.0.0-beta.3",
"babel-register": "7.0.0-beta.3",

I think that upgrading to babel stable, and then doing a proper full clean up

rm -rf $TMPDIR/react-*; rm -rf $TMPDIR/haste-*; rm -rf $TMPDIR/metro-*; watchman watch-del-all

Then remove the node_modules and then remove the builds artifacts folder of Xcode could help you.

@fdobre
Copy link
Author

fdobre commented Oct 5, 2018

"babel-plugin-transform-runtime": "7.0.0-beta.3",
"babel-preset-latest": "7.0.0-alpha.7",
"babel-preset-stage-0": "7.0.0-beta.3",
"babel-register": "7.0.0-beta.3",

These are latest dependencies versions yarn finds.

How should the package json deps look like?

According to the readme we should set "^7.0.0" for all of them but that version is not found

@kelset
Copy link
Contributor

kelset commented Oct 5, 2018

That's because you need to migrate to the new format, most packages have been renamed.

@JakeRawr
Copy link
Contributor

JakeRawr commented Oct 7, 2018

I, too, have the same problem.

screen shot 2018-10-07 at 12 24 07 pm

I've follow the steps to upgrade to 0.57.1 as well

I kept my dev-dependencies to the very minimal. I mimic the the package.json from new react-native project (from react-native init)

 "devDependencies": {
    "babel-jest": "23.6.0",
    "jest": "22.4.3",
    "metro-react-native-babel-preset": "0.48.0",
    "react-test-renderer": "16.3.1",
    "prettier": "1.12.1",
    "pretty-quick": "^1.5.1"
  }

@wynch
Copy link

wynch commented Oct 8, 2018

I have a similar problem - limits File not found - with Lottie-react-native since RN 0.57. Although it's not constant. Sometimes build faild, sometimes not. Sometimes builds from command line (using Fastlane) fails, sometimes they succeed. Sometimes it succeed in the command line, but fails from XCode (9.4.1) . As if some process didn't get killed correctly before.

@fdobre
Copy link
Author

fdobre commented Oct 8, 2018

That's because you need to migrate to the new format, most packages have been renamed.

I updated all the babel deps to babel 7 but I still get the ios crashes at build.

I used babel-upgrade to make that update.

@Lawrence93Ho
Copy link

I have similar issue and I solved it by:

  1. Go to Project level Build Settings -> Search Paths -> Header Search Paths
  2. Remove all values there
  3. Build once (it should fail since you removed your required paths)
  4. Add them back
  5. Build again and it works for me

Would appreciate if somebody can lemme know what is going on tho, a bit like the libfishhook.a issue, just remove and add it back then works lol

@fdobre
Copy link
Author

fdobre commented Oct 8, 2018

I removed React and ReactCommon from OneSignalExtension header search paths and from project header search paths. Now I have React only in project target header search paths.

Now it builds, run and archives ok but I do not know why.

Should React be only in the project target and not in project and extensions also?
Should ReactCommon be anywhere in header search paths?

I wonder why it worked until 0.57....

@dickfickling
Copy link

@fdobre we fixed it by doing the same thing--moving React from the Project header search paths to the Target. Not sure what changed in RN internals to cause this

@JakeRawr
Copy link
Contributor

JakeRawr commented Oct 8, 2018

I also fixed it by removing React and ReactCommon from Project header search path. Maybe this was required in the previous versions (My app was created 2 years ago). I also react-native init new app and don't see React and ReactCommon in project header search path. If this needs to be changed, it should be added in the 0.57 change log

@Exilz
Copy link

Exilz commented Oct 9, 2018

I can confirm removing ReactCommon path from Header search path on my target solved it for me.

It's a shame this wasn't documented as a breaking change for the latest version. It took me a whole day to compare a fresh project created with react-native init and our projet which has a lot of native dependencies and build scripts.

Please do this first and clean your projet and your DerivedData before going insane if you're stuck with Foundation, CoreFoundation or limits.h.

@ollyde
Copy link

ollyde commented Nov 25, 2018

None of the above is working for me anymore, using 57.1. Only happening on product achieve now. Stuck now. Why does every update have to break something every-single-time. 👎

@crbrasfield
Copy link

Any word on this? I'm also experiencing this issue. I do not have React or ReactCommon in my header search path.

@likai057187
Copy link

@fdobre, if remove React and ReactCommon in "Header Search Path", how can they find React headers?

I'm brand new to React Native, just followed the official tutorial and created the first RN project by using "react-native init". (My environment is up to date as I just started today. That is to say, RN v0.57.8, node v11.6.0, Xcode 10.1, etcs. )

  1. The xcode project created by "react-native init" won't compile. Error "<React/xxxxxx.h> can't be found". Well, yes, because none of the sub projects like "RCTActionSheet", "RCTText", etcs have "Header Search Path".

  2. Tutorial doesn't say we need to do anything on "Header Search Path". But I've tried to add header location of React and ReactCommon in all project's "Header Search Path".

  3. After done pthread.h not found #2, it does find the headers but now getting bunch of "limits file not found", "Could not build module 'CoreFundation'", etcs. The same errors as you guys got. But I can't get rid of header search path, otherwise the headers not found error comes up.

  4. Did I miss some critical steps which never mentioned in tutorial?Or maybe just nobody is caring about the project created by "reactive-init".

@fdobre
Copy link
Author

fdobre commented Jan 22, 2019

@likai057187 my answer was for RN 0.57.1 and RN0.57.2 and there is a difference between project header search paths and target header search paths.

I added some print screens related to my case here:
https://stackoverflow.com/questions/52649586/react-native-0-57-ios-limits-file-not-found-could-not-build-module-corefoundatio

@hramos
Copy link
Contributor

hramos commented Jan 29, 2019

0.58 has several Xcode fixes. Can we verify this issue is still present in 0.58?

@ollyde
Copy link

ollyde commented Feb 7, 2019

@hramos On 0.58 still seeing the same error.

@neilzhengzx
Copy link

I removed React and ReactCommon from OneSignalExtension header search paths and from project header search paths, and then only add React, it's work.

@lunarraid
Copy link

I have been seeing this ever since we upgraded to XCode 10 (we still have to switch to the legacy build system). Not only does it happen locally, which I resolve (sometimes) by nuking node_modules and cleaning the build, but it is also a transient build failure on our CI server, which starts from a completely clean slate every time and fetches everything. It makes me wonder if there is some kind of race condition happening in dependency loading, since a fresh rebuild on CI usually works if it fails the first time.

@ericlewis
Copy link
Contributor

ericlewis commented Feb 28, 2019

Solution: make sure to remove ReactCommon from the header search path's in your iOS projects.

Why: The problem is it is pulling in cpp code, which contains references to the standard library.

@lunarraid
Copy link

I do not have ReactCommon in my header search paths. Those were removed months ago.

@ericlewis ericlewis reopened this Mar 1, 2019
@linnett
Copy link
Contributor

linnett commented Mar 5, 2019

@lunarraid Also feels like an XCode 10 compatibility issue. Before I updated to XCode 10 on the CI, I never experienced this issue. Even with RN 0.57.8.
A fix would be great - builds are intermittently failing on our CI

@thymikee
Copy link
Contributor

I wonder if does that happens on RN 0.59 as well?

@shercoder
Copy link

So I have been running into this issue as well. First we ran into this issue, removing React and ReactCommon from our Header Search paths helped. Then we updated our CI machine to Mojave and Xcode 10.2, it started to break again. I saw the same error but this time from one of the libraries we were using, lottie-react-native, in this case. lottie-react-native fixed it in one of their latest version by removing React and ReactCommon from their Header Search paths.

My point is, if you're seeing this issue, try to see whether you need to remove React and ReactCommon from your Header Search or it's one of the libraries you're using that needs to remove those paths.

Here are some more readings on this issue:
https://stackoverflow.com/a/53278612
lottie-react-native/lottie-react-native#382
https://stackoverflow.com/questions/52649586/react-native-0-57-ios-limits-file-not-found-could-not-build-module-corefoundatio

Hopefully this will help you guys.

@Gys
Copy link

Gys commented Jul 23, 2019

I ran into this problem using Xcode 10.2.1 and upgrading the project to RN 0.58.6
Bij removing all references to React and ReactCommon from all Project and Target Header Search Paths (main project plus RNSound, none of the others) the problem was solved.

@rcidt
Copy link

rcidt commented Jul 23, 2019

I didn't experience this in 0.59.x but am experiencing it on 0.60.0 upgrade.

EDIT: I seemed to resolve this issue by adding the following to my Podfile

pod 'React-RCTPushNotification', :path => '../node_modules/react-native/Libraries/PushNotificationIOS'

Took me a long time to figure this out because the error was totally unrelated to that missing Pod.

Seems like the dependencies need to be 100% right or ios build explodes with wild errors.

@stale
Copy link

stale bot commented Oct 21, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Oct 21, 2019
@stale
Copy link

stale bot commented Oct 29, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Oct 29, 2019
@facebook facebook locked as resolved and limited conversation to collaborators Oct 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug Platform: iOS iOS applications. Stale There has been a lack of activity on this issue and it may be closed soon. Tool: Xcode
Projects
None yet
Development

No branches or pull requests