react-native: [Windows] Task :ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes] FAILED

Description

Hi i tried to build my react native project but am getting the following error

> Task :ReactAndroid:downloadBoost
Download https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.gz

> Task :ReactAndroid:downloadBoost UP-TO-DATE

> Task :ReactAndroid:downloadDoubleConversion UP-TO-DATE
Download https://github.com/google/double-conversion/archive/v1.1.6.tar.gz

> Task :ReactAndroid:downloadFmt UP-TO-DATE
Download https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz

> Task :ReactAndroid:downloadFolly UP-TO-DATE
Download https://github.com/facebook/folly/archive/v2021.06.28.00.tar.gz

> Task :ReactAndroid:downloadGlog UP-TO-DATE
Download https://github.com/google/glog/archive/v0.3.5.tar.gz

> Task :ReactAndroid:downloadLibevent UP-TO-DATE
Download https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz

> Task :ReactAndroid:hermes-engine:downloadHermes UP-TO-DATE
Download https://github.com/facebook/hermes/tarball/hermes-2022-05-20-RNv0.69.0-ee8941b8874132b8f83e4486b63ed5c19fc3f111

> Task :ReactAndroid:hermes-engine:configureBuildForHermes
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- Found the following ICU libraries:
--   uc (required)
--   i18n (required)
--   data (required)
--   uc (required)
-- Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY) (Required is at least version "52")
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR)
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings disabled.
-- Could NOT find Python module pygments
-- Could NOT find Python module pygments.lexers.c_cpp
-- Could NOT find Python module yaml
-- CMAKE_HOST_SYSTEM_NAME = Windows
-- CMAKE_SYSTEM_NAME = Windows
-- HERMES_APPLE_TARGET_PLATFORM =
-- CMAKE_CROSSCOMPILING = FALSE
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes

> Task :ReactAndroid:hermes-engine:buildHermes
Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  LLVHDemangle.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\external\llvh\lib\Demangle\Debug\LLVHDemangle.lib
  dtoa.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\external\dtoa\Debug\dtoa.lib
  LLVHSupport.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\external\llvh\lib\Support\Debug\LLVHSupport.lib
  zip.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\external\zip\Debug\zip.lib
  hermesOptimizer.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Debug\hermesOptimizer.lib
  hermesFrontEndDefs.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\FrontEndDefs\Debug\hermesFrontEndDefs.lib
  hermesPlatformUnicode.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Platform\Unicode\Debug\hermesPlatformUnicode.lib
  hermesRegex.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Regex\Debug\hermesRegex.lib
  hermesSupport.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Support\Debug\hermesSupport.lib
  hermesADT.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\ADT\Debug\hermesADT.lib
  hermesFlowParser.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\FlowParser\Debug\hermesFlowParser.lib
  hermesAST.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\AST\Debug\hermesAST.lib
  hermesParser.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Parser\Debug\hermesParser.lib
  hermesAST2JS.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\AST2JS\Debug\hermesAST2JS.lib
  hermesSourceMap.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\SourceMap\Debug\hermesSourceMap.lib
  hermesInst.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Inst\Debug\hermesInst.lib
  hermesFrontend.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\Debug\hermesFrontend.lib
  hermesBackend.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\BCGen\Debug\hermesBackend.lib
  hermesHBCBackend.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\BCGen\HBC\Debug\hermesHBCBackend.lib
  hermesCompilerDriver.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\lib\CompilerDriver\Debug\hermesCompilerDriver.lib
  hermesc.vcxproj -> C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\bin\Debug\hermesc.exe

> Task :ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes]
C/C++: ninja: error: 'C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe', needed by 'lib/InternalBytecode/InternalBytecode.hbc', missing and no known rule to make it

> Task :ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes] FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
34 actionable tasks: 8 executed, 26 up-to-date
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Using Windows 10 built-in ICU

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes]'.
> Build command failed.
  Error while executing process C:\Users\alade\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\.cxx\Release\1c2w6o2l\arm64-v8a libhermes}
  ninja: Entering directory `C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\.cxx\Release\1c2w6o2l\arm64-v8a'

  ninja: error: 'C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe', needed by 'lib/InternalBytecode/InternalBytecode.hbc', missing and no known rule to make it


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 54s

error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


Using Windows 10 built-in ICU

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes]'.
> Build command failed.
  Error while executing process C:\Users\alade\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\.cxx\Release\1c2w6o2l\arm64-v8a libhermes}
  ninja: Entering directory `C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine\.cxx\Release\1c2w6o2l\arm64-v8a'

  ninja: error: 'C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe', needed by 'lib/InternalBytecode/InternalBytecode.hbc', missing and no known rule to make it


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 3m 54s

    at makeError (C:\Users\alade\Desktop\Cliqueon\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
    at C:\Users\alade\Desktop\Cliqueon\node_modules\@react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async runOnAllDevices (C:\Users\alade\Desktop\Cliqueon\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
    at async Command.handleAction (C:\Users\alade\Desktop\Cliqueon\node_modules\@react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

C:\Users\alade\Desktop\Cliqueon>yarn android

Version

0.69.0

Output of npx react-native info

Execution failed for task ‘:ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes]’.

Build command failed. Error while executing process C:\Users\alade\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine.cxx\Release\1c2w6o2l\arm64-v8a libhermes} ninja: Entering directory `C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine.cxx\Release\1c2w6o2l\arm64-v8a’

ninja: error: ‘C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe’, needed by ‘lib/InternalBytecode/InternalBytecode.hbc’, missing and no known rule to make it

Steps to reproduce

react native init project yarn android os architecture: windows 10 5gb ram processor: intel dual core 64bit processor os: windows 10

Snack, code example, screenshot, or link to a repository

290688604_1084972242438413_537003635989804412_n

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 90 (17 by maintainers)

Most upvoted comments

Same issue with me

> Task :ReactAndroid:hermes-engine:configureBuildForHermes FAILED
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- The following ICU libraries were not found:
--   uc (required)
--   i18n (required)
--   data (required)
--   uc (required)
-- Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND) (Required is at least version "52")
CMake Error at CMakeLists.txt:520 (message):
  Unable to find ICU.

@MuhammadRafeh This problem is because your system won’t have ICU, i got the same problem using Ubuntu 22.04 and solved by installing from the source.

git clone https://github.com/unicode-org/icu
cd icu/icu4c
cd source
./configure --prefix=/usr 
make
sudo make install
  • I already have long path enabled on my system.
  • Bumping NDK version in android\build.gradle file to version 23.2.8568313 worked :
buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31

        if (System.properties['os.arch'] == "aarch64") {
            // For M1 Users we need to use the NDK 24 which added support for aarch64
           ndkVersion = "21.4.7075529"
           ndkVersion = "24.0.8215888"
        } else {
            // Otherwise we default to the side-by-side NDK version from AGP.
-          ndkVersion = "21.4.7075529"
+          ndkVersion = "23.2.8568313"
        }
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.2.1")
        classpath("com.facebook.react:react-native-gradle-plugin")
        classpath("de.undercouch:gradle-download-task:5.0.1")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

@mganandraj thank you again .

Same happening for me when updating my project to react native 0.69.1 with the new architecture enabled.

Could not determine the dependencies of task ':ReactAndroid:buildCMakeDebug[x86_64][fabricjni,hermes-executor-debug,etc]'.
> Could not resolve all task dependencies for configuration ':ReactAndroid:debugCompileClasspath'.
   > Could not resolve project :ReactAndroid:hermes-engine.
     Required by:
         project :ReactAndroid
      > No matching configuration of project :ReactAndroid:hermes-engine was found. The consumer was configured to find an API of a component, preferably optimized for Android, as well as attribute 'com.android.build.api.attributes.BuildTypeAttr' with value 'debug', attribute 'com.android.build.api.attributes.AgpVersionAttr' with value '7.1.1', attribute 'org.jetbrains.kotlin.platform.type' with value 'androidJvm' but:
          - None of the consumable configurations have attributes.

Yes, it happens in a new project only after new architecture is enabled.


From: Nicola Corti @.> Sent: Thursday, June 30, 2022 10:51:23 AM To: facebook/react-native @.> Cc: Stephen Collins @.>; Mention @.> Subject: Re: [facebook/react-native] Task :ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes] FAILED (Issue #34084)

Thansk for the report @nibblesnbitshttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnibblesnbits&data=05|01||387ec99b87594a8320c008da5aa800b7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637921974854590259|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=h7RlGhGJ4h539uXmUmbGSDjPrFVZUslpz2GPVkw9sP8%3D&reserved=0 I will look into this. To help me understand:

  • Is this happening on a newly created project?
  • I assume you’re enablign the New Architecture in your project right?

— Reply to this email directly, view it on GitHubhttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Ffacebook%2Freact-native%2Fissues%2F34084%23issuecomment-1171319719&data=05|01||387ec99b87594a8320c008da5aa800b7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637921974854590259|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=r36qxRZjwqmh1GqEczdBz%2FkFWlLv8ASpr1PsD2PIFtI%3D&reserved=0, or unsubscribehttps://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FABODKJN6TN66N3V22TXBNNLVRWX6XANCNFSM5Z7TUX4A&data=05|01||387ec99b87594a8320c008da5aa800b7|84df9e7fe9f640afb435aaaaaaaaaaaa|1|0|637921974854590259|Unknown|TWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D|3000|||&sdata=CLDLZcrKpJDSTKG0tAihbz5wNl9i0k8UB1yOfD1aFPk%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

Any updates to this issue? it is especially annoying when trying to build it in the cloud with expo eas

[RUN_GRADLEW] -- The following ICU libraries were not found:
[RUN_GRADLEW] --   uc (required)
[RUN_GRADLEW] --   i18n (required)
[RUN_GRADLEW] --   data (required)
[RUN_GRADLEW] --   uc (required)
[RUN_GRADLEW] -- Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND) (Required is at least version "52")
[RUN_GRADLEW] -- Configuring incomplete, errors occurred!

Is the only workaround to install the ICU libs locally?

For running it locally just run sudo apt-get install libicu-dev (Ubuntu 22.04) then it works locally.

@cortinico Getting this issue on a Mac M1 machine, with a fresh new architecture project. None of the solutions mentioned here works. Any pointers would be appreciated.

Sadly no progress with this building under windows.

Finally I was able to make this work in Windows.

I wen’t ahead and created a WSL2 instance with ubuntu and I can build the same project fine. (It’s a clean project)

But in the windows machine the build fails due to the maximum full path to an object file.

Here’s the log output.

First during the compile phase there’s a warning about the AndroidProgressbarMeasurementsManager.cpp:

C/C++: debug|arm64-v8a :CMake Warning in E:/projetos/emifmobile/node_modules/react-native/ReactCommon/react/renderer/components/progressbar/CMakeLists.txt: C/C++: debug|arm64-v8a : The object file directory C/C++: debug|arm64-v8a : E:/projetos/emifmobile/node_modules/react-native/ReactAndroid/.cxx/Debug/3d4m3e59/arm64-v8a/ReactCommon/react/renderer/components/progressbar/CMakeFiles/rrc_progressbar.dir/./ C/C++: debug|arm64-v8a : has 175 characters. The maximum full path to an object file is 250 C/C++: debug|arm64-v8a : characters (see CMAKE_OBJECT_PATH_MAX). Object file C/C++: debug|arm64-v8a : android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp.o C/C++: debug|arm64-v8a : cannot be safely placed under this directory. The build may not work C/C++: debug|arm64-v8a : correctly.

Then, later on the build process I get this error:

E:\AndroidSdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android-ar.exe: ReactCommon/react/renderer/components/progressbar/CMakeFiles/rrc_progressbar.dir/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp.o: No such file or directory.

I’ve added back in the app/build.gradle some of the code from 0.68.1 to test… but I had no success.

// Fix for windows limit on number of character in file paths and in command lines if (Os.isFamily(Os.FAMILY_WINDOWS)) { arguments “NDK_APP_SHORT_COMMANDS=true” }

Adding the following fixed it for me:

In the project level build.gradle

Line 1

+ import org.apache.tools.ant.taskdefs.condition.Os

Line 19 or after the first System.properties check (depending on your config)

if (System.properties['os.arch'] == "aarch64") {
   // For M1 Users we need to use the NDK 24 which added support for arch64
   ndkVersion = "24.0.8215888"
+} else if (Os.isFamily(Os.FAMILY_WINDOWS)) {
+   // For Windows Users, we need to use NDK 23, otherwise the build will
+   // fail due to paths longer than the OS limit
+   ndkVersion = "23.1.7779620"
} else {
   // Otherwise we default to the side-by-side NDK version from AGP.
   ndkVersion = "21.4.7075529"
}

I hope this helps you guys find some path to solve your issues. Full repo with changes can be checked here

Same issue with me

> Task :ReactAndroid:hermes-engine:configureBuildForHermes FAILED
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- The following ICU libraries were not found:
--   uc (required)
--   i18n (required)
--   data (required)
--   uc (required)
-- Failed to find all ICU components (missing: ICU_INCLUDE_DIR ICU_LIBRARY _ICU_REQUIRED_LIBS_FOUND) (Required is at least version "52")
CMake Error at CMakeLists.txt:520 (message):
  Unable to find ICU.

Nothing has changed 🤷 Still get the missing rule error with Version 0.70.1

@Skullcan did you manage to build successfully without WSL? And can you post your logs when build successfully?

Yes, I was able to make it work in both Windows and WSL. But I was using react native 0.69.1 never tried 0.70

Edit: Full bundleRelease build log: https://pastebin.com/aRCaBs8c

yarn android --active-arch-only build log: https://pastebin.com/FDTV54sq

Both on windows 11

Same; two errors. for debug build (npx react-native run-android):

> Task :ReactAndroid:hermes-engine:buildCMakeRelease[arm64-v8a][libhermes] FAILED
C/C++: ninja: error: 'D:/git/random/MyApp/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe', needed by 'lib/InternalBytecode/InternalBytecode.hbc', missing and no known rule to make it

with gradlew.bat bundleRelease:

info Writing bundle output to:, D:\git\random\MyApp\android\app\build\generated\assets\react\release\index.android.bundle
info Writing sourcemap output to:, D:\git\random\MyApp\android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map
info Done writing bundle output
info Done writing sourcemap output
info Copying 7 asset files
info Done copying assets

> Task :app:bundleReleaseJsAndAssets FAILED

FAILURE: Build failed with an exception.

* Where:
Script 'D:\git\random\MyApp\node_modules\react-native\react.gradle' line: 126

* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> java.lang.Exception: Couldn't determine Hermesc location. Please set `project.ext.react.hermesCommand` to the path of the hermesc binary file. node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc

It seems the debug build is trying to depend on a release build of hermes, but an attempt at a release build assumes one already exists. 🤷

EDIT: Might be worth noting that node_modules\react-native\ReactAndroid\hermes-engine\build\hermes\bin\Debug\hermesc.exe DOES exists after npx react-native run-android, but the error message indicates that for some reason it’s looking for node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/hermesc.exe, not the debug one.

We saw the same issue and couldn’t solve it by following the linked instructions. The hermesc.exe in Debug Folder exists, Release Folder is empty leading to this error. We tried it on different Windows 10 Systems.

It happens also if you ran the task directly from Visual Studio Developer Command Prompot: gradlew.bat :ReactAndroid:hermes-engine:assembleRelease gradlew.bat :ReactAndroid:hermes-engine:assembleDebug fails too, because it tries to link against a release hermesc.exe which obviously doesn’t exist.

I have the same issue in 0.71.14

This issue is fixed in React Native 0.71 (as this task won’t be executing anymore). Please migrate to 0.71 and try again. If the issue persists, open a new issue. Thank you

@mganandraj I’m using "react-native": "0.70.1" in a newly created project.

  • I reran .\gradlew assembleRelease inside the Developer Command Prompt for VS 2022 to share the full log and for some reason I was getting a different error now same as here
  • so I used your PR #34791 and I was able to build successfully for the first time, thank you.

Windows already can handle long file names but it requires the apps to opt into it by prefixing the file paths with a special sequence and by avoiding certain old APIs. Android ndk21 still uses the old binutils distribution whose ‘ar’ utility still can’t support long file paths. We will be in much better shape once we upgrade to ndk23.

@rayhk6 not yet , it could be a bug I guess so I just disabled the new arch for the moment

Thansk for the report @nibblesnbits I will look into this. To help me understand:

  • Is this happening on a newly created project?
  • I assume you’re enablign the New Architecture in your project right?

I am having same problem 0.71.14

System:
    OS: macOS 14.0
    CPU: (8) arm64 Apple M1
    Memory: 86.52 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.17.1 - ~/.nvm/versions/node/v18.17.1/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.17.1/bin/yarn
    npm: 9.6.7 - ~/.nvm/versions/node/v18.17.1/bin/npm
    Watchman: 2023.11.06.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.14.2 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 23.0, iOS 17.0, macOS 14.0, tvOS 17.0, watchOS 10.0
    Android SDK:
      API Levels: 23, 26, 28, 31, 33, 34
      Build Tools: 29.0.2, 30.0.3, 31.0.0, 33.0.0, 34.0.0
      System Images: android-34 | Google APIs ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2022.3 AI-223.8836.35.2231.10811636
    Xcode: 15.0.1/15A507 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_292 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.14 => 0.71.14 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found
[ 53%] Building CXX object lib/Support/CMakeFiles/hermesSupport.dir/Semaphore.cpp.o

> Task :react-native:ReactAndroid:hermes-engine:buildHermes FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5.1/userguide/command_line_interface.html#sec:command_line_warnings
644 actionable tasks: 4 executed, 640 up-to-date
OpenJDK 64-Bit Server VM warning: ignoring option MaxPermSize=2048m; support was removed in 8.0
CMake Deprecation Warning at CMakeLists.txt:42 (cmake_policy):
  The OLD behavior for policy CMP0026 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


/Users/vilayhongbounthanh/Work/6.Task/metamask-mobile/node_modules/react-native/sdks/hermes/lib/Support/Semaphore.cpp:35:3: error: use of undeclared identifier 'assert'
  assert(semPtr_ != nullptr && "sem_open should have succeeded");
  ^
1 error generated.
make[3]: *** [lib/Support/CMakeFiles/hermesSupport.dir/Semaphore.cpp.o] Error 1
make[2]: *** [lib/Support/CMakeFiles/hermesSupport.dir/all] Error 2
make[1]: *** [tools/hermesc/CMakeFiles/hermesc.dir/rule] Error 2
make: *** [hermesc] Error 2

@alabsi91 not working above solution…

@alabsi91 The log snippet says the static library creation is failing which points to the limitation of the “ar” tool in ndk 21 to handle the file paths more than 260 chars long. This restriction might go away once we switch to ndk 23 or higher. By the way, Did you enable long file path support in windows ? https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry

@cortinico Great to hear about the plans to simplify the Hermes builds. Lmk if you need any help in coding or testing …

The PRs fixed hermes and character scape errors for me. great work.

But later I got the character scape error for react-native-gesture-handler:

  CMake Error at D:/Projects/calcapp/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6 (add_subdirectory):
    Syntax error in cmake code at

      D:/Projects/calcapp/android/app/build/generated/rncli/src/main/jni/Android-rncli.cmake:6

    when parsing string

      D:\Projects\calcapp\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\ rngesturehandler_autolinked_build

    Invalid character escape '\P'.
  Call Stack (most recent call first):
    D:/Projects/calcapp/node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake:59 (include)
    CMakeLists.txt:7 (include)

Android-rncli.cmake file:

# This code was generated by [React Native CLI](https://www.npmjs.com/package/@react-native-community/cli)

cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

add_subdirectory(D:\Projects\calcapp\node_modules\react-native-gesture-handler\android\build\generated\source\codegen\jni\ rngesturehandler_autolinked_build)

set(AUTOLINKED_LIBRARIES 
  react_codegen_rngesturehandler
)

I did workaround this error using the react-native.config.js at my project root:

module.exports = {
  dependencies: {
    "react-native-gesture-handler": {
      platforms: {
        // iOS specific properties go here
        ios: {},
        // Android specific properties go here
        android: {
          cmakeListsPath:
            'D:/Projects/calcapp/node_modules/react-native-gesture-handler/android/build/generated/source/codegen/jni/',
        },
      },
    },
  },
};

Then later got a different error for react-native-reanimated, which fixed by updating to 3.0.0-rc.3.

And finally managed to get a successful build. 🎉 Ran on emulator with no errors.

This was a debug build usign yarn android, But when building release using gradlew assembleRelease I got this error:

  D:\Android\Sdk\ndk\21.4.7075529\toolchains\llvm\prebuilt\windows-x86_64\bin\aarch64-linux-android-ar.exe: ReactCommon/react/renderer/components/progressbar/CMakeFiles/rrc_progressbar.dir/android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp.o: No such file or directory
  [342/345] Linking CXX static library ReactCommon\react\renderer\components\modal\librrc_modal.a
  [343/345] Linking CXX static library ReactCommon\react\renderer\components\switch\librrc_switch.a
  [344/345] Linking CXX static library ReactCommon\react\renderer\components\slider\librrc_slider.a
  ninja: build stopped: subcommand failed

I was encountering the same issue as https://github.com/facebook/react-native/issues/34084#issuecomment-1253767539 with the same setup, which is the same as https://github.com/facebook/react-native/issues/34084#issuecomment-1255355730

I managed to reach this step either by compiling the hermes project manually as release in VS2022 or by copying the debug exe to the release folder. This is the first issue that required a workaround.

I also installed the ICU libraries, because it kept saying that data was missing, but I’m not sure if that had any impact on the solution, because the output still says Failed to find all ICU components (missing: ICU_INCLUDE_DIR) (Required is at least version "52").

The second issue was a syntax issue, in this block in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake

file(GLOB input_SRC CONFIGURE_DEPENDS 
        *.cpp
		C:/dev/rn3/android/app/build/generated/rncli/src/main/jni/*.cpp)
#        ${PROJECT_BUILD_DIR}/generated/rncli/src/main/jni/*.cpp)

add_library(${CMAKE_PROJECT_NAME} SHARED ${input_SRC})

For some reason, add_library is not liking mixed directory separators, and is interpreting the backslash from the windows style directory separator as an escape character. By manually typing the path as above, I managed to bypass the problem.

The following CMAKE_PATH path transformation looks like it would resolve the issue, but it requires a newer version of CMake than the required one in the file, 3.24 instead of 3.13. https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html#path-transformations

The proper fix for windows would be to not mix slashes and backslashes when generating the file list.

same on MAC OS with RN 0.69.4

` FAILURE: Build completed with 2 failures.

1: Task failed with an exception.

  • What went wrong: Execution failed for task ‘:ReactAndroid:hermes-engine:configureBuildForHermes’.

A problem occurred starting process ‘command ‘cmake’’

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. ============================================================================== `

Any Updates?

I got same problem but if fixed that wit install libicu-dev my os is mint 20.3 ubuntu base 20.04

sudo apt -y libicu-dev

and the problem is solved

Good day folks @JoseLion said he was able to reproduce the error and fix the issue check out the link below to see how he did it https://github.com/facebook/react-native/issues/34116. special thanks to @JoseLion, @wfern and @cortinico for their time and effort to help reproduce and fix this issue.

Yes we are

when i set the hermesCommand variable and run bundleRelease i get the following error :ReactAndroid:hermes-engine:buildCMakeMinSizeRel[arm64-v8a][libhermes] FAILED C/C++: ninja: error: ‘C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/MinSizeRel/hermesc.exe’, needed by ‘lib/InternalBytecode/InternalBytecode.hbc’, missing and no known rule to make it

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ‘:ReactAndroid:hermes-engine:buildCMakeMinSizeRel[arm64-v8a][libhermes]’.

Build command failed. Error while executing process C:\Users\alade\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine.cxx\MinSizeRel\615g326p\arm64-v8a libhermes} ninja: Entering directory `C:\Users\alade\Desktop\Cliqueon\node_modules\react-native\ReactAndroid\hermes-engine.cxx\MinSizeRel\615g326p\arm64-v8a’

ninja: error: ‘C:/Users/alade/Desktop/Cliqueon/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/MinSizeRel/hermesc.exe’, needed by ‘lib/InternalBytecode/InternalBytecode.hbc’, missing and no known rule to make it

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

i also noticed the error below: LLVM_HOST_TRIPLE can’t be computed on Windows with this toolchain