react-native icon indicating copy to clipboard operation
react-native copied to clipboard

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

Open aleluiah opened this issue 1 year ago • 82 comments

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

aleluiah avatar Jun 27 '22 19:06 aleluiah

Using the New Architecture with Hermes on Windows is quite challenging at this stage. Could you follow the instructions here: https://reactnative.dev/architecture/bundled-hermes#android-users-on-new-architecture-building-on-windows and confirm if it solves your issue?

cortinico avatar Jun 27 '22 19:06 cortinico

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.

K-Leon avatar Jun 28 '22 09:06 K-Leon

exactly the same issue am facing visual studio developer command prompt also failed after carefully following the linked instruction

aleluiah avatar Jun 28 '22 20:06 aleluiah

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.

nibblesnbits avatar Jun 29 '22 07:06 nibblesnbits

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?

cortinico avatar Jun 30 '22 14:06 cortinico

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%7C01%7C%7C387ec99b87594a8320c008da5aa800b7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637921974854590259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&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%7C01%7C%7C387ec99b87594a8320c008da5aa800b7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637921974854590259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&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%7C01%7C%7C387ec99b87594a8320c008da5aa800b7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637921974854590259%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CLDLZcrKpJDSTKG0tAihbz5wNl9i0k8UB1yOfD1aFPk%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.***>

nibblesnbits avatar Jun 30 '22 15:06 nibblesnbits

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.

RominHalltari avatar Jun 30 '22 17:06 RominHalltari

Still broken with 0.69.1, and did notice this output:

-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.22000.
-- 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")
Using Windows 10 built-in ICU
-- 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: D:/git/random/MyApp/node_modules/react-native/ReactAndroid/hermes-engine/build/hermes

Not sure if it's relevant as the Debug\hermesc.exe does still get built.

nibblesnbits avatar Jul 03 '22 04:07 nibblesnbits

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

aleluiah avatar Jul 05 '22 01:07 aleluiah

I'm not able to reproduce still. Just as a sanity check: you folks installed Visual Studio 22 Community Edition and are running inside a Visual Studio console right?

cortinico avatar Jul 05 '22 15:07 cortinico

Yes we are

K-Leon avatar Jul 05 '22 17:07 K-Leon

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.

aleluiah avatar Jul 07 '22 17:07 aleluiah

Followed the android/windows instructions, added the hermesCommand line, and using the PR by @JoseLion and I still get this error:

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

  ninja: error: 'C:/Users/jslok/Projects/rn691/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

jslok avatar Jul 07 '22 21:07 jslok

@jslok you do not need to add the hermesCommand line. clean your build or create a fresh project and use the pr

aleluiah avatar Jul 09 '22 00:07 aleluiah

@aleluiah I get the same error without hermesCommand line. Using a fresh install with the pr.

jslok avatar Jul 09 '22 00:07 jslok

@jslok modified your node modules react-native react.gradle file directly. the downside to this approach is that the changes won't persist in your react.gradle file but at least you would be able to build successfully. replace the following code in your node modules/reaact-native/react.gradle with the code below : / 3. If the react-native contains a pre-built hermesc, use it. def hermescBin = Os.isFamily(Os.FAMILY_WINDOWS) ? 'hermesc.exe' : 'hermesc' def prebuiltHermesPath = ("node_modules/react-native/sdks/hermesc/%OS-BIN%/" + hermescBin) .replaceAll("%OS-BIN%", getHermesOSBin()) .replace('/' as char, File.separatorChar); Make sure to init your project in the windows c: directory to shorten the path as much as possible. also please don't forget to run your build in a visual studio power shell command prompt

aleluiah avatar Jul 09 '22 08:07 aleluiah

That seems to be the same as using the pr from @JoseLion, no? I tried it both ways and no dice. Also reinstalled VS 2022 CE with C++ and build tools and using vs command prompt.

jslok avatar Jul 09 '22 21:07 jslok

Based on the error message (which is very similar to what we were getting in #34116), it seems that the hermesc.exe path is incorrect when hermes-engine is built from source.

The message says the file ...hermes-engine/build/hermes/bin/Release/hermesc.exe is missing, and I think it's because the path in react.gradle is actually ...hermes-engine/build/hermes/bin/hermesc.exe. I can make the change in the opened PR if someone can confirm changing the path works since I'm currently not using the new architecture 😅

To give it a try, use the changes in PR #34151 and modify react.gradle to change the definition of the builtHermesc variable to the following:

def builtHermesc = hermesOverrideDir
  ? new File(hermesOverrideDir, "build/bin/Release/$hermescBin")
  : new File(reactRoot, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/Release/$hermescBin")

Note the additional /Release/ in the paths

I hope this helps 🙂

PS: We also might need to determine the type of build (Release or Debug I think) to build the path correctly in each case. But we can figure it out once we know the change is corrrect 🤔

cc. @cortinico

JoseLion avatar Jul 11 '22 07:07 JoseLion

@JoseLion Still getting the error with that change.

May be worth mentioning when using --variant=release I get a different but similar error:

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

  ninja: error: 'C:/rn69/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

Thus I tried using /MinSizeRel/ instead of /Release/ and still no success.

jslok avatar Jul 11 '22 08:07 jslok

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 avatar Jul 11 '22 10:07 MuhammadRafeh

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

truediogo avatar Jul 11 '22 16:07 truediogo

@truediogo thanks a lot. Yes, I am using Ubuntu. Let me try this. Hopefully it will work ❤️

MuhammadRafeh avatar Jul 11 '22 16:07 MuhammadRafeh

But now ended with the same exact problem. 😂

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

MuhammadRafeh avatar Jul 11 '22 18:07 MuhammadRafeh

@jslok sorry to hear the proposed fix didn't work. I think it is because your first error was on :hermes-engine:buildCMakeRelease task and the second one in :hermes-engine:buildCMakeMinSizeRel task, so it seems we actually need to use the correct variant to build the path. I think I know how we can do this, but it requires a few changes. I'll guide you so you can give it a try if you like 🙂

Again, using the changes in PR #34151 modify react.gradle in the following lines:

Line 92

- def getHermesCommand = {
+ def getHermesCommand(targetName) {

Lines 111 - 113

def builtHermesc = hermesOverrideDir ?
-    new File(hermesOverrideDir, "build/bin/$hermescBin") :
+    new File(hermesOverrideDir, "build/bin/$targetName/$hermescBin") :
-    new File(reactRoot, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/$hermescBin")
+    new File(reactRoot, "node_modules/react-native/ReactAndroid/hermes-engine/build/hermes/bin/$targetName/$hermescBin")

Lines 288 - 291

if (Os.isFamily(Os.FAMILY_WINDOWS)) {
-    commandLine("cmd", "/c", getHermesCommand(), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
+    commandLine("cmd", "/c", getHermesCommand(targetName), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
} else {
-    commandLine(getHermesCommand(), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
+    commandLine(getHermesCommand(targetName), "-emit-binary", "-out", hbcTempFile, jsBundleFile, *hermesFlags)
}

That's it! I hope that solves it.

Let me know how it goes, I'll be happy to add the change to open PR or create a new one 🙂

JoseLion avatar Jul 11 '22 19:07 JoseLion

@JoseLion Just tried the latest changes and still no luck. Same error. After some further digging it appears the getHermesCommand function is not getting called at all. It appears the whole doLast task on ln 283 is not getting run.

jslok avatar Jul 12 '22 00:07 jslok

I am also facing exactly the same issue.

gunjantaazaa avatar Jul 12 '22 18:07 gunjantaazaa

Any Updates?

MuhammadRafeh avatar Jul 13 '22 07:07 MuhammadRafeh

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

Do you happen to know how to install icu4c for Windows? I have tried downloading the library from their site and copying the files into C:\Windows but it did not work.

ws8149 avatar Jul 13 '22 08:07 ws8149

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

Do you happen to know how to install icu4c for Windows? I have tried downloading the library from their site and copying the files into C:\Windows but it did not work.

You need also to add ICU binaries into system environment variables https://unicode-org.github.io/icu/userguide/icu4c/#windows-platform

truediogo avatar Jul 14 '22 10:07 truediogo

Hi, I'm having trouble building my project with the new architecture on windows too. During the compiling process it says that it's using Windows 10 ICU. It's failing after the Cmake of hermes and the other components so I think this part is ok, do you really need the extra ICU libs for the other steps of the build process?

Edit: Just noticed this warning..

Failed to find all ICU components (missing: ICU_INCLUDE_DIR _ICU_REQUIRED_LIBS_FOUND) (Required is at least version "52")

So I think it's missing some of the components needed to build properly.

Edit2: Followed the procedure mentioned by @truediogo and now I have the following

-- Found the following ICU libraries: -- uc (required) -- i18n (required) -- data (required) -- uc (required) -- Found ICU: D:/icu/32/include (found suitable version "71.1", minimum required is "52")

But it still saying other header files are missing.

-- Looking for dlfcn.h -- Looking for dlfcn.h - not found -- Looking for errno.h -- Looking for errno.h - found -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for link.h -- Looking for link.h - not found -- Looking for malloc.h -- Looking for malloc.h - found -- Looking for malloc/malloc.h -- Looking for malloc/malloc.h - not found [...]

Edit3: Just built a clean project using default template from react-native init. If I use --active-arch-only everything is smooth and flawless.. I didn't changed anything at all. PS: The warnings mentioned above still present, but the project is building fine.

But this problem occurs when building for all the architectures.

Task :ReactAndroid:configureCMakeDebug[armeabi-v7a] C/C++: debug|armeabi-v7a :CMake Warning in E:/projetos/reactnice/node_modules/react-native/ReactCommon/react/renderer/components/progressbar/CMakeLists.txt: C/C++: debug|armeabi-v7a : The object file directory C/C++: debug|armeabi-v7a : E:/projetos/reactnice/node_modules/react-native/ReactAndroid/.cxx/Debug/483m38n2/armeabi-v7a/ReactCommon/react/renderer/components/progressbar/CMakeFiles/rrc_progressbar.dir/./ C/C++: debug|armeabi-v7a : has 176 characters. The maximum full path to an object file is 250 C/C++: debug|armeabi-v7a : characters (see CMAKE_OBJECT_PATH_MAX). Object file C/C++: debug|armeabi-v7a : android/react/renderer/components/progressbar/AndroidProgressBarMeasurementsManager.cpp.o C/C++: debug|armeabi-v7a : cannot be safely placed under this directory. The build may not work C/C++: debug|armeabi-v7a : correctly. Task :ReactAndroid:buildCMakeDebug[armeabi-v7a][fabricjni,hermes-executor-debug,etc] FAILED

I noticed the warnings about max pull path length. Dunno if this is what's causing the problems.

On the other project I'm trying to upgrade to the new architecture I can't build even using the flag for just the active architecture. So there's maybe something missing in the NDK/configuration process there.

Skullcan avatar Jul 14 '22 10:07 Skullcan