[SDK49] building ios : declaration of 'facebook' must be imported from module 'yoga.yoga.YGNodePrint' before it is required

After updating to SDK49 (49.0.9), I had this error after npx expo run:ios
(pod install done before, update, clean, reinstall all … whatever)

❌ (/Users/xxxxx/ios/Pods/Headers/Public/ExpoModulesCore/ExpoModulesCore/EXJavaScriptObject.h:8:17)

   6 | #import <jsi/jsi.h>
   7 |
>  8 | namespace jsi = facebook::jsi;
     |                 ^ declaration of 'facebook' must be imported from module 'yoga.yoga.YGNodePrint' before it is required
   9 | #endif // __cplusplus
  10 |
  11 | @class EXJavaScriptRuntime;

❌ (/xxx/ios/Pods/Headers/Public/ExpoModulesCore/ExpoModulesCore/EXJavaScriptObject.h:8:27)

   6 | #import <jsi/jsi.h>
   7 |
>  8 | namespace jsi = facebook::jsi;
     |                           ^ missing '#include "jsi/jsi-inl.h"'; 'jsi' must be declared before it is used
   9 | #endif // __cplusplus
  10 |
  11 | @class EXJavaScriptRuntime;


❌  (/xxxx/ios/Pods/Headers/Public/React-NativeModulesApple/ReactCommon/RCTTurboModule.h:35:18)

  33 |  * ObjC++ specific TurboModule base class.
  34 |  */
> 35 | class JSI_EXPORT ObjCTurboModule : public TurboModule {
     |                  ^ variable has incomplete type 'class JSI_EXPORT'
  36 |  public:
  37 |   // TODO(T65603471): Should we unify this with a Fabric abstraction?
  38 |   struct InitParams {

Did someone already seen that ? Any idea ? Thank you !

A few days later … :rofl: N°1 in popular topic but nobody from Expo has an idea ?
Btw I had to went back to sdk48 … until this issue is solved.
I rarely open anymore issue on github as most of the time it is closed by the bot “provide a reproducible repo” which is quite impossible, as I have no idea how this error come from (apart ExpoModulesCore)

I had a similar issue with SDK48 when I try to build with “jsc” instead of “hermes” for the package “react-native-vision-camera”: “^2.15.6”,

 In file included from /xxxx/node_modules/react-native-vision-camera/android/src/main/cpp/FrameProcessorRuntimeManager.cpp:16:
  /xxxx/node_modules/react-native-vision-camera/android/src/main/cpp/MakeJSIRuntime.h:15:12: fatal error: 'jsi/JSCRuntime.h' file not found
    #include <jsi/JSCRuntime.h>
             ^~~~~~~~~~~~~~~~~~
  1 error generated.
  [7/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/CameraView.cpp.o
  [8/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/JSIJNIConversion.cpp.o
  [9/10] Building CXX object CMakeFiles/VisionCamera.dir/src/main/cpp/VisionCamera.cpp.o
  ninja: build stopped: subcommand failed.

  C++ build system [build] failed while executing:
      /xxx/Library/Android/sdk/cmake/3.22.1/bin/ninja \
        -C \
        /xxx/Work/shares/fameapp/node_modules/react-native-vision-camera/android/.cxx/Debug/157363l6/arm64-v8a \
        VisionCamera
    from /xxx/Work/shares/fameapp/node_modules/react-native-vision-camera/android

It is always the same with expo@^49.0.13.

❌  (/Users/laurent/Work/shares/fameapp/ios/Pods/Headers/Public/ExpoModulesCore/ExpoModulesCore/EXJavaScriptObject.h:8:17)

   6 | #import <jsi/jsi.h>
   7 |
>  8 | namespace jsi = facebook::jsi;
     |                 ^ declaration of 'facebook' must be imported from module 'yoga.yoga.YGNodePrint' before it is required
   9 | #endif // __cplusplus
  10 |
  11 | @class EXJavaScriptRuntime;
eas diagnostics

  EAS CLI 5.4.0 environment info:
    System:
      OS: macOS 12.6.9
      Shell: 5.8.1 - /bin/zsh
    Binaries:
      Node: 16.18.0 - /usr/local/bin/node
      Yarn: 1.22.19 - /usr/local/bin/yarn
      npm: 8.19.2 - /usr/local/bin/npm
    Utilities:
      Git: 2.37.1 - /usr/bin/git
    npmPackages:
      expo: ^49.0.13 => 49.0.13
      expo-updates: ~0.18.16 => 0.18.16
      react: 18.2.0 => 18.2.0
      react-dom: 18.2.0 => 18.2.0
      react-native: 0.72.5 => 0.72.5
    npmGlobalPackages:
      eas-cli: 5.2.0
      expo-cli: 6.3.10
    Project workflow: generic

As I can’t provide a reproducable repo, I can’t submit an issue.
Anybody from @expo team here to provide an idea ?

I’ve tried On a case-sensitive filesystem, React Native fails to build · Issue #33648 · facebook/react-native · GitHub, changing the first letter of yoga in spec.module_name in node_modules/react-native/ReactCommon/yoga/Yoga.podspec :

spec.module_name = 'Yoga'

now the error is the same with Yoga.yoga.YGNodePrint instead of yoga.yoga.YGNodePrint :

❌  (/Users/laurent/Work/shares/fameapp/ios/Pods/Headers/Public/ExpoModulesCore/ExpoModulesCore/EXJavaScriptObject.h:8:17)

   6 | #import <jsi/jsi.h>
   7 |
>  8 | namespace jsi = facebook::jsi;
     |                 ^ declaration of 'facebook' must be imported from module 'Yoga.yoga.YGNodePrint' before it is required
   9 | #endif // __cplusplus
  10 |
  11 | @class EXJavaScriptRuntime;

Searching again … here is another : Build fails due to header files missing when using -fcxx-modules flag (AppDelegate.mm) · Issue #33692 · facebook/react-native · GitHub

I use -fcxx-modules flag (due to img.ly PESDK)

1 Like

I’ve built a repo to replicate the issue : reproducible.tgz - Google Drive

it happens with SDK 49.0.13 when I add the needed instruction for localization of img.ly in AppDelegate.mm
(https://img.ly/docs/pesdk/react-native/guides/user-interface/localization/)

#import <RNPhotoEditorSDK/RNPhotoEditorSDK.h>
...
[PESDK setLocalizationDictionary: @{ ...}

and also these options in Xcode (as requested by img.ly support to build sdk48)

CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = YES;
....
OTHER_CPLUSPLUSFLAGS = (
   "$(inherited)",
   "-fcxx-modules",
);

No problem with sdk49 without localization (and it works with my current sdk48 version)
Ticket submitted to img.ly support …

As suggested by @keith-kurak (issue reproduced on his machine), ticket opened => [SDK49] [IOS] using img.ly localization : declaration of ‘facebook’ must be imported from module ‘yoga.yoga.YGNodePrint’ before it is required · Issue #24982 · expo/expo · GitHub