fabOnReact / react-native-notes

MIT License
0 stars 0 forks source link

Issues with reactnative build from source #10

Closed fabOnReact closed 2 years ago

fabOnReact commented 2 years ago

Build with no issue on https://github.com/fabriziobertoglio1987/react-native/commit/43c38cdc8e31910e0109f85d258fba22ec9469a0

Commit https://github.com/fabriziobertoglio1987/react-native/commit/2162bce44bbf40513bcf90b793810d05a67d2b7e triggers error

output from ./gradlew :packages:rn-tester:android:app:installJscDebug

```log [armeabi-v7a] Compile++ thumb: rntester_appmodules <= OnLoad.cpp [armeabi-v7a] Compile++ thumb: rntester_appmodules <= RNTesterTurboModuleManagerDelegate.cpp [armeabi-v7a] Compile++ thumb: rntester_appmodules <= RNTesterComponentsRegistry.cpp [armeabi-v7a] Compile++ thumb: rntester_appmodules <= RNTesterAppModuleProvider.cpp [armeabi-v7a] Compile++ thumb: rntester_appmodules <= rntester-generated.cpp [armeabi-v7a] Prebuilt : libglog.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libfolly_json.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libfolly_futures.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libyoga.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libturbomodulejsijni.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : librrc_view.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_render_core.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_render_graphics.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_codegen_rncore.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libfabricjni.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_render_componentregistry.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_debug.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Prebuilt : libreact_render_debug.so <= /home/fabrizio/.gradle/build/react-native-fork/app/react-ndk/exported/armeabi-v7a/ [armeabi-v7a] Compile++ thumb: react_codegen_rntester <= rntester-generated.cpp In file included from /home/fabrizio/.gradle/build/react-native-fork/app/generated/source/codegen/jni/rntester-generated.cpp:11: In file included from /home/fabrizio/.gradle/build/react-native-fork/app/generated/source/codegen/jni/rntester.h:13: /home/fabrizio/Documents/sourcecode/opensource/react-native-fork/ReactAndroid/../ReactCommon/react/nativemodule/core/platform/android/ReactCommon/JavaTurboModule.h:17:10: fatal error: 'fbjni/fbjni.h' file not found #include ^~~~~~~~~~~~~~~ 1 error generated. make: *** [/home/fabrizio/Android/Sdk/ndk/21.4.7075529/build/core/build-binary.mk:478: /home/fabrizio/.gradle/build/react-native-fork/app/intermediates/ndkBuild/jscDebug/obj/local/armeabi-v7a/objs-debug/react_codegen_rntester//home/fabrizio/.gradle/build/react-native-fork/app/generated/source/codegen/jni/rntester-generated.o] Error 1 ```

Java Version

Checking out the main branch triggers this commit.

Log

fabOnReact commented 2 years ago
fabOnReact commented 2 years ago
fabOnReact commented 2 years ago

solved with https://github.com/facebook/react-native/pull/33167

fabOnReact commented 2 years ago

https://github.com/facebook/react-native/pull/33160 and https://github.com/fabriziobertoglio1987/react-native/commit/8bc324fd34337ab159e2e21e213a6c5b06c548da. Latest commit I used for building from source https://github.com/fabriziobertoglio1987/react-native/commit/16feabf676193e970e19cbfafa0540928b4e0049

fabOnReact commented 2 years ago

I think kotlin needs to be added to template https://github.com/fabriziobertoglio1987/react-native/blob/3b9a034ce9a7ac0b6f52ed80b282c3e8fc67ca35/template/android/build.gradle#L19

buildscript {
    ext {
        buildToolsVersion = "31.0.0"
        kotlin_version="1.6.10"
        minSdkVersion = 21
        compileSdkVersion = 31
        targetSdkVersion = 31
        ndkVersion = "21.4.7075529"
    }
    repositories {
        google()
        mavenCentral()
    }
    dependencies {
        classpath("com.android.tools.build:gradle:7.0.4")
        classpath("com.facebook.react:react")
        classpath("de.undercouch:gradle-download-task:4.1.2")
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
        classpath 'de.undercouch:gradle-download-task:4.0.0'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}
fabOnReact commented 2 years ago

https://github.com/facebook/react-native/blob/3c958a838d720a312c8531d7d4b67fe79009c627/ReactAndroid/build.gradle#L412 could not find reactNativeDir

https://github.com/fabriziobertoglio1987/react-native/commit/8bc324fd34337ab159e2e21e213a6c5b06c548da

fabOnReact commented 2 years ago
FAILURE: Build failed with an exception.

* Where:
Build file '/home/fabrizio/Documents/sourcecode/reactnative/AwesomeProject/node_modules/react-native/ReactAndroid/build.gradle' line: 424

* What went wrong:
A problem occurred configuring project ':ReactAndroid'.
> Task with name 'configureNdkBuildDebug[armeabi-v7a]' not found in project ':ReactAndroid'.

https://github.com/fabriziobertoglio1987/react-native/commit/d6ed1ff58b2ca4d1c8b45416e56fa1da75633c07 https://github.com/fabriziobertoglio1987/react-native/commit/0f39a1076dc154995a2db79352adc36452f46210

fabOnReact commented 2 years ago

I solved this issue with the following steps:

git clone https://github.com/facebook/react-native.git
cd react-native
./gradlew :packages:rn-tester:android:app:installJscDebug
./scripts/packager.sh

current head is https://github.com/facebook/react-native/commit/8d50bf113352a6ccdf74c979e1022c6c2ccf6e56

fabOnReact commented 2 years ago
./gradlew :packages:rn-tester:android:app:installHermesDebug

output

02-25 15:17:17.721  8987  9036 D SoLoader: Not resolving dependencies for libreactnativejni.so
02-25 15:17:17.865  1112  2566 I FontLog : Received query Noto Color Emoji Compat, URI content://com.google.android.gms.fonts [CONTEXT service_id=132 ]
02-25 15:17:17.866  1112  2566 I FontLog : Query [emojicompat-emoji-font] resolved to {Noto Color Emoji Compat, wdth 100.0, wght 400, ital 0.0, bestEffort false} [CONTEXT service_id=132 ]
02-25 15:17:17.870  1112  2566 I FontLog : Fetch {Noto Color Emoji Compat, wdth 100.0, wght 400, ital 0.0, bestEffort false} end status Status{statusCode=SUCCESS, resolution=null} [CONTEXT service_id=132 ]
02-25 15:17:17.877  1112  2566 I FontLog : Pulling font file for id = 15, cache size = 5 [CONTEXT service_id=132 ]
02-25 15:17:18.756  8987  9037 F libc    : Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xbeaea5f1 in tid 9037 (mqt_js), pid 8987 (ook.react.uiapp)
02-25 15:17:17.885  1112  2566 I FontLog : Pulling font file for id = 15, cache size = 5 [CONTEXT service_id=132 ]
02-25 15:17:18.827  9044  9044 I crash_dump32: obtaining output fd from tombstoned, type: kDebuggerdTombstone
02-25 15:17:18.828   282   282 I tombstoned: received crash request for pid 9037
02-25 15:17:18.829  9044  9044 I crash_dump32: performing dump of process 8987 (target tid = 9037)
02-25 15:17:18.839  9044  9044 F DEBUG   : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-25 15:17:18.839  9044  9044 F DEBUG   : Build fingerprint: 'google/sdk_gphone_x86/generic_x86_arm:11/RSR1.201013.001/6903271:user/release-keys'
02-25 15:17:18.839  9044  9044 F DEBUG   : Revision: '0'
02-25 15:17:18.839  9044  9044 F DEBUG   : ABI: 'x86'
02-25 15:17:18.839  9044  9044 F DEBUG   : Timestamp: 2022-02-25 15:17:18+0800
02-25 15:17:18.839  9044  9044 F DEBUG   : pid: 8987, tid: 9037, name: mqt_js  >>> com.facebook.react.uiapp <<<
02-25 15:17:18.840  9044  9044 F DEBUG   : uid: 10160
02-25 15:17:18.840  9044  9044 F DEBUG   : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xbeaea5f1
02-25 15:17:18.840  9044  9044 F DEBUG   :     eax bceebc28  ebx c02fbb58  ecx bceebbf8  edx 7e71d805
02-25 15:17:18.840  9044  9044 F DEBUG   :     edi beaea5ed  esi c0644ad0
02-25 15:17:18.840  9044  9044 F DEBUG   :     ebp bceebbc8  esp bceebac0  eip bff95803
02-25 15:17:18.910  9044  9044 F DEBUG   : backtrace:
02-25 15:17:18.911  9044  9044 F DEBUG   :       #00 pc 00015803  /data/app/~~DM6xPNG74PPC_T-jvqw3bQ==/com.facebook.react.uiapp-oUJwsFrG3TspB2ilclqZIQ==/lib/x86/libhermes.so (BuildId: 0e224ae89f8fe1939609942a687e26eb015a376b)
02-25 15:17:18.911  9044  9044 F DEBUG   :       #01 pc 00335bf2  /data/app/~~DM6xPNG74PPC_T-jvqw3bQ==/com.facebook.react.uiapp-oUJwsFrG3TspB2ilclqZIQ==/lib/x86/libhermes-executor-debug.so (

related https://github.com/facebook/react-native/issues/33065

cortinico commented 2 years ago

02-25 15:17:18.840 9044 9044 F DEBUG : signal 11 (SIGSEGV), code 2 (SEGV_ACCERR), fault addr 0xbeaea5f1

Just a heads up that we're aware of a ABI incompatibility between the current main of RN and Hermes 0.11.0. We're working on it. That sounds like the cause of this crash.