yoga: 'algorithm' file not found (since RN 0.53)

Report

☝️ However, this is very similar to this other issue. Could it be possible to fix these kind of errors in a bit more structural way? 🤔

Issues and Steps to Reproduce

We’ve got this in our PodFile:

pod 'React', :path => 'node_modules/react-native', :subspecs => [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTText',
  'RCTNetwork',
  'RCTWebSocket',
  'RCTImage',
  'RCTAnimation',
]
pod 'yoga', :path => 'node_modules/react-native/ReactCommon/yoga'

Prior to ReactNative 0.53 this worked. After upgrading to the latest it doesn’t.

Expected Behavior

A successful build

Actual Behavior

This error:

screen shot 2018-02-07 at 10 49 03

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 73
  • Comments: 44 (3 by maintainers)

Commits related to this issue

Most upvoted comments

After a lot of struggling, I came down to these additions to our Podfile, which is a combination of a lot of workarounds from this and other issues 😒

Can someone from the core team explain why this is still happening?

Change use_frameworks! ==> # use_frameworks! ?

There are three lines in yoga-umbrella.h that won’t build:

#import "YGNode.h"
#import "YGNodePrint.h"
#import "Yoga-internal.h"

You can remove them manually but the following cocoapods post install script fixes the issue:

def remove_unused_yoga_headers
    filepath = './Pods/Target Support Files/yoga/yoga-umbrella.h'
    
    contents = []
    
    file = File.open(filepath, 'r')
    file.each_line do | line |
        contents << line
    end
    file.close
    
    contents.delete_at(14) # #import "YGNode.h"
    contents.delete_at(14) # #import "YGNodePrint.h"
    contents.delete_at(14) # #import "Yoga-internal.h"
    
    file = File.open(filepath, 'w') do |f|
        f.puts(contents)
    end
end

post_install do | installer |
    remove_unused_yoga_headers
end

Full disclosure, I have no clue what these headers are meant for and thus there could be some side effects with this script. However, my app seems to be running without issues.

Workarounds for all integrating issues 1.‘algorithm’ file not found and yoga/Yoga.h missing Add the below line at yoga.podspec will be at node_modules/react-native/ReactCommon/yoga spec.public_header_files = ‘yoga/Yoga.h’, ‘yoga/YGEnums.h’, ‘yoga/YGMacros.h’ then do ‘Pod install’ 2.there some issues regarding typedef and NSAttributedKeyString ,which u can solve by the hints xcode provides 3.After doing step 1 & 2 build, again there will be error ,now if there is an error with ‘folly/folly-config.h’ just deleted node_modules and uninstall react-native then agin install react-native also delete ur Deriveddata of xcode (rm -rfd ~/Library/Development/Xcode/DerivedData) else if there is error pointing @ CGSize &minimum in RCTSurfaceSizeMeasureMode.h then, add “ifdef _cpluscplus” before RCT_EXTERN func and add “#endif” after func close 4.clean and build All errors will be cleared Hope it works P.S: whenever you do pod install clean ur project and then run

@hitbear518 That worked for me, but then I get the fishhook error. I resolved that, and now I have another error. This feels like a slippery slope. The new error is in the image and because of that, I cannot import React anywhere in my project without it failing to build React.

screen shot 2018-03-12 at 1 37 02 pm

I’m seeing this issue as well. After removing those lines in yoga-umbrella.h, I’m getting:

umbrella header for module 'yoga' does not include header 'YGNode.h' 
#import "Headers/yoga-umbrella.h"
^
<module-includes>:1:1: error: umbrella header for module 'yoga' does not include header 
<module-includes>:1:1: error: umbrella header for module 'yoga' does not include header 'Yoga-internal.h'

Which totally makes sense after removing those lines.

This seems to be an issue in RN 0.52.X as well: https://github.com/facebook/yoga/issues/697

I think the only solution for me right now is to back-up to 0.51.0.

Tried the 0.54.0-rc3 and still get the same error.

@jeffzing i ran into this as well with NAChloride/libsodium. I finally fixed it by setting the Header Search Paths for the libsodium target to only:

"${PODS_ROOT}/Headers/Private/libsodium" "${PODS_ROOT}/Headers/Public/NAChloride" "${PODS_ROOT}/Headers/Public/libsodium" "$(PODS_ROOT)/libsodium/src/libsodium/include/sodium" "$(PODS_ROOT)/libsodium/src/libsodium/include"

and setting “Use Header Maps” to “No”.

@ibrahimab a PR was already opened against facebook/react-native to do just that: https://github.com/facebook/react-native/pull/19265. It was merged about three weeks ago, and is now part of the 0.56.0-rc release candidate that we published yesterday. Another PR was also merged recently which should have fixed the fishhook issue others were running into.

Please give the RC a try and let us know if the issue is resolved. I’m going to look through @orta’s repo and see if there’s anything else we need to pull in, but feel free to send a PR if you have a specific fix in mind already.

Downgrading to react-native@0.53.0 didn’t fix it for me (same algorithm error). Downgrading to react-native@0.51.0 and react@16.0.0 didn’t fix it for me either (this time fishhook error).

Welp.

The workaround from @danieljvdm seems to work. Would be nice if we don’t need this kind of black magic though 😅

Guys, came on. First message is from Feb 7 🤷🏻‍♂️

Since 0.55.4 I can delete React and the other packages from Cocoapods, most packages I use have updated their repo so React 0.11 won’t install.

Still, can one of the contributors explain why some of the third party packages causes cocoapods to install another version of React and how we can fix this without defining it in the Podfile. The reason I ask is because when I do this in my projects everything goes wrong and, even while including DevSupport in the subspecs, shaking to open dev menu will not work. I also get a lot of other dependency issues and compilation issues, so I would much prefer not including React and the subspecs in my Podfile. (extra: this issue is not contained to using “use_frameworks!”).

Maybe an issue should be opened to expand the documentation to tackle this problem that many developers are facing, especially if those developers haven’t heard of this repo: https://github.com/orta/cocoapods-fix-react-native

Can I get an official reaction from the React Native Core Team? I am happy to contribute but I would love to know what is causing this and whether you are working on this.

I am tagging the only contributor I know actively answers questions: @hramos (thank you hramos!)

This is still an issue in RN 0.54.4:

Environment:
  OS: macOS High Sierra 10.13.3
  Node: 8.2.1
  Yarn: 1.5.1
  npm: 5.3.0
  Watchman: 4.9.0
  Xcode: Xcode 9.3 Build version 9E145
  Android Studio: 3.1 AI-173.4670197

Packages: (wanted => installed)
  react: ^16.3.0 => 16.3.0
  react-native: ^0.54.4 => 0.54.4

screen shot 2018-04-03 at 14 02 48

@amardeepranu Thanks, confirming that your Podfile post-install step along with the package.json postinstall Fishhook fix worked for me with react-native@0.54.2 and react@^16.3.0-alpha.1 (latest as I write this).

@danieljvdm Smh. Thanks for the response. I’ll try downgrading to 0.53 and cross my fingers.

Manually deleting the lines or adding the post install script does not solve it for me. I still get the same issue. I’m also upgrading my project from 0.45.0, maybe that has something to do with it?