-
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
Windows: Error: unable to open output file when enabling the new architecture #33528
Comments
The same happens for me too. The same app builds on a Mac (for android ofc) without problems, but on Windows the |
Hello @ralppppy @slaci , Could you confirm whether the long file paths are enabled on your Windows box ? The paths in log are extremely long. for example this path is 307 characters which is more that default maximum: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.o Long file paths are not enabled by default on Windows yet |
Hi @mganandraj I've enabled the long path, it actually changed something but I still get an error. `BUILD FAILED in 4m 6s error Failed to install the app. Make sure you have the Android development environment set up: https://reactnative.dev/docs/environment-setup. FAILURE: Build failed with an exception.
dules\react-native\ReactAndroid\build\intermediates\cxx\Debug\351u4r48/obj/local/armeabi-v7a/objs-debug/reactperflogger/D_/TestnewArc/node_modules/react-native/ReactAndroid/__/ReactCommon/reactperflogger/reactperflogger/BridgeNativeModulePerfLogger.o: No such file or directory
|
The
The file exists, I can I tried to switch the Edit: Well after some tries, now |
The same. ReactAndroid does not support compiling on windows for a long time. The old architecture has bean packed into AAR, so it works well, but the new one needs you to compile native libs and it seems that something problem on windows |
@mrtaiw You can try Linux, there is no problem on Archlinux, Ubuntu. I didn't test other distributions |
Well, with the old architecture it is possible to work on Windows (even |
This comment was marked as spam.
This comment was marked as spam.
Got this error too... It's so much difficulties to try the new arch. And there seem to be no template or demo can pass gradle build on Windows. |
same problem here |
maybe someone could upload a new arch pre-build so that we could avoid this issue? |
hey folks - just to give you a quick update, I've reported this internally at Microsoft and a couple of engineers have been looking into it. We think we have found the commit that "broke" this and we are looking into ways of fixing this, by end of the week we should have some options on the table - the aim is for this to be fixed in 0.68.1 |
It's good to hear that. Thank you very much. This is going to make me mad. |
Thanks for looking into this @kelset Not having a Windows machine on my end makes really hard to reproduce and fix this. |
man , getting this exact thing on windows 11, sucks! |
Hi @cortinico @kelset .. I've a draft PR, not a generic fix, but may unblock people if the root project is short .. https://github.com/facebook/react-native/pull/33582/files Somehow NDK AR can't handle long paths even after enabling long paths in Windows! We will continue looking for better fix. And more importantly, we should have a fix for the CMake command in main branch. I think NDK_APP_SHORT_COMMANDS is not available in CMake scripts. |
I am also getting the same error. This is the result of npx react-native info: System: |
According to @mganandraj It seems like that a bump to NDK 23 would fix this issue. I'm looking for someone with a windows machine that is willing to test this |
No, it didn't work as expected on my computer. Same error like before. |
Well, build in cli with version 0.68.1 on windows is ok. But still fail while open android folder and build using idea 2021.3. |
@cortinico & @mganandraj - a long time ago @alespergl submitted this PR: #30248 that potentially also help addressing this category of issues on windows? Maybe it'd be worth to giving it a second look (looks like back in Oct '20 it went a bit under the radar) and potentially merge |
@slaci, @ralppppy, @nawbc, @zxcvbnm3057, @RalissonMattias, @kios19, @lucasraziel - with the help of @alespergl's PR and @mganandraj there's now a new PR up against the 0.68 branch: #33707 with a better fix approach. Given that now we have the commitlies route that we can take (see more https://reactnative.dev/blog/2021/10/01/version-066#using-commitly-releases-commitlies) could you all try to download this artifact ( and swap it into your project? it's basically just 0.68.1 plus the patch the PR adds
doing so should allow you to test this new fix - and if it works correctly we can merge it into 0.68 and do a new patch release :) |
I have a similar error with @RalissonMattias |
@RalissonMattias @ralppppy so just to be clear, you have made a new react-native project via the In the screenshot I can't really see any error messages though, it seems just a series of paths. Can you copy/paste the actual errors that you are hitting? |
@kelset I did exactly the steps I asked. I think this might help you to see the problem |
Hi .. could you try with a shorter application path.. In the logs shared, the host application path itself is about ~50 chars.. The current fix is reducing the obj file path lengths.. all the headers and so files still carry absolute paths. And we are still using ndk21 which uses binutils with file path length limits (ndk 23 which can work with long paths crashes on windows which im still investigating) .. hence host application path still matters.. and it should be ~10 chars most at this stage, until we can get ndk22+ working.. |
And, from the logs, it looks we didn't fix react/renderer/scheduler/Android.mk |
@mganandraj I can try to generate directly in |
Also, please note that this doesn't have out latest fixes applied.. for eg. The command line uses ndk23, and the object file path includes absolute path ! |
I've created a project in C drive, and follow the steps above, this was the error. `FAILURE: Build failed with an exception.
error: unable to open output file 'C:\MyTestApp\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\1vy1o4e5/obj/local/armeabi-v7a/objs-debug/react_codegen_rncore/C_/MyTestApp/node_modules/react-native/ReactAndroid/build/generated/source/codegen/jni/react/renderer/components/rncore/EventEmitters.o': 'No such file or directory' |
I have an upgraded app only, but I think it may be relevant What I'm trying after applying 0.68.1 changes (in powershell throught vscode): npm add .\react-native-1000.0.0-4da73985e.tgz
rm -r -fo android/app/build
cd android
./gradlew clean NDK 23 fails early at
NDK 21 goes throught
|
ok I think we have found out why the fix is not working as expected, the problem is that a part of it lives in the |
Just a heads up: we're working a 0.68.2 which will (hopefully) fix the build failures on Windows |
For me |
Yes same with me, and also |
yeah I think that's something that is expected, and that's why there are guides to migrate libs to the new arch on the website: https://reactnative.dev/docs/new-architecture-library-intro I think that the next best thing to do is to make the libraries aware that they don't work with the new arch by creating issues on their repos (unless they exist already) - or, even better, make PRs directly to add new arch support :) |
@kelset react-native-screens works with the new architecture (at least they claim), just not on Windows. I guess they have the same problem which was investigated here (long paths). Not sure how was this solved in |
thanks @slaci, great info - @mganandraj @cortinico what do you think? Will libraries need to do something similar to the fix we applied in 0.68? |
It depends on the amount of C++ code the library is exposing. If the external library is just using the Codegen + exposing JS/Android/iOS code, they'll get the patch for free. If the library is exposing an As a side note: we're moving to having CMake files instead of |
enabling new arch and running yarn android gives the following:
|
Closing as this issue has been essentially resolved (building with New Arch on Windows). @ramiel1999 please submit a new issue with reproducer |
Hi, I am still getting same error with RN version 0.68.2 when New architecture is enabled. |
Description
I've installed the new version
0.68
then enable the new architecture and try to runnpx react-native run-android
and it doesn't build. I believe that it is because the path has front and backlashes.`BUILD FAILED in 3m 21s
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
Note: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native-gradle-plugin\src\main\java\com\facebook\react\codegen\generator\SchemaJsonParser.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
Execution failed for task ':ReactAndroid:buildNdkBuildDebug'.
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/OnLoad.o] Error 1
make: *** Waiting for unfinished jobs....
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/AsyncEventBeatV2.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ReactNativeConfigHolder.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/Binding.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/FabricMountingManager.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/SurfaceHandlerBinding.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/ComponentFactory.o] Error 1
error: unable to open output file 'D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.o': 'No such file or directory'
1 error generated.
make: *** [C:/Users/user/AppData/Local/Android/Sdk/ndk/21.4.7075529/build//../build/core/build-binary.mk:478: D:\PERSONAL\PROGRAMMING\REACTNATIVE\TestnewArc\node_modules\react-native\ReactAndroid\build\intermediates\cxx\Debug\363s2q4f/obj/local/armeabi-v7a/objs-debug/fabricjni/D_/PERSONAL/PROGRAMMING/REACTNATIVE/TestnewArc/node_modules/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/jni/JBackgroundExecutor.o] Error 1
Version
0.68
Output of
npx react-native info
System:
OS: Windows 10 10.0.22000
CPU: (16) x64 AMD Ryzen 7 4800H with Radeon Graphics
Memory: 212.03 MB / 6.68 GB
Binaries:
Node: 14.17.3 - C:\Program Files\nodejs\node.EXE
Yarn: 1.22.10 - ~\AppData\Roaming\npm\yarn.CMD
npm: 7.19.1 - C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK:
API Levels: 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32
Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0, 32.1.0, 33.0.0, 33.0.0
System Images: android-30 | Google APIs Intel x86 Atom, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
Windows SDK: Not Found
IDEs:
Android Studio: Version 2021.1.0.0 AI-211.7628.21.2111.8193401
Visual Studio: Not Found
Languages:
Java: 17.0.2 - C:\Program Files\Common Files\Oracle\Java\javapath\javac.EXE
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.68.0 => 0.68.0
react-native-windows: Not Found
npmGlobalPackages:
react-native: Not Found
Steps to reproduce
newArchEnabled=true
npx react-native run-android
Snack, code example, screenshot, or link to a repository
No response
The text was updated successfully, but these errors were encountered: