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

'algorithm' file not found (since RN 0.53) #711

Closed
1 task done
JasperH8g opened this issue Feb 7, 2018 · 44 comments
Closed
1 task done

'algorithm' file not found (since RN 0.53) #711

JasperH8g opened this issue Feb 7, 2018 · 44 comments

Comments

@JasperH8g
Copy link

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

@ImL1s
Copy link

ImL1s commented Feb 12, 2018

I have same problem...

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

@danieljvdm
Copy link

danieljvdm commented Feb 12, 2018

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.

@sanjay-io
Copy link

sanjay-io commented Feb 24, 2018

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: #697

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

@JasperH8g
Copy link
Author

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

@MarkMolina
Copy link

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

@krmao
Copy link

krmao commented Feb 28, 2018

how to solve it ?

@danieljvdm
Copy link

@krmao read my comment

@krmao
Copy link

krmao commented Mar 1, 2018

@danieljvdm yes , thank you guy !

@justColbs
Copy link

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?

@hitbear518
Copy link

facebook/react-native#17764
see this pr

@justColbs
Copy link

@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

@danieljvdm
Copy link

@justColbs this is a new error in 54.0, I spent a few hours trying to fix it but eventually gave up. Seem like there's illegal syntax in a bunch of new files

@justColbs
Copy link

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

@ghost
Copy link

ghost commented Mar 15, 2018

I am having this imports in the "yoga-umbrella.h". what do I want to do?
#import "Utils.h" #import "YGEnums.h" #import "Yoga-internal.h" #import "Yoga.h"

@justColbs
Copy link

@amardeepranu No clue. I just downgraded to 0.53 and it didn't give me any more problems with this, other than the plethora of problems that have hacky solutions :)

@lemonkey
Copy link

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.

@justColbs
Copy link

@lemonkey You can fix that fishhook error, but i'm not sure if you've tried it. #import "fishhook.h" should be the replacement.

... I feel your pain. ha

@lemonkey
Copy link

@justColbs Was able to go forward with react-native@0.53.0 and react@16.2.0 with the fishhook.h import fix, thanks.

@JasperH8g
Copy link
Author

JasperH8g commented Mar 20, 2018

FYI: This is still an issue on 0.54.2 😒

Environment:
  OS: macOS High Sierra 10.13.3
  Node: 8.2.1
  Yarn: 0.27.5
  npm: 5.3.0
  Watchman: 4.9.0
  Xcode: Xcode 9.2 Build version 9C40b
  Android Studio: 3.0 AI-171.4443003

Packages: (wanted => installed)
  react: ^16.2.0 => 16.2.0
  react-native: ^0.54.2 => 0.54.2

By the way, the hacks above do not work for me anymore either:

screen shot 2018-03-21 at 07 28 08

@lemonkey
Copy link

@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).

@oceanbin

This comment has been minimized.

54lihaoxin added a commit to 54lihaoxin/react_native_playground that referenced this issue Mar 31, 2018
@JasperH8g
Copy link
Author

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

@ucerxxx
Copy link

ucerxxx commented Apr 13, 2018

yoga-umbrella.h file should have only three imports: #import "Yoga.h" #import "YGEnums.h" #import "YGMacros.h"

There are three ways to achieve it:

  1. Fix it manually after pods are built
  2. Fix yoga.podspec manually or using patch: https://gist.github.com/ucerxxx/7101eb87240ccb098a8a9093b421c6fe
  3. Add script in podfile in post_install similar to @amardeepranu post

@no-NameTillNow
Copy link

no-NameTillNow commented Apr 18, 2018

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

@ibrahimab
Copy link

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

@rj9676564

This comment has been minimized.

@rj9676564
Copy link

@no-NameTillNow
It means that I,in "RCTSurfaceHostingView.h" file.
Use of undeclared identifier 'RCTSurfaceMinimumSizeAndMaximumSizeFromSizeAndSizeMeasureMode'

@anhtuank7c

This comment has been minimized.

@JasperH8g
Copy link
Author

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 😒

@NrqhEIcsRi004
Copy link

Change use_frameworks! ==> # use_frameworks! ?

@orta
Copy link
Contributor

orta commented May 16, 2018

I have a shared project for hot fixing React Native versions for issues like this: https://github.com/orta/cocoapods-fix-react-native

@sarath-rp
Copy link

In my case add this line to yoga.podspec file
spec.public_header_files = 'yoga/Yoga.h', 'yoga/YGEnums.h', 'yoga/YGMacros.h'

@sospedra

This comment has been minimized.

@ahmetabdi

This comment has been minimized.

@ibrahimab
Copy link

ibrahimab commented Jun 7, 2018

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!)

@sospedra

This comment has been minimized.

@hramos
Copy link
Contributor

hramos commented Jun 12, 2018

@ibrahimab a PR was already opened against facebook/react-native to do just that: facebook/react-native#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.

@jeffzing
Copy link

"react": "16.4.1",
"react-native": "^0.56.0",
In file included from /Users/Pods/libsodium/src/libsodium/crypto_aead/aes256gcm/aesni/aead_aes256gcm_aesni.c:19:

still having this ,drive me crazy

@lamdan
Copy link

lamdan commented Sep 18, 2018

@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".

@jeffzing
Copy link

jeffzing commented Oct 9, 2018

@lamdan infact this is a problem with cocoapods,i build lib of sodium.a without pod then everything works fine.It's a config.h file cross reference issue.anyway thank you guys.

@jeffzing
Copy link

jeffzing commented Oct 9, 2018

if there anyone need libsodium.a,let me know

@fmorau
Copy link

fmorau commented Oct 3, 2019

${PODS_ROOT}/Headers/Public/libsodium

It means after "reinstall" of the app: pod install etc. --> you reset this setting?)

I also use NAChloride and run into this issue :/

@fmorau
Copy link

fmorau commented Oct 3, 2019

@lamdan maybe you found a better way to solve it? :)

@NickGerleman
Copy link
Contributor

It looks like this issue regards building an older version of react-native. Please reopen in the react-native repo if you experience the problem with a more recent version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests