Skip to content

Fix building Hermes from source on Windows failing on the JSI_DIR path - #59024

Open
YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/android-hermes-jsi-dir-cmake-path
Open

YevheniiKotyrlo wants to merge 1 commit into
react:mainfrom
YevheniiKotyrlo:fix/android-hermes-jsi-dir-cmake-path

Conversation

@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor

Summary:

Building Hermes from source on Windows fails in hermes-engine:configureBuildForHermes, also inside the Visual Studio developer environment its NMake generator needs (reported in #37770):

CMake Error at cmake/modules/Hermes.cmake:160 (add_executable):
  Syntax error in cmake code when parsing string

    C:\work\contributions\react-native\packages\react-native\ReactCommon\jsi/jsi/test/testlib.cpp

  Invalid character escape '\w'.

hermes-engine/build.gradle.kts passes -DJSI_DIR as a native Windows path, and CMake reads its backslashes as escape sequences. This passes the path with forward slashes at both -DJSI_DIR sites, the host hermesc configure and the Android externalNativeBuild. On macOS and Linux the path is unchanged.

Changelog:

[ANDROID] [FIXED] - Fix building Hermes from source on Windows failing on the JSI_DIR path

Test Plan:

On Windows 11, inside the Visual Studio developer environment, with -Preact.internal.useHermesNightly=false so that Hermes builds from source:

  • gradlew :packages:react-native:ReactAndroid:hermes-engine:buildHermesC: on main it fails with the error above; with this change it builds hermesc.exe.
  • gradlew :packages:react-native:ReactAndroid:hermes-engine:assembleDebug -PreactNativeArchitectures=x86_64: with only the host site changed, configureCMakeRelease[x86_64] fails with the same error; with both, the AAR builds with jni/x86_64/libhermesvm.so.

hermes-engine passed -DJSI_DIR as a native Windows path, whose backslashes
CMake reads as escape sequences. Both -DJSI_DIR sites now pass the path with
forward slashes.
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Oct 13, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Oct 13, 2026

@cipolleschi cipolleschi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for fixing this.

@meta-codesync

meta-codesync Bot commented Oct 13, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D124993090.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants