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

XCode/CocoaPods fails to find yoga/config/Config.h on RN 0.73.2 #69

Closed
msolomon opened this issue Jan 21, 2024 · 6 comments
Closed

XCode/CocoaPods fails to find yoga/config/Config.h on RN 0.73.2 #69

msolomon opened this issue Jan 21, 2024 · 6 comments

Comments

@msolomon
Copy link

After upgrading to RN 0.73 (from an ancient version), my builds consistently fail when trying to compile dependencies for this project. Specifically, when XCode tries to compile the pods for nodejs-mobile-react-native, it fails with:

In file included from /Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp:2: /Users/mike/MyProject/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h:16:10 'yoga/config/Config.h' file not found

I suspect there is something wrong with how nodejs-mobile-react-native's cocoapod is specifying its dependencies. Does this ring true, or do you have any suggestions on how to follow up?

I'm running Node v21.6.0, I followed install instructions recently, pods are up to date, etc..
I think this is the same problem causing #68 and #62, but I wanted to focus in on the yoga dependency issue.

In more detail, when I run xcodebuild -workspace MyProject.xcworkspace -configuration Debug -scheme MyProject (or equivalent in XCode or through yarn run ios), I get:

[...]

CompileC /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.o /Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'nodejs-mobile-react-native' from project 'Pods')
    cd /Users/mike/MyProject/ios/Pods
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -ivfsstatcache /Users/mike/Library/Developer/Xcode/DerivedData/SDKStatCaches.noindex/iphoneos17.2-21C52-884b7f60ac6761a492c03f282b824eb9.sdkstatcache -target arm64-apple-ios13.4 -fmessage-length\=190 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -fcolor-diagnostics -std\=gnu++17 -stdlib\=libc++ -fmodules -fmodules-cache-path\=/Users/mike/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/mike/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wdocumentation -Wunreachable-code -Werror\=deprecated-objc-isa-usage -Werror\=objc-root-class -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -Wno-implicit-fallthrough -DPOD_CONFIGURATION_DEBUG\=1 -DDEBUG\=1 -DCOCOAPODS\=1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS17.2.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -g -Wno-sign-conversion -Winfinite-recursion -Wmove -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wrange-loop-analysis -Wno-semicolon-before-method-body -Wunguarded-availability -index-store-path /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Index.noindex/DataStore -iquote /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/nodejs-mobile-react-native-generated-files.hmap -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/nodejs-mobile-react-native-own-target-headers.hmap -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/nodejs-mobile-react-native-all-non-framework-target-headers.hmap -ivfsoverlay /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/all-product-headers.yaml -iquote /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/nodejs-mobile-react-native-project-headers.hmap -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Products/Debug-iphoneos/nodejs-mobile-react-native/include -I/Users/mike/MyProject/ios/Pods/Headers/Private -I/Users/mike/MyProject/ios/Pods/Headers/Private/nodejs-mobile-react-native -I/Users/mike/MyProject/ios/Pods/Headers/Public -I/Users/mike/MyProject/ios/Pods/Headers/Public/DoubleConversion -I/Users/mike/MyProject/ios/Pods/Headers/Public/RCT-Folly -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-Core -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-callinvoker -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-cxxreact -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-debug -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-hermes -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-jsi -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-jsiexecutor -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-jsinspector -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-logger -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-perflogger -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-rendererdebug -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-runtimeexecutor -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-runtimescheduler -I/Users/mike/MyProject/ios/Pods/Headers/Public/React-utils -I/Users/mike/MyProject/ios/Pods/Headers/Public/SocketRocket -I/Users/mike/MyProject/ios/Pods/Headers/Public/Yoga -I/Users/mike/MyProject/ios/Pods/Headers/Public/fmt -I/Users/mike/MyProject/ios/Pods/Headers/Public/glog -I/Users/mike/MyProject/ios/Pods/Headers/Public/hermes-engine -I/Users/mike/MyProject/ios/Pods/Headers/Public/libevent -I/Users/mike/MyProject/ios/Pods/Headers/Public/nodejs-mobile-react-native -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/DerivedSources-normal/arm64 -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/DerivedSources/arm64 -I/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/DerivedSources -F/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Products/Debug-iphoneos/nodejs-mobile-react-native -F/Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios -F/Users/mike/MyProject/ios/Pods/hermes-engine/destroot/Library/Frameworks/universal -F/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/hermes-engine/Pre-built -F/Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Products/Debug-iphoneos/XCFrameworkIntermediates/nodejs-mobile-react-native -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/React/React-Core.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/folly/RCT-Folly.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/jsi/React-jsi.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/react_debug/React-debug.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/react_renderer_debug/React-rendererdebug.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/react_utils/React-utils.modulemap -fmodule-map-file\=/Users/mike/MyProject/ios/Pods/Headers/Public/yoga/Yoga.modulemap -I/Users/mike/MyProject/ios/Pods/../../node_modules/nodejs-mobile-react-native/ios/libnode/include/node/ -include /Users/mike/MyProject/ios/Pods/Target\ Support\ Files/nodejs-mobile-react-native/nodejs-mobile-react-native-prefix.pch -MMD -MT dependencies -MF /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.d --serialize-diagnostics /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.dia -c /Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp -o /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.o -index-unit-output-path /Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.o
In file included from /Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp:2:
/Users/mike/MyProject/node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h:16:10: fatal error: 'yoga/config/Config.h' file not found
#include <yoga/config/Config.h>
         ^~~~~~~~~~~~~~~~~~~~~~
1 error generated.

[...]

** BUILD FAILED **

The following build commands failed:
    CompileC /Users/mike/Library/Developer/Xcode/DerivedData/MyProject-btskxwsuhzvbxabantuodyccbyys/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/nodejs-mobile-react-native.build/Objects-normal/arm64/rn-bridge.o /Users/mike/MyProject/node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp normal arm64 c++ com.apple.compilers.llvm.clang.1_0.compiler (in target 'nodejs-mobile-react-native' from project 'Pods')
(1 failure)

Also, thanks for maintaining this library!

@staltz
Copy link
Member

staltz commented Jan 22, 2024

Thanks for reporting this issue, it seems clear enough, but to be absolutely sure, I would need more information before we can identify the problem. Can you please provide us with:

  • npx react-native info output
  • Version of nodejs-mobile-react-native in your project's package.json

The following is not the solution, but I think I can see the root cause of the problem already:

node_modules/nodejs-mobile-react-native/ios/rn-bridge.cpp:2

This line is importing "node.h" which is from libnode, this library.

Yoga has nothing to do with nodejs-mobile at all, yet this import seems to be occurring:

node_modules/react-native/ReactCommon/yoga/yoga/node/Node.h:16:10

It might be a naming conflict. React Native traditionally had this file named YGNode.h, but now as it's Node.h it is conflicting with libnode's node.h (especially on macOS which treats filenames case-insensitively).

We'll have to find a way of telling libnode where it should look up its headers from, or then React Native has to fix this upstream by keeping more specific names...

@dylancom
Copy link

dylancom commented Jan 22, 2024

I just upgraded to RN 0.73.2 and have the same error. I can confirm that the issue is that it's conflicting with Node.h

@dylancom
Copy link

I found that it works fine if I change the import from #include "node.h" to #include <node.h>.

@msolomon
Copy link
Author

Thanks @dylancom, your include change worked for me as well. If anyone needs a workaround until #70 or similar is merged, they can make that change themselves for the moment, and perhaps keep it around with patch-package.

I'm using version 18.17.4 of nodejs-mobile-react-native. npx react-native info output (I switched to node 18, which did not change anything):

npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 14.2.1
  CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
  Memory: 1.30 GB / 32.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.19.0
    path: ~/.nvm/versions/node/v18.19.0/bin/node
  Yarn:
    version: 1.22.21
    path: /usr/local/bin/yarn
  npm:
    version: 10.2.3
    path: ~/.nvm/versions/node/v18.19.0/bin/npm
  Watchman:
    version: 2023.12.04.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.14.3
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.2
      - iOS 17.2
      - macOS 14.2
      - tvOS 17.2
      - visionOS 1.0
      - watchOS 10.2
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9514443
  Xcode:
    version: 15.2/15C500b
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 20.0.2
    path: /usr/bin/javac
  Ruby: Not Found
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: ^18.2.0
  react-native:
    installed: 0.73.2
    wanted: ^0.73.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: false
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

@staltz
Copy link
Member

staltz commented Jan 23, 2024

Fixed now in nodejs-mobile-react-native version 18.17.6

@staltz staltz closed this as completed Jan 23, 2024
@Lonmee
Copy link

Lonmee commented Jan 23, 2024

Tnx! fixed the name and include by patch. Just naming conflicts. Will upgrade later.

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

Successfully merging a pull request may close this issue.

4 participants