Skip to content

Commit f687ded

Browse files
committed
Rename libv8.so to libv8android.so
Summary: On some Android device, there is libv8.so in system ROM. E.g. /system/lib/libv8.so or /vendor/lib/libv8.so On old Android, dlopen() with RTLD_GLOBAL is not handled well and it's by default RTLD_LOCAL. Even we call System.loadLibrary("v8") before, during the time RNV8 call System.loadLibrary("v8executor") and search libv8.so in DT_NEEDED. It seems bionic linker will use system libv8.so instead of ours. Since our libv8.so is customized with libplatform.so, this leads to unresolved symbol as #29. That's why I am proposing to rename libv8.so as libv8android.so and to prevent name conflict from system libv8.so. Reference for RTLD_GLOBAL: android/ndk#201 (cherry picked from commit 5a78dd5)
1 parent e81a2bb commit f687ded

File tree

8 files changed

+12
-14
lines changed

8 files changed

+12
-14
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ yarn add 'react-native-v8@>=0.60.0-patch.0 <0.60.1'
4343
dependencies {
4444
implementation fileTree(dir: "libs", include: ["*.jar"])
4545
implementation "com.facebook.react:react-native:+" // From node_modules
46-
+ // Add v8-android - prebuilt libv8.so into APK
46+
+ // Add v8-android - prebuilt libv8android.so into APK
4747
+ implementation 'org.chromium:v8-android:+'
4848

4949
// JSC from node_modules
@@ -60,7 +60,7 @@ yarn add 'react-native-v8@>=0.60.0-patch.0 <0.60.1'
6060
+ url("$rootDir/../node_modules/react-native-v8/dist")
6161
+ }
6262
+ maven {
63-
+ // prebuilt libv8.so
63+
+ // prebuilt libv8android.so
6464
+ url("$rootDir/../node_modules/v8-android/dist")
6565
}
6666
maven {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@
2828
"RN_VERSION": "v0.59.10"
2929
},
3030
"dependencies": {
31-
"v8-android": "^7.8.0"
31+
"v8-android": "7.8.x >= 7.8.1"
3232
}
3333
}

src/androidexecutor/reactexecutor/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(REACT_NATIVE
1717
LOCAL_CPP_FEATURES := exceptions
1818

1919
LOCAL_STATIC_LIBRARIES := libjsireact libjsi v8runtime
20-
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libreactnativejni libv8
20+
LOCAL_SHARED_LIBRARIES := libfolly_json libfb libreactnativejni libv8android
2121

2222
include $(BUILD_SHARED_LIBRARY)

src/androidexecutor/reactexecutor/V8Executor.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313

1414
public class V8Executor extends JavaScriptExecutor {
1515
static {
16-
// libv8 must be loaded explicitly to invoke its JNI_OnLoad.
17-
SoLoader.loadLibrary("v8");
1816
SoLoader.loadLibrary("v8executor");
1917
}
2018

src/patches/build_with_v8.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ index 4300a84..2f9461f 100644
4141
from("$thirdPartyNdkDir/jsc/jni")
4242
into("$buildDir/react-ndk/exported")
4343
+ exclude("**/libjsc.so")
44-
+ exclude("**/libv8.so")
44+
+ exclude("**/libv8android.so")
4545
}
4646

4747
task packageReactNdkLibsForBuck(dependsOn: packageReactNdkLibs, type: Copy) {

src/sowrapper/Android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
LOCAL_PATH:= $(call my-dir)
22
include $(CLEAR_VARS)
3-
LOCAL_MODULE:= v8
4-
LOCAL_SRC_FILES := jni/$(TARGET_ARCH_ABI)/libv8.so
3+
LOCAL_MODULE:= v8android
4+
LOCAL_SRC_FILES := jni/$(TARGET_ARCH_ABI)/libv8android.so
55
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
66
include $(PREBUILT_SHARED_LIBRARY)

src/v8runtime/Android.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ LOCAL_C_INCLUDES := $(LOCAL_PATH) $(LOCAL_PATH)/.. $(LOCAL_PATH)/../..
1515
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
1616

1717
LOCAL_CFLAGS := -fexceptions -frtti -O3
18-
LOCAL_SHARED_LIBRARIES := libfolly_json libv8 glog
18+
LOCAL_SHARED_LIBRARIES := libfolly_json libv8android glog
1919

2020
include $(BUILD_STATIC_LIBRARY)

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# yarn lockfile v1
33

44

5-
v8-android@^7.8.0:
6-
version "7.8.0"
7-
resolved "https://registry.yarnpkg.com/v8-android/-/v8-android-7.8.0.tgz#5c95722fe78a8b488563f18a0dab238495cf56ac"
8-
integrity sha512-nBzlNYoCgptxaKlJ7O6miQsF+ctY33Tk+HmqxFDVy29LqEm7Tf13r0al71TYrh1TOu9mHZAEJJTpjdpyN4o0bw==
5+
"[email protected].x >= 7.8.1":
6+
version "7.8.1"
7+
resolved "https://registry.yarnpkg.com/v8-android/-/v8-android-7.8.1.tgz#2686c3fe655742bbd02e1b6d1c3e336365d4e8e0"
8+
integrity sha512-fxqBNITrILwfzQI9ZIWHR44B6Hvhplfht+V9dpcTrm7CGZjWpUaD/n3C0ghCW15VLRYhWPuCVltXHwbvsBOLjw==

0 commit comments

Comments
 (0)