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

Hermes does not compile for iOS #43241

Closed
2 tasks done
CyberMew opened this issue Feb 23, 2024 · 23 comments
Closed
2 tasks done

Hermes does not compile for iOS #43241

CyberMew opened this issue Feb 23, 2024 · 23 comments
Labels
Debugger Issues related to React Native DevTools and the New Debugger Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue.

Comments

@CyberMew
Copy link

Bug Description

In Pods: [Hermes] Using the latest commit from main.

Showing Recent Issues
/Users/user/Downloads/AwesomeProject4/node_modules/react-native/ReactCommon/hermes/inspector-modern/InspectorState.cpp:225:40: No member named 'AsyncTrigger' in 'facebook::hermes::debugger::PauseReason'

/Users/user/Downloads/AwesomeProject4/node_modules/react-native/ReactCommon/hermes/inspector-modern/InspectorState.cpp:366:33: No member named 'AsyncTrigger' in 'facebook::hermes::debugger::PauseReason'

Also tried other RN versions #43082

Sidenote: CMAKE is apparently required but it is not part of any dependencies (something to take note of, otherwise the scripts cannot compile at all and error immediately)

  • I have confirmed this bug does not occur with JSC
  • The issue is reproducible with the latest version of React Native.

Hermes git revision (if applicable):
React Native version: 0.73.4
OS: macOS Sonama 14.3.1
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): Apple Silicon

Steps To Reproduce

  1. Init a new AwesomeProject for 0.73.4.
  2. Build iOS

code example: NA

The Expected Behavior

Compiles successfully.

@CyberMew CyberMew added the Bug label Feb 23, 2024
@neildhar
Copy link
Contributor

Hey @CyberMew, it looks like the latest changes to our debugger API are not source compatible with older versions of React Native. We do maintain source compatibility for JSI, but we don't generally guarantee compatibility for the Hermes C++ API. That said, we are working towards a stable C-based binary interface that will allow new versions of Hermes to be dropped into older versions of RN.

Given that this change is relatively small, it may be possible to work around it by making some minor source modifications, or building without debugging enabled.

@neildhar neildhar added Debugger Issues related to React Native DevTools and the New Debugger and removed Bug labels Feb 23, 2024
@dannysu
Copy link
Contributor

dannysu commented Feb 23, 2024

hi @CyberMew, I believe that file has been removed in newer React Native versions. And as @neildhar mentioned, our C++ API is not source compatible with older RN versions.

That said, the compilation problem is a simple one to fix. One workaround you can do is by modifying places that read PauseReason::AsyncTrigger to use PauseReason::AsyncTriggerImplicit instead.

@dannysu dannysu closed this as completed Feb 23, 2024
@CyberMew
Copy link
Author

Thank you all for the information. May I know to which version of RN is this supported back?

I am using the latest stable RN version 0.73.4 as mentioned (fresh project), do I have to switch to 0.74 RC for this to work out of the box? From the pod logs for 0.73.4 it is already pulling from main branch, so shouldn’t it already be the latest Hermes code?

@CyberMew
Copy link
Author

I just tried the workaround to replace the 2 occurrences in node_modules/react-native/ReactCommon/hermes/inspector-modern/InspectorState.cpp, it did kinda work, but it still failed with another error:

[ 96%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/cdp/DebuggerDomainAgent.cpp.o
[ 96%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/inspector/chrome/MessageTypes.cpp.o
[ 98%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/cdp/RuntimeDomainAgent.cpp.o
[ 98%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/inspector/chrome/MessageConverters.cpp.o
/Users/user/Downloads/AwesomeProject4/ios/Pods/hermes-engine/API/hermes/hermes.cpp:623:63: error: only virtual member functions can be marked 'override'
void setExternalMemoryPressure(const jsi::Object &, size_t) override;
^~~~~~~~
[ 98%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/inspector/chrome/MessageInterfaces.cpp.o
1 error generated.
make[3]: *** [API/hermes/CMakeFiles/libhermes.dir/hermes.cpp.o] Error 1
make[3]: *** Waiting for unfinished jobs....
[ 98%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/cdp/RemoteObjectsTable.cpp.o
[ 98%] Building CXX object API/hermes/CMakeFiles/libhermes.dir/inspector/chrome/JSONValueInterfaces.cpp.o
make[2]: *** [API/hermes/CMakeFiles/libhermes.dir/all] Error 2
make[1]: *** [API/hermes/CMakeFiles/libhermes.dir/rule] Error 2
make: *** [libhermes] Error 2
++ echo 'Copy Apple framework to destroot/Library/Frameworks'

Going to ios/Pods/hermes-engine/API/hermes/hermes.cpp Line 623 and deleting "override" makes it compilable now, but more errors appears when I continue to build:

Showing Recent Errors Only
Undefined symbol: facebook::jsi::HostObject::getPropertyNames(facebook::jsi::Runtime&)
Undefined symbol: facebook::jsi::HostObject::get(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&)
Undefined symbol: facebook::jsi::HostObject::set(facebook::jsi::Runtime&, facebook::jsi::PropNameID const&, facebook::jsi::Value const&)
Undefined symbol: facebook::jsi::HostObject::~HostObject()
Undefined symbol: facebook::jsi::NativeState::~NativeState()
Undefined symbol: facebook::jsi::JSINativeException::~JSINativeException()
Undefined symbol: facebook::jsi::Array::createWithElements(facebook::jsi::Runtime&, std::initializer_list<facebook::jsi::Value>)
Undefined symbol: facebook::jsi::Value::Value(facebook::jsi::Value&&)
Undefined symbol: facebook::jsi::Value::Value(facebook::jsi::Runtime&, facebook::jsi::Value const&)
Undefined symbol: facebook::jsi::Value::~Value()
Undefined symbol: facebook::jsi::Buffer::~Buffer()
Undefined symbol: facebook::jsi::JSError::JSError(facebook::jsi::Runtime&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)
Undefined symbol: facebook::jsi::JSError::JSError(facebook::jsi::Runtime&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>)
Undefined symbol: facebook::jsi::JSError::JSError(facebook::jsi::Runtime&, facebook::jsi::Value&&)
Undefined symbol: facebook::jsi::JSError::~JSError()
Undefined symbol: facebook::jsi::Pointer::operator=(facebook::jsi::Pointer&&)
Undefined symbol: facebook::jsi::Runtime::createValueFromJsonUtf8(unsigned char const*, unsigned long)
Undefined symbol: facebook::jsi::Runtime::~Runtime()
Undefined symbol: facebook::jsi::Value::asBool() const
Undefined symbol: facebook::jsi::Value::asNumber() const
Undefined symbol: facebook::jsi::Object::getPropertyAsObject(facebook::jsi::Runtime&, char const*) const
Undefined symbol: facebook::jsi::Object::getPropertyAsFunction(facebook::jsi::Runtime&, char const*) const
Undefined symbol: facebook::jsi::Value::asObject(facebook::jsi::Runtime&) const &
Undefined symbol: facebook::jsi::Value::asString(facebook::jsi::Runtime&) const &
Undefined symbol: facebook::jsi::Object::asFunction(facebook::jsi::Runtime&) const &
Undefined symbol: facebook::jsi::Value::asObject(facebook::jsi::Runtime&) &&
Undefined symbol: facebook::jsi::Value::asString(facebook::jsi::Runtime&) &&
Undefined symbol: facebook::jsi::Object::asFunction(facebook::jsi::Runtime&) &&
Undefined symbol: typeinfo for facebook::jsi::HostObject
Undefined symbol: typeinfo for facebook::jsi::NativeState
Undefined symbol: typeinfo for facebook::jsi::JSINativeException
Undefined symbol: typeinfo for facebook::jsi::Buffer
Undefined symbol: typeinfo for facebook::jsi::JSError
Undefined symbol: typeinfo for facebook::jsi::Runtime
Undefined symbol: vtable for facebook::jsi::HostObject
Undefined symbol: vtable for facebook::jsi::NativeState
Undefined symbol: vtable for facebook::jsi::JSIException
Undefined symbol: vtable for facebook::jsi::JSINativeException
Undefined symbol: vtable for facebook::jsi::Buffer
Undefined symbol: vtable for facebook::jsi::Runtime

Something seems seriously not right here... Just wondering if it is an issue on my personal laptop or the project or podspec.

@tmikov
Copy link

tmikov commented Feb 26, 2024

@CyberMew my understanding is that you are trying to build Hermes from trunk with React Native from a branch. That is not guaranteed to work - Hermes and RN are only guaranteed to be source compatible at the same time in their respective trunks.

(The following explanation is not necessarily fully accurate, as I am not fully up to speed with the React Native release process, but it should at least give you some idea.)

When RN creates a stable branch, they also create a branch in Hermes at the same time, ensuring that the two continue to be source compatible. So, if you want to build Hermes against RN 0.73.x, you need to checkout the rn/stable/0.73 branch of Hermes. Then it is usually possible to manually cherry-pick some of the newer Hermes changes if needed.

Otherwise, you are left in a situation like the current one. RN 0.73.4 and Hermes trunk are incompatible, and nobody has tried to build them together before. It is likely possible, with some amount of effort, to make them work together, but it is impractical for us to provide support for source compilation of all possible version combinations of RN and Hermes.

Now, we are well aware that the current situation is not ideal, because it can be difficult, or even practically impossible, to get a newer version of Hermes to work with an older version of React Native. This is very frustrating, especially for the Hermes team, because when we add new features to Hermes, it may take many months before users can try them. We are working on addressing this by introducing the Hermes Stable ABI which will make it possible to drop in any version of Hermes in any future version of React Native. We are close, but we are not 100% there yet.

Is there a specific reason you want to compile Hermes from trunk, a new feature that you need?

@tmikov tmikov reopened this Feb 26, 2024
@CyberMew
Copy link
Author

Hi, thank you for the information. I am not actually doing it myself, but React Native is the one pulling it from repo during pod install. I actually had to install cmake for the iOS script to compile (or it will fail straightaway without reason) as I thought it was a new change. Here are the logs when running pod install from a fresh copy of 0.73.4:

-> Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`
[Hermes] Using the latest commit from main.
Const Defined!

Resolving dependencies of `Podfile`
...
-> Installing hermes-engine (0.73.4)
 > Git download
 > Git download
     $ /usr/bin/git clone https://github.com/facebook/hermes.git
     /var/folders/k_/xy96gkc174zbxxm83lp7npgc0000gp/T/d20240226-77169-alau10
     --template=
     Cloning into '/var/folders/k_/xy96gkc174zbxxm83lp7npgc0000gp/T/d20240226-77169-alau10'...
     Updating files: 100% (10870/10870), done.
   $ /usr/bin/git -C
   /var/folders/k_/xy96gkc174zbxxm83lp7npgc0000gp/T/d20240226-77169-alau10 checkout
   --quiet db06dc2ef19f88343e2ec362d63d301be8d8e355
 > Running prepare command
   $ /bin/bash -c  set -e .
   /Users/user/Downloads/AwesomeProject4/node_modules/react-native/sdks/hermes-engine/../../sdks/hermes-engine/utils/create-dummy-hermes-xcframework.sh
   ++ rm -rf destroot
   ++ mkdir -p destroot/Library/Frameworks
   ++ pushd destroot/Library/Frameworks
   ++ echo ''
   ++ mkdir -p macosx/hermes.framework
   ++ clang dummy.c -dynamiclib -o macosx/hermes.framework/hermes
   ++ mkdir -p ios/hermes.framework
   ++ clang dummy.c -dynamiclib -o ios/hermes.framework/hermes
   ++ rm dummy.c
   ++ popd
  > Copying hermes-engine from
  `/Users/user/Library/Caches/CocoaPods/Pods/External/hermes-engine/98848d96c55ab96e916e0a7c8ab1435b-9819c`
  to `Pods/hermes-engine`
...
[!] hermes-engine has added 2 script phases. Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.

Doing a search and it seems some others are facing issue with building on iOS as well (though they did not provide actual error but I assume is similar): https://stackoverflow.com/questions/77956730/setting-up-react-native-version-0-73-4-environment-installing-at-ios-for-macos

I do not have any issue with RN 0.71.x, since the podspec pulls the tar file from maven.

Not sure why it is pulling from source, but I also tried BUILD_FROM_SOURCE=false bundle exec pod install to no avail - it still pulls from main (not hitting maven).

@neildhar
Copy link
Contributor

@CyberMew it certainly shouldn't be trying to build Hermes from source right out of the box. React Native distributes prebuilt binaries for Hermes that should be used instead. Could you share your exact steps for setting up the project? It may be an issue in React Native instead.

@tmikov
Copy link

tmikov commented Feb 26, 2024

Uh-oh, at the very least it looks like building Hermes from source using CocoaPods isn't well supported by RN. We need to look into that.

@CyberMew
Copy link
Author

CyberMew commented Feb 26, 2024

@neildhar The command I used is npx react-native@latest init AwesomeProject (which installs RN 0.73.4). Then cd AwesomeProject and the usual npm install, bundle install, cd ios and followed by bundle exec pod install. You should also encounter the same "using latest commit from main" when it's fetching podspec for hermes-engine. Let me know if you guys are not seeing it.. maybe something else is wrong on my side

Not sure why the env BUILD_FROM_SOURCE=false (as per hermes-utils.rb) did not force the whole flow to go via the prebuilt binaries but instead going via force_build_from_main. I modified the hermes-utils.rb to actually only return podspec_source_download_prebuild_release_tarball, but even that does not work (Xcode script is still trying to build from source CMake Error: The source directory "/Users/user/Downloads/AwesomeProject4/ios/Pods/hermes-engine" does not appear to contain CMakeLists.txt., maybe I disrupted some natural flow elsewhere).

@Ann-MarieKemp
Copy link

My team is experiencing this issue as well. My teammates and I who are located in the US don't have an issue building our React Native project but our deployment system located in Europe and a colleague located there as well have the same PauseReason::AsyncTrigger issue when running our pod install command. We are all building from the same source code and would expect the pod install process to work the same way for all of us.

@tmikov
Copy link

tmikov commented Feb 29, 2024

@Ann-MarieKemp it looks like there are two problems here:

  1. RN distributes binary versions of Hermes, it should not be building from source at all.
  2. Additionally, looks like building from source is broken and uses an incorrect version of Hermes.

The integration of Hermes with React Native and the associated build process is owned by React Native, so I am transferring this issue to them.

@tmikov tmikov transferred this issue from facebook/hermes Feb 29, 2024
@github-actions github-actions bot added Needs: Author Feedback Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue. labels Feb 29, 2024
@tmikov tmikov changed the title Does not compile in iOS Hermes does not compile for iOS Feb 29, 2024
Copy link

⚠️ Missing Reproducible Example
ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
  • If your bug is UI related: a Snack
  • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.

@cipolleschi
Copy link
Contributor

Hi @CyberMew, I think that there is something wrong with your setup.
If you are using a stable version of React Native (0.73.4, from the description) you should always use a prebuilt version of Hermes we ship with the framework. The download and all the setup is automatically handled by React Native and the url is here: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.73.4/

You should never try to use a different version of hermes by tampering with the node_modules and the podspecs because there is no guarantee (yet) that newer versions of Hermes are compatible with older versions of React Native.

@Ann-MarieKemp You probably has something somewhere else that is setting a global environment variable BUILD_FROM_SOURCE to true and that is affecting how Hermes is built.

On the React Native side, we can disambiguate that BUILD_FROM_SOURCE env variable with a different one, which is harder to clash with.
Meanwhile, you can workaround install your pods with BUILD_FROM_SOURCE=false bundle exec pod install and that should fix the issue.

cipolleschi added a commit to cipolleschi/react-native that referenced this issue Feb 29, 2024
Summary:
In OSS we have reports like [this one](facebook#43241) where env variables from different settings might clash together, making react native apps fail to build hermes.

For example, a team might have defined a BUILD_FROM_SOURCE env variable to build their specific project from source and that will clash with how react native apps installs Hermes.

This change disambiguate the BUILD_FROM_SOURCE flag we have internally, moving to a less likely to clash RCT_BUILD_HERMES_FROM_SOURCE.

## Changelog:
[iOS][Breaking] - Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE

Differential Revision: D54356337
cipolleschi added a commit to cipolleschi/react-native that referenced this issue Feb 29, 2024
Summary:
In OSS we have reports like [this one](facebook#43241) where env variables from different settings might clash together, making react native apps fail to build hermes.

For example, a team might have defined a BUILD_FROM_SOURCE env variable to build their specific project from source and that will clash with how react native apps installs Hermes.

This change disambiguate the BUILD_FROM_SOURCE flag we have internally, moving to a less likely to clash RCT_BUILD_HERMES_FROM_SOURCE.

## Changelog:
[iOS][Breaking] - Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE

Reviewed By: huntie

Differential Revision: D54356337
@CyberMew
Copy link
Author

CyberMew commented Feb 29, 2024

Hi @cipolleschi, yes I tried using 0.73.4 with a fresh copy using the standard commands so I don't think it's something to do with my setup (it's a fresh macOS install). No issues when I use my old 0.71.14 project (with Gem/Podfile lock files already working previously). I did not try a fresh copy of 0.71.14 (without the lock files). It seems like there could be some version compatibility? I will delete my 0.71.14 lock files and re-bundle/pod install to see if it is related to Gem/Podfile and report the results. In case it is not clear enough, I did not touch any Hermes code or setting (nor do I want to mess with it!). Everything is default.

@github-actions github-actions bot added the Needs: Attention Issues where the author has responded to feedback. label Feb 29, 2024
facebook-github-bot pushed a commit that referenced this issue Feb 29, 2024
Summary:
In OSS we have reports like [this one](#43241) where env variables from different settings might clash together, making react native apps fail to build hermes.

For example, a team might have defined a BUILD_FROM_SOURCE env variable to build their specific project from source and that will clash with how react native apps installs Hermes.

This change disambiguate the BUILD_FROM_SOURCE flag we have internally, moving to a less likely to clash RCT_BUILD_HERMES_FROM_SOURCE.

## Changelog:
[iOS][Breaking] - Rename BUILD_FROM_SOURCE to RCT_BUILD_HERMES_FROM_SOURCE

Reviewed By: huntie

Differential Revision: D54356337

fbshipit-source-id: 1115e3c22cbcf1d64b7edae30da614d52423123b
@cipolleschi
Copy link
Contributor

cipolleschi commented Feb 29, 2024

@CyberMew, 0.71 didn't have the BUILD_FROM_SOURCE env var switch, so it's expected that it works.

Can you try to:

  1. echo $BUILD_FROM_SOURCE from a terminal and report what it outputs?
  2. run cd <YourApp>/ios && bundle install && BUILD_FROM_SOURCE=false bunlde exec pod install?

You should not see the build hermes from the latest commit on main message. Instead, you should see something like this:
Screenshot 2024-02-29 at 11 26 49

as you can see from the yellow-ish line, I used 0.73.5, but it should be the same for 0.73.4.

@CyberMew
Copy link
Author

CyberMew commented Mar 3, 2024

@cipolleschi I have done that before and echo $BUILD_FROM_SOURCE returns nothing.

Did npx react-native init AwesomeProject6 from Terminal.

╰─ bundle install && BUILD_FROM_SOURCE=false bundle exec pod install
Bundle complete! 3 Gemfile dependencies, 40 gems now installed.
Bundled gems are installed into `../vendor/bundle`
/Users/user/Downloads/AwesomeProject6/vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.8.1/lib/active_support/core_ext/big_decimal/conversions.rb:3: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add bigdecimal to your Gemfile or gemspec. Also contact author of activesupport-7.0.8.1 to add bigdecimal into its gemspec.
/Users/user/Downloads/AwesomeProject6/vendor/bundle/ruby/3.3.0/gems/activesupport-7.0.8.1/lib/active_support/notifications/fanout.rb:3: warning: mutex_m was loaded from the standard library, but will no longer be part of the default gems since Ruby 3.4.0. Add mutex_m to your Gemfile or gemspec. Also contact author of activesupport-7.0.8.1 to add mutex_m into its gemspec.
Framework build type is static library
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
[Codegen] generating an empty RCTThirdPartyFabricComponentsProvider
/Users/user/.cocoapods/repos-art/cocoapods-remote/.artpodrc
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
[Codegen] Found FBReactNativeSpec
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
[Codegen] Found rncore
Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`
[Hermes] Using the latest commit from main.
Const Defined!
/Users/user/.cocoapods/repos-art/cocoapods-remote/.artpodrc
/Users/user/.cocoapods/repos-art/cocoapods-remote/.artpodrc
Downloading dependencies
Installing CocoaAsyncSocket (7.6.5)
Installing DoubleConversion (1.1.6)
Installing FBLazyVector (0.73.5)
Installing FBReactNativeSpec (0.73.5)
Installing Flipper (0.201.0)
Installing Flipper-Boost-iOSX (1.76.0.1.11)
Installing Flipper-DoubleConversion (3.2.0.1)
Installing Flipper-Fmt (7.1.7)
Installing Flipper-Folly (2.6.10)
Installing Flipper-Glog (0.5.0.5)
Installing Flipper-PeerTalk (0.0.4)
Installing FlipperKit (0.201.0)
Installing OpenSSL-Universal (1.1.1100)
Installing RCT-Folly (2022.05.16.00)
Installing RCTRequired (0.73.5)
Installing RCTTypeSafety (0.73.5)
Installing React (0.73.5)
Installing React-Codegen (0.73.5)
Installing React-Core (0.73.5)
Installing React-CoreModules (0.73.5)
Installing React-Fabric (0.73.5)
Installing React-FabricImage (0.73.5)
Installing React-ImageManager (0.73.5)
Installing React-Mapbuffer (0.73.5)
Installing React-NativeModulesApple (0.73.5)
Installing React-RCTActionSheet (0.73.5)
Installing React-RCTAnimation (0.73.5)
Installing React-RCTAppDelegate (0.73.5)
Installing React-RCTBlob (0.73.5)
Installing React-RCTFabric (0.73.5)
Installing React-RCTImage (0.73.5)
Installing React-RCTLinking (0.73.5)
Installing React-RCTNetwork (0.73.5)
Installing React-RCTSettings (0.73.5)
Installing React-RCTText (0.73.5)
Installing React-RCTVibration (0.73.5)
Installing React-callinvoker (0.73.5)
Installing React-cxxreact (0.73.5)
Installing React-debug (0.73.5)
Installing React-graphics (0.73.5)
Installing React-hermes (0.73.5)
Installing React-jserrorhandler (0.73.5)
Installing React-jsi (0.73.5)
Installing React-jsiexecutor (0.73.5)
Installing React-jsinspector (0.73.5)
Installing React-logger (0.73.5)
Installing React-nativeconfig (0.73.5)
Installing React-perflogger (0.73.5)
Installing React-rendererdebug (0.73.5)
Installing React-rncore (0.73.5)
Installing React-runtimeexecutor (0.73.5)
Installing React-runtimescheduler (0.73.5)
Installing React-utils (0.73.5)
Installing ReactCommon (0.73.5)
Installing SocketRocket (0.6.1)
Installing Yoga (1.14.0)
Installing boost (1.83.0)
Installing fmt (6.2.1)
Installing glog (0.3.5)
Installing hermes-engine (0.73.5)
Installing libevent (2.1.12)
Generating Pods project
Setting USE_HERMES build settings
Setting REACT_NATIVE build settings
Setting CLANG_CXX_LANGUAGE_STANDARD to c++20 on /Users/user/Downloads/AwesomeProject6/ios/AwesomeProject6.xcodeproj
Pod install took 972 [s] to run
Integrating client project

[!] Please close any current Xcode sessions and use `AwesomeProject6.xcworkspace` for this project from now on.
/Users/user/.cocoapods/repos-art/cocoapods-remote/.artpodrc
Pod installation complete! There are 73 dependencies from the Podfile and 61 total pods installed.

[!] hermes-engine has added 2 script phases. Please inspect before executing a build. See `https://guides.cocoapods.org/syntax/podspec.html#script_phases` for more information.

Seems like something else is wrong such that it is pulling from main. I am using M1 Pro Sonama 14.3.1 (23D60). Is there something I can edit to force it pulling the artifacts directly and not from main?

@cipolleschi
Copy link
Contributor

@CyberMew, we have to look into why your system is pulling hermes from main. 🤔
hermes-engine is loaded into react native from these two lines.

hermes_source_type is a function defined here.

The logic is the following:

  • if you specify the ENV var REACT_NATIVE_OVERRIDE_HERMES_DIR, then build hermes from that dir. (Not our case)
  • if you specify the ENV var HERMES_ENGINE_TARBALL_PATH, then use hermes from that tarball. (Not our case)
  • if you specify the ENV var HERMES_COMMIT, then use hermes from that specific commit. (Not our case)
  • if you specify the ENV var BUILD_FROM_SOURCE, then build from main or from a specific commit defined in the app (Not our case)
  • if there exists release artifacts, use them ==> This is what we want!
  • if there exists nightly artifacts, use them
  • Else, build from source from main.

I think we are falling into the last case, unfortunately.

We need to understand why the check to retrieve the hermes artifacts fails.

Can you access this website: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.73.5??

What happens if you click here: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.73.5/react-native-artifacts-0.73.5-hermes-ios-debug.tar.gz?
Does it starts a download for the hermes tarbal?

@CyberMew
Copy link
Author

CyberMew commented Mar 5, 2024

@cipolleschi Thank you for the tip. That was the issue. That url is blocked on my machine and to make things worse I am using Artifactory, so on top of changing the URL I also needed to modify the curl command in the code to add -u user:apikey for it to return 200 http code. I also had to delete the ios/Pods/hermes-engine folder in order for it to repull accordingly to the script.

For some reason previously on 0.71.x it will immediately return a download failure with the url during the pod install, so it was evident something broke which was easily fixed when I searched/changed the URL to Artifactory (didn't have to add user:apikey for some reason back then 🤷) and it simply worked.

I think the script should be made more clear to user that the default release artifacts is not accessible (some error code shown), so it is highlighted what happened (i.e. print URL it is grabbing from and also the error code) instead of just defaulting to build source from main "silently" (which is not the usual path). Usually we want to lock the version to use a known compatible version and not use the latest code.

Nonetheless thank you very much for your assistance!

@Ann-MarieKemp
Copy link

On the React Native side, we can disambiguate that BUILD_FROM_SOURCE env variable with a different one, which is harder to clash with. Meanwhile, you can workaround install your pods with BUILD_FROM_SOURCE=false bundle exec pod install and that should fix the issue.

Thank you for your response on this. We tried this but it turned out our issue was the same as @CyberMew's with the blocked url. That fix resolved our issue.

@cipolleschi
Copy link
Contributor

I think the script should be made more clear to user that the default release artifacts is not accessible (some error code shown), so it is highlighted what happened (i.e. print URL it is grabbing from and also the error code) instead of just defaulting to build source from main "silently" (which is not the usual path). Usually we want to lock the version to use a known compatible version and not use the latest code.

Yes, I completely agree. We can do a better job when reporting the issue.

@showtan001
Copy link

@CyberMew, 0.71 didn't have the BUILD_FROM_SOURCE env var switch, so it's expected that it works.

Can you try to:

  1. echo $BUILD_FROM_SOURCE from a terminal and report what it outputs?
  2. run cd <YourApp>/ios && bundle install && BUILD_FROM_SOURCE=false bunlde exec pod install?

You should not see the build hermes from the latest commit on main message. Instead, you should see something like this: Screenshot 2024-02-29 at 11 26 49

as you can see from the yellow-ish line, I used 0.73.5, but it should be the same for 0.73.4.

Running error:
image
How to solve it?

@kayakyakr
Copy link

@cipolleschi Thank you for the tip. That was the issue. That url is blocked on my machine and to make things worse I am using Artifactory, so on top of changing the URL I also needed to modify the curl command in the code to add -u user:apikey for it to return 200 http code. I also had to delete the ios/Pods/hermes-engine folder in order for it to repull accordingly to the script.

Where did you update the command to hit your internal url? I'm also behind an artifactory, can't find the spot to update.

@CyberMew
Copy link
Author

@cipolleschi Thank you for the tip. That was the issue. That url is blocked on my machine and to make things worse I am using Artifactory, so on top of changing the URL I also needed to modify the curl command in the code to add -u user:apikey for it to return 200 http code. I also had to delete the ios/Pods/hermes-engine folder in order for it to repull accordingly to the script.

Where did you update the command to hit your internal url? I'm also behind an artifactory, can't find the spot to update.

Access the node_modules/react-native/sdks/hermes-engine/hermes-utils.rb file. You can search for the maven https path entry and curl entries there. Modify them accordingly so it points to your url instead. For the user/pass, just add it after curl commands for the two instances you will find. Hope that helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Debugger Issues related to React Native DevTools and the New Debugger Needs: Attention Issues where the author has responded to feedback. Needs: Repro This issue could be improved with a clear list of steps to reproduce the issue.
Projects
None yet
Development

No branches or pull requests

8 participants