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

Execution failed for task ':react-native:ReactAndroid:hermes-engine:configureBuildForHermes'. #37780

Closed
abhishekjmd opened this issue Jun 8, 2023 · 8 comments
Labels

Comments

@abhishekjmd
Copy link

Description

I encountered an error while attempting to build and install the app using the 'yarn android' command. The error message and relevant details are as follows:

-----------------------------------*******************************************************------------------------------------------------------

Error: Command failed: gradlew.bat app:installExperimentalPlayDebug -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.

CMake Error at CMakeLists.txt:64 (project):
Running

'nmake' '-?'

failed with:

The system cannot find the file specified

CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':react-native:ReactAndroid:hermes-engine:configureBuildForHermes'.

Process 'command 'cmd'' finished with non-zero exit value 1

  • 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.

BUILD FAILED in 29m 47s

at makeError (C:\Users\Hp\Desktop\Open Source Projects\Rocket.Chat.ReactNative\node_modules\execa\index.js:174:9)
at C:\Users\Hp\Desktop\Open Source Projects\Rocket.Chat.ReactNative\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\Hp\Desktop\Open Source Projects\Rocket.Chat.ReactNative\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:82:7s:82:7)
at async Command.handleAction (C:\Users\Hp\Desktop\Open Source Projects\Rocket.Chat.ReactNative\ntive\node_modules\@react-native-community\cli\build\index.js:108:9)

info Run CLI with --verbose flag for more details.

-----------------------------------*******************************************************------------------------------------------------------

I have ensured that I have the Android development environment set up following the instructions provided in the React Native documentation. However, the build process encountered the following issues:

Deprecation warning related to policy CMP0026 in CMakeLists.txt.
CMake errors related to 'nmake' and missing compiler settings (CMAKE_C_COMPILER and CMAKE_CXX_COMPILER).
Failure during the task ':react-native:ReactAndroid:hermes-engine:configureBuildForHermes' with a non-zero exit value.
I have tried running the command with additional options such as '--stacktrace', '--info', and '--debug', but the error persists.

I would appreciate any assistance in resolving this build error and successfully installing the app. Thank you for your help.

Operating system: 64-bit operating system, x64-based processor
Node.js version: v18.16.0
Yarn version: 1.22.19
React Native version: 0.71.7

React Native Version

0.71.7

Output of npx react-native info

warn Package react-native-math-view contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the packa
ge maintainers about this.
warn Package react-native-notifications contains invalid configuration: "dependency.assets" is not allowed. Please verify it's properly linked using "react-native config" command and contact the p
ackage maintainers about this.
warn Package rn-fetch-blob contains invalid configuration: "dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintai
ners about this.
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.19045
CPU: (4) x64 Intel(R) Core(TM) i7-4600U CPU @ 2.10GHz
Memory: 753.30 MB / 7.90 GB
Binaries:
Node: 18.16.0 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.19 - ~\AppData\Roaming\npm\yarn.CMD
npm: 9.6.5 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
Android NDK: 22.1.7171670
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
IDEs:
Android Studio: AI-222.4459.24.2221.10121639
Visual Studio: Not Found
Languages:
Java: 11.0.14.1
npmPackages:
@react-native-community/cli: Not Found
react: 18.2.0 => 18.2.0
react-native: 0.71.7 => 0.71.7
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found

Steps to reproduce

I cloned a project https://github.com/RocketChat/Rocket.Chat.ReactNative.git
did yarn install and then yarn android then got this error

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

https://github.com/RocketChat/Rocket.Chat.ReactNative

@github-actions
Copy link

github-actions bot commented Jun 8, 2023

⚠️ Newer Version of React Native is Available!
ℹ️ You are on a supported minor version, but it looks like there's a newer patch available - 0.71.10. Please upgrade to the highest patch for your minor or latest and verify if the issue persists (alternatively, create a new project and repro the issue in it). If it does not repro, please let us know so we can close out this issue. This helps us ensure we are looking at issues that still exist in the most recent releases.

@github-actions github-actions bot added the Platform: Android Android applications. label Jun 8, 2023
@abhishekjmd
Copy link
Author

the issue still exist even after upgrading

@cortinico
Copy link
Contributor

Closing as this is a duplicate of #37770

Are you attempting to do a build from source on Windows (seems like according to those lines)? That's currently not supported. You would have to use a Mac or Linux machine for this.

Also please open the issue on the project you cloned, as they should not be using the build from source (so you can easily build on Windows).

@MO-Lewis
Copy link
Contributor

MO-Lewis commented Jun 9, 2023

Hi there!

Jumping in on this because my ticket was tagged in this one. I know you're using Windows because you're getting the same error I was on Monday.

The reason you're getting an error with nmake is because of this specific commit in the React Native repo: 9d08d55

I don't think this commit was checked properly before merging, as what this fails to note is that you MUST have the location of nmake specified in your Windows PATH environment variables, as well as having MSVC installed via the Visual Studio Installer. This also doesn't work anyway, I'm just telling you how to get to the same stage as me.

Open your Visual Studio installer via the start menu. Make sure you have "MSVC v143 - VS 2022 C++ etc......" installed. You can see what it looks like here:
image

Next, open up your environment variables on Windows (I assume you know how to do this) and in your user variables (NOT your system ones!), highlight the "Path" variable, then click the "Edit..." button.

You should then add the line that points to where the newly-installed nmake.exe is on your system. Your link should look something like this:
C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\MSVC\14.36.32532\bin\Hostx64\x64

Just make sure you swap out 14.36.32532 with whatever version you install on your system; everything else should be the same.

After doing that, you should then get a report that your C / CXX compiler is broken, and that it cannot compile a simple test program.

That's the same error that I'm getting here: #37770

So at least you're at the same stage as I am in all of this.

To Summarize:

  • I've showed you how to remove the nmake error by installing / pointing to it on your environment.
  • There is no known way of proceeding past this point.
  • We need somebody that can build from source on Windows to show us their PATH environment, to see what they have that we don't.

Ideally it'd be great if the guy that made the change to use nmake, @mganandraj, was able to jump in here and prove that he can still build from source on React Native on Windows in the latest version of React Native, as well as show us what his dev environment looks like.

@cortinico
Copy link
Contributor

We need somebody that can build from source on Windows to show us their PATH environment, to see what they have that we don't.

Just to be clear, we are aware that build from source on windows is broken since several years for a number of reasons.

In general, build from source is not recommended for the average user (see here why https://reactnative.dev/contributing/how-to-build-from-source#rationale)

If you build on Windows and disable build from source, everything should work flawlessly, that's where we focus our support. Those commits that you're referencing are specifically aimed at fixing those scenarios.

We are an extremely small team and we all build on MacOS and Linux machines. We're happy to receive a PR that will unblock the situation though.

@MO-Lewis
Copy link
Contributor

MO-Lewis commented Jun 9, 2023

That's fair enough; unfortunately our team needs to build from source due to the reasons mentioned in the PR I've recently created. Fortunately, if that gets merged in, we don't need to worry about building from source at all! :)

It would also be much appreciated if there was some kind of warning on the build from source page which highlights / warns Windows users of the difficulty of a source build on their OS at this current time; would probably help cut down on duplicate tickets too.

Thanks for all your help these last couple of days cortinico!

@cortinico
Copy link
Contributor

It would also be much appreciated if there was some kind of warning on the build from source page which highlights / warns Windows users of the difficulty of a source build on their OS at this current time; would probably help cut down on duplicate tickets too.

Yup we should add a banner on the page that Windows is currently not supported

@MO-Lewis
Copy link
Contributor

MO-Lewis commented Jun 9, 2023

Hi @abhishekjmd, can you confirm that you have the "MSVC VS C++ x64/86 Build Tools" installed via Visual Studio for me please? You can double-check this via the Visual Studio installer, making sure you have the module installed that I have circled in red above this post.

If you do have this installed, could you check that you have the "Developer Command Prompt for VS 2022" command line via your Start Menu?

If you have it, please run it as administrator, and cd into the root of your React Project. Then, please run your usual build command, e.g. npm run android. Please let me know if you get a different error / the build works!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants