Skip to content

Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE - #35857

Closed
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D42544864
Closed

Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE#35857
cortinico wants to merge 1 commit into
react:mainfrom
cortinico:export-D42544864

Conversation

@cortinico

@cortinicocortinico commented Jan 17, 2023

Copy link
Copy Markdown
Contributor

Summary:
It seems like there is an incompatibility between NDK 23 (shipped in 0.71)
and the usage of custom CMAKE_BUILD_TYPE we do for Hermes.

Specifically the -DCMAKE_BUILD_TYPE=Release we specify for the debug
variant of Hermes is partially ignored by the new Android native build toolchain.
See android/ndk#463 for mentions on how the
toolchains requires CMake 3.20+

As AGP 7.3 defaults to use CMake 3.18 unless specified, and NDK 23 unless specified.
AGP 7.4 defaults to use CMake 3.22 unless specified, and NDK 23 unless specified.
See: https://developer.android.com/studio/releases/gradle-plugin#7-4-0

Here I'm:

  1. Bumping the docker image to an image that contains the CMake 3.22
  2. Updating the logic for building react-native & hermes-engine to use 3.22
  3. Provide fallbacks if the user specified CMAKE_VERSION

Template tests will run on AGP 7.3 and will still use CMake 3.18, but I forecast
no problem there as the user is not supposed to specify custom CMAKE_BUILD_TYPE.
This is only a problem as we build hermes-engine with custom build types.

Changelog:
[Android] [Fixed] - Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE

Differential Revision: D42544864

Fixes#35828

@facebook-github-botfacebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner fb-exported labels Jan 17, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42544864

@github-actions

github-actionsBot commented Jan 17, 2023

Copy link
Copy Markdown
Warnings
⚠️🔒 package.json - Changes were made to package.json. This will require a manual import by a Facebook employee.

Generated by 🚫 dangerJS against 47082f0

@cortinico

Copy link
Copy Markdown
ContributorAuthor

Currently blocked by react-native-community/docker-android#192 + subsequent bump of the Docker container

Comment threadpackage.json Outdated
@analysis-bot

analysis-bot commented Jan 18, 2023

Copy link
Copy Markdown
PlatformEngineArchSize (bytes)Diff
androidhermesarm64-v8a8,465,416-41
androidhermesarmeabi-v7a7,785,948-122
androidhermesx868,938,528-480
androidhermesx86_648,796,959-19
androidjscarm64-v8a9,650,646-8
androidjscarmeabi-v7a8,385,092-37
androidjscx869,712,865+18
androidjscx86_6410,190,008-23

Base commit: 60b9d8c
Branch: main

Summary:
Pull Request resolved: react#35857
It seems like there is an incompatibility between NDK 23 (shipped in 0.71)
and the usage of custom `CMAKE_BUILD_TYPE` we do for Hermes.
Specifically the `-DCMAKE_BUILD_TYPE=Release` we specify for the debug
variant of Hermes is partially ignored by the new Android native build toolchain.
See android/ndk#463 for mentions on how the
toolchains requires CMake 3.20+
As AGP 7.3 defaults to use CMake 3.18 unless specified, and NDK 23 unless specified.
AGP 7.4 defaults to use CMake 3.22 unless specified, and NDK 23 unless specified.
See: https://developer.android.com/studio/releases/gradle-plugin#7-4-0
Here I'm:
1. Bumping the docker image to an image that contains the CMake 3.22
2. Updating the logic for building `react-native` & `hermes-engine` to use 3.22
3. Provide fallbacks if the user specified `CMAKE_VERSION`
Template tests will run on AGP 7.3 and will still use CMake 3.18, but I forecast
no problem there as the user is not supposed to specify custom `CMAKE_BUILD_TYPE`.
This is only a problem as we build `hermes-engine` with custom build types.
Changelog:
[Android] [Fixed] - Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE
Reviewed By: cipolleschi
Differential Revision: D42544864
fbshipit-source-id: d9840b4a14baabf5d20d21d71cc86e2e73a8d0ea
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request was exported from Phabricator. Differential Revision: D42544864

@facebook-github-botfacebook-github-bot added the Merged This PR has been merged. label Jan 18, 2023
@facebook-github-bot

Copy link
Copy Markdown
Contributor

This pull request has been merged in 477f546.

kelset pushed a commit that referenced this pull request Jan 19, 2023
Summary:
Pull Request resolved: #35857
It seems like there is an incompatibility between NDK 23 (shipped in 0.71)
and the usage of custom `CMAKE_BUILD_TYPE` we do for Hermes.
Specifically the `-DCMAKE_BUILD_TYPE=Release` we specify for the debug
variant of Hermes is partially ignored by the new Android native build toolchain.
See android/ndk#463 for mentions on how the
toolchains requires CMake 3.20+
As AGP 7.3 defaults to use CMake 3.18 unless specified, and NDK 23 unless specified.
AGP 7.4 defaults to use CMake 3.22 unless specified, and NDK 23 unless specified.
See: https://developer.android.com/studio/releases/gradle-plugin#7-4-0
Here I'm:
1. Bumping the docker image to an image that contains the CMake 3.22
2. Updating the logic for building `react-native` & `hermes-engine` to use 3.22
3. Provide fallbacks if the user specified `CMAKE_VERSION`
Template tests will run on AGP 7.3 and will still use CMake 3.18, but I forecast
no problem there as the user is not supposed to specify custom `CMAKE_BUILD_TYPE`.
This is only a problem as we build `hermes-engine` with custom build types.
Changelog:
[Android] [Fixed] - Bump CMake to 3.22.1 to properly honor CMAKE_BUILD_TYPE
Reviewed By: cipolleschi
Differential Revision: D42544864
fbshipit-source-id: efd0f51120370fb808337c201df31d71f4ddfdbc
@cipolleschicipolleschi mentioned this pull request Oct 11, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

BugCLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.fb-exportedMergedThis PR has been merged.p: FacebookPartner: FacebookPartnerPlatform: AndroidAndroid applications.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrading from v0.70.6 to v0.71.0 causing extremely slow debugging mode on Android

5 participants

@cortinico@facebook-github-bot@analysis-bot@kelset@react-native-bot