-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Cannot build from source on Android on Windows, CMake reporting "broken" compiler. #37770
Comments
|
Still an issue on 0.71.10, I'll edit the issue with the new RN version; everything previously mentioned in the report still applies. |
Please open a new PR with the same code and we can look into it/get it merged. As for the build from source on Windows, that's sadly more complicated that expected as most of our builds are on MacOS or Linux. We would need someone from Microsoft to take a look at this ideally. |
I've added a bit more info to this in the duplicate issue mentioned above: #37780 (comment) Additionally, I've undone the initial commit that was done by @mganandraj, so we don't use nmake when building from Windows, but then this leads me to the error that this guy is getting here: software-mansion/react-native-reanimated#3594 (comment) Different repo, but it's still an error that's produced by trying to build the hermes error from source on a Windows machine. As additional info, I do not have the As stated in the other issue ticket, the ideal scenario would be to get mganandraj in on this issue, so we can see how Windows is building RN on his machine. I've gone into the CMake cache file within the downloaded copy of
|
Hi @MO-Lewis .. We regularly build react native from source on Windows. The key is to have a visual studio installation with Native/C++ build tools included (Even free community edition should work) and run gradle from the visual studio developer command prompt. Many people faced problems because of file path length limitations on Windows which required some configuration and reducing the root directory paths. Specifically on the usage of Nmake: NMake is slow and old, and we want to avoid using it. But unfortunately, ninja don't yet support long file paths on windows. Ref. ninja-build/ninja#1900. |
Thanks for the reply @mganandraj! You can see the exact Visual Studio modules I have installed on my machine in the original post. If there's anything in there that looks like it's missing / conflicting, it'd be much appreciated if you could let me know! I tried to use However...I ran it again earlier to double-check the error produced, and it did appear to build with no issues on a boilerplate React project! I'm not sure what I was doing differently earlier this week, perhaps I messed up some environment variables around the same time, but it does appear to work with no issue now! So this means that building from source on Windows is NOT impossible or broken, but there ARE additional, undocumented requirements. I would definitely recommend that there should be some extra Windows-specific info in the build from source page, which states that the Windows user must:
Once again, a huge thanks to you both for helping me with this issue over the last few days |
Just an update on this from what I found at the end of Friday. Whilst I was able to get this working on a boilerplate React Native project, I was unable to get it working on our actual client project. React Native versions are the same, other package versions are the same, etc. Our actual client project is giving me the "x86/cl.exe - broken" error. Really not sure what the error could be in this case. I'll leave the issue open, as most people who have trouble building for Windows will likely end up seeing this issue (and can hopefully contribute a solution 😅) |
To make all the pieces work together on Windows appear to be switching from ANSI to Unicode API calls - the *A to *W and switched to clang-cl.exe from cl.exe |
Summary: Added code previously added in the following PR: #28659. The above PR was accidentally scrapped due to the renaming of the master branch on the React Native repo. As advised in this comment: #37770 (comment), I'm opening a new PR with the same code to get this merged into master / main. Currently, we need to run a local fork of React Native and manually apply these changes ourselves. This then causes additional issues, as it's currently _**impossible**_ to build React Native from source when running on a Windows machine, as evidenced in #37770 and the other linked issues nested inside of this issue. **Original summary is as follows:** With `NetworkModule.setCustomClientBuilder` we can customize our OkHttpClient to all requests made by react-native, it's very useful when you do `SSL Pinning` or change some OkHttpClient configuration at all. I've added a similar function to websocket, it allow us do some configurations on Websocket OkHttpClient. ## Changelog: [Android] [Added] - Websocket Module setCustomClientBuilder <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: #37798 Test Plan: **From the original PR:** You can just set a custom `CustomClientBuilder` on `MainActivity` `onCreate`: ``` import okhttp3.OkHttpClient; import java.util.concurrent.TimeUnit; import com.facebook.react.modules.network.CustomClientBuilder; import com.facebook.react.modules.websocket.WebsocketModule; public class MainActivity extends ReactFragmentActivity { Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RNBootSplash.init(R.drawable.launch_screen, MainActivity.this); WebsocketModule.setCustomClientBuilder(new CustomClientBuilder() { Override public void apply(OkHttpClient.Builder builder) { builder.connectTimeout(0, TimeUnit.MILLISECONDS); } }); } ... ``` Reviewed By: cortinico Differential Revision: D47468613 Pulled By: javache fbshipit-source-id: ad97fb18ba5784d8abe157f5ccd29201b8b0fe84
Summary: Added code previously added in the following PR: facebook#28659. The above PR was accidentally scrapped due to the renaming of the master branch on the React Native repo. As advised in this comment: facebook#37770 (comment), I'm opening a new PR with the same code to get this merged into master / main. Currently, we need to run a local fork of React Native and manually apply these changes ourselves. This then causes additional issues, as it's currently _**impossible**_ to build React Native from source when running on a Windows machine, as evidenced in facebook#37770 and the other linked issues nested inside of this issue. **Original summary is as follows:** With `NetworkModule.setCustomClientBuilder` we can customize our OkHttpClient to all requests made by react-native, it's very useful when you do `SSL Pinning` or change some OkHttpClient configuration at all. I've added a similar function to websocket, it allow us do some configurations on Websocket OkHttpClient. ## Changelog: [Android] [Added] - Websocket Module setCustomClientBuilder <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: facebook#37798 Test Plan: **From the original PR:** You can just set a custom `CustomClientBuilder` on `MainActivity` `onCreate`: ``` import okhttp3.OkHttpClient; import java.util.concurrent.TimeUnit; import com.facebook.react.modules.network.CustomClientBuilder; import com.facebook.react.modules.websocket.WebsocketModule; public class MainActivity extends ReactFragmentActivity { Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RNBootSplash.init(R.drawable.launch_screen, MainActivity.this); WebsocketModule.setCustomClientBuilder(new CustomClientBuilder() { Override public void apply(OkHttpClient.Builder builder) { builder.connectTimeout(0, TimeUnit.MILLISECONDS); } }); } ... ``` Reviewed By: cortinico Differential Revision: D47468613 Pulled By: javache fbshipit-source-id: ad97fb18ba5784d8abe157f5ccd29201b8b0fe84
yarn run v1.22.19$ npx react-native run-android --variant=experimentalPlayDebug After running Rocket.Chat.ReactNative [(https://github.com/RocketChat/Rocket.Chat.ReactNative.git)] by cloning the git repo, It is occuring at the time of EXECUTING..... |
I'm getting same issue in macos M1 chip. |
@MO-Lewis Then , I change to use It's look like my project or react-native in my project use x86 .conflict with my window11 system x64 ? But I still finding how to solve the problem. If you know how to resolve the problem, can you let me know. Thank you . |
Summary: Added code previously added in the following PR: facebook#28659. The above PR was accidentally scrapped due to the renaming of the master branch on the React Native repo. As advised in this comment: facebook#37770 (comment), I'm opening a new PR with the same code to get this merged into master / main. Currently, we need to run a local fork of React Native and manually apply these changes ourselves. This then causes additional issues, as it's currently _**impossible**_ to build React Native from source when running on a Windows machine, as evidenced in facebook#37770 and the other linked issues nested inside of this issue. **Original summary is as follows:** With `NetworkModule.setCustomClientBuilder` we can customize our OkHttpClient to all requests made by react-native, it's very useful when you do `SSL Pinning` or change some OkHttpClient configuration at all. I've added a similar function to websocket, it allow us do some configurations on Websocket OkHttpClient. [Android] [Added] - Websocket Module setCustomClientBuilder <!-- Help reviewers and the release process by writing your own changelog entry. Pick one each for the category and type tags: [ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message For more details, see: https://reactnative.dev/contributing/changelogs-in-pull-requests Pull Request resolved: facebook#37798 Test Plan: **From the original PR:** You can just set a custom `CustomClientBuilder` on `MainActivity` `onCreate`: ``` import okhttp3.OkHttpClient; import java.util.concurrent.TimeUnit; import com.facebook.react.modules.network.CustomClientBuilder; import com.facebook.react.modules.websocket.WebsocketModule; public class MainActivity extends ReactFragmentActivity { Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); RNBootSplash.init(R.drawable.launch_screen, MainActivity.this); WebsocketModule.setCustomClientBuilder(new CustomClientBuilder() { Override public void apply(OkHttpClient.Builder builder) { builder.connectTimeout(0, TimeUnit.MILLISECONDS); } }); } ... ``` Reviewed By: cortinico Differential Revision: D47468613 Pulled By: javache fbshipit-source-id: ad97fb18ba5784d8abe157f5ccd29201b8b0fe84
Description
Hi there,
For a project, we need to build React Native from source. This is required for us, as we need to apply the following fix to React Native, which was approved to merge into the main React Native repo, but was never merged due to React Native renaming the branch and accidentally scrapping the PR: #28659 (comment)
If the above issue could be picked up again and merged-in to the main repo (it was fully approved and ready to merge before the branch rename!), that would also be much appreciated!
I'm running on Windows 10 (Version 10.0.19045 Build 19045), and I'm having some difficulties trying to build a boilerplate React Native project, whilst building React Native from source. I've followed the steps described here: https://reactnative.dev/contributing/how-to-build-from-source
Due to running on Windows, I am unable to see if the issue also happens when running an iOS build.
However, when trying to run the Android build, I get an error from cmake at the
:react-native:ReactAndroid:hermes-engine:configureBuildForHermes
stage.I'll provide the FULL command line output below.
If I undo the steps provided in the "build from source" link (Removing the extra lines from
android/settings.gradle
), then the build works, so I'm fairly sure something's going wrong when building from source for me. I'll provide images of my Android Studio settings (NDK, SDK, Build tool versions, etc.) below too.If there's any other information you'd like from me / my environment, please let me know. Thanks!
React Native Version
0.71.8Updated to
0.71.10
Output of
npx react-native info
Steps to reproduce
npx react-native init AwesomeProject
)npm install
, etc.android/settings.gradle
file, as required here: https://reactnative.dev/contributing/how-to-build-from-sourceandroid/
directory and rungradlew clean
. Go up one level and reinstall yournode_modules
to ensure everything is fresh.npm run android
:react-native:ReactAndroid:hermes-engine:configureBuildForHermes
stage, with a CMake error.Snack, code example, screenshot, or link to a repository
Steps to reproduce the issue on a blank project are linked above.
Full command line output from
npm run android
:Installed Android Studio Tools:
Installed Visual Studio Tools:
The text was updated successfully, but these errors were encountered: