Kudo/react-native-v8

Build fails on react-native 0.69

ammarahm-ed opened this issue · 1 comments

Hey, the build on latest version of React Native keeps failing. I have tried to upgrade build.gradle & CMakeLists.txt files to add support similar to how react-native-reanimated has done but I still see errors during CMake build.

/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 * Copyright (c) Software Mansion <swmansion.com>.
 * Copyright (c) Kudo Chien.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import groovy.json.JsonSlurper
import org.apache.tools.ant.filters.ReplaceTokens


File findNodePackageDir(String packageName, boolean absolute = true) {
  def nodeCommand = ["node", "--print", "require.resolve('${packageName}/package.json')"]
  def proc = nodeCommand.execute(null, rootDir)
  def error = proc.err.text
  if (error) {
    throw new GradleException("findNodePackageDir() execution failed - nodeCommand[${nodeCommand.join(' ')}]\n" + error)
  }
  def dir = new File(proc.text.trim()).getParentFile()
  return absolute ? dir.getAbsoluteFile() : dir
}

def safeExtGet(prop, fallback) {
  return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
}

def reactNativeDir = findNodePackageDir("react-native")
def reactNativeManifest = file("${reactNativeDir}/package.json")
def reactNativeManifestAsJson = new JsonSlurper().parseText(reactNativeManifest.text)
def reactNativeVersion = reactNativeManifestAsJson.version as String
def (major, minor, patch) = reactNativeVersion.tokenize('.')
def rnMinorVersion = Integer.parseInt(minor)

def findV8AndroidDir() {
  def v8Packages = [
    "v8-android-jit",
    "v8-android",
    "v8-android-jit-nointl",
    "v8-android-nointl",
  ]
  for (pkg in v8Packages) {
    try {
      return findNodePackageDir(pkg)
    } catch (Exception e) {
    }
  }
  throw new GradleException("Unable to find v8 package. Please install a package from the following v8 variants:\n" +
  "  - v8-android-jit\n" +
  "  - v8-android-jit-nointl\n" +
  "  - v8-android\n" +
  "  - v8-android-nointl\n")
}

def v8AndroidDir = findProperty("v8.android.dir") ?: findV8AndroidDir()
def v8AndroidVersion = new JsonSlurper().parseText(file("${v8AndroidDir}/package.json").text).version as String
logger.info("v8AndroidVersion[${v8AndroidVersion}]")
def v8AndroidVersionMajor = Integer.parseInt(v8AndroidVersion.tokenize('.')[0])

def v8UseSnapshot = v8AndroidVersionMajor >= 10

// These constant values should align to V8RuntimeConfig.java
ext.CODECACHE_MODE_NONE = 0
ext.CODECACHE_MODE_NORMAL = 1
ext.CODECACHE_MODE_PREBUILT = 2
ext.CODECACHE_MODE_NORMAL_WITH_STUB_BUNDLE = 3
def parseCacheMode(cacheMode) {
  switch (cacheMode) {
    case null:
      return ext.CODECACHE_MODE_NONE
    case "normal":
      return ext.CODECACHE_MODE_NORMAL
    case "prebuilt":
      return ext.CODECACHE_MODE_PREBUILT
    case "normalWithStubBundle":
      return ext.CODECACHE_MODE_NORMAL_WITH_STUB_BUNDLE
    default:
      throw new GradleException("Unsupported cache mode - ${cacheMode}")
  }
}
def v8CacheMode = parseCacheMode(findProperty("v8.cacheMode"))

def localProps = new Properties()
def localPropertiesFile = file("local.properties")
if (localPropertiesFile.exists()) {
  localProps.load(new InputStreamReader(new FileInputStream(localPropertiesFile), "UTF-8"))
}

def debugNativeLibraries = localProps.getProperty('NATIVE_DEBUG_ON', 'FALSE').toBoolean()
def reactProperties = new Properties()
file("${reactNativeDir}/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }

def BOOST_VERSION = reactProperties.getProperty("BOOST_VERSION")
def DOUBLE_CONVERSION_VERSION = reactProperties.getProperty("DOUBLE_CONVERSION_VERSION")
def FOLLY_VERSION = reactProperties.getProperty("FOLLY_VERSION")
def GLOG_VERSION = reactProperties.getProperty("GLOG_VERSION")
def REACT_VERSION = reactProperties.getProperty("VERSION_NAME").split("\\.")[1].toInteger()
def FBJNI_VERSION = "0.3.0"

// We download various C++ open-source dependencies into downloads.
// We then copy both the downloaded code and our custom makefiles and headers into third-party-ndk.
// After that we build native code from src/main/jni with module path pointing at third-party-ndk.

def downloadsDir = new File("${buildDir}/downloads")
def thirdPartyNdkDir = new File("${buildDir}/third-party-ndk")

def reactNativeThirdPartyDir = new File("${reactNativeDir}/ReactAndroid/src/main/jni/third-party")

def _stackProtectorFlag = true

def reactNativeArchitectures() {
  def value = project.getProperties().get("reactNativeArchitectures")
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

// You need to have following folders in this directory:
//   - boost_1_63_0
//   - double-conversion-1.1.6
//   - folly-deprecate-dynamic-initializer
//   - glog-0.3.5
def dependenciesPath = System.getenv("REACT_NATIVE_DEPENDENCIES")

// The Boost library is a very large download (>100MB).
// If Boost is already present on your system, define the REACT_NATIVE_BOOST_PATH env variable
// and the build will use that.
def boostPath = dependenciesPath ?: System.getenv("REACT_NATIVE_BOOST_PATH")

buildscript {
  repositories {
    google()
    mavenCentral()
  }
  dependencies {
    classpath "com.android.tools.build:gradle:4.2.2"
    classpath "de.undercouch:gradle-download-task:4.1.2"
  }
}

apply plugin: "com.android.library"
apply plugin: "de.undercouch.download"
if (v8CacheMode == CODECACHE_MODE_PREBUILT) {
  apply from: "./mkcodecache.gradle"
}

android {
  compileSdkVersion safeExtGet("compileSdkVersion", 30)
  defaultConfig {
    minSdkVersion safeExtGet("minSdkVersion", 16)
    targetSdkVersion safeExtGet("targetSdkVersion", 30)
    versionCode 1
    versionName "1.0"
    externalNativeBuild {
      cmake {
        arguments "-DANDROID_STL=c++_shared",
                  "-DREACT_NATIVE_TARGET_VERSION=${rnMinorVersion}",
+                "-DBOOST_VERSION=${BOOST_VERSION}",
                  "-DBUILD_DIR=${buildDir}",
                  "-DRN_DIR=${reactNativeDir}",
                  "-DV8_ANDROID_DIR=${v8AndroidDir}"
        abiFilters (*reactNativeArchitectures())
        _stackProtectorFlag ? (cppFlags("-fstack-protector-all")) : null
      }
    }

    buildConfigField("boolean", "V8_USE_SNAPSHOT", v8UseSnapshot.toString())
    buildConfigField("int", "V8_CACHE_MODE", v8CacheMode.toString())
  }
  externalNativeBuild {
    cmake {
      path "CMakeLists.txt"
    }
  }
  lintOptions {
    abortOnError false
  }
  packagingOptions {
    // println "Native libs debug enabled: ${debugNativeLibraries}"
    doNotStrip debugNativeLibraries ? "**/**/*.so" : ''
    excludes += [
      "**/libc++_shared.so",
      "**/libfbjni.so",
      "**/libjsi.so",
      "**/libfolly_json.so",
+    "**/libfolly_runtime.so",
      "**/libglog.so",
      "**/libreactnativejni.so",
      "**/libjsinspector.so",
    ]
    pickFirst "**/libv8android.so"
  }
  configurations {
    extractHeaders
    extractSO
  }
  compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
  }
  sourceSets {
    main {
      jniLibs.srcDirs = ["${reactNativeDir}/ReactAndroid/src/main/jni/first-party/v8/jni"]

      if (v8UseSnapshot) {
        assets.srcDirs += [ "${v8AndroidDir}/dist/snapshot_blob" ]
      }

      if (v8CacheMode == CODECACHE_MODE_NORMAL_WITH_STUB_BUNDLE) {
        assets.srcDirs += [ "src/stub_bundle" ]
      }
    }
  }
}

task cleanCmakeCache() {
  tasks.getByName("clean").dependsOn(cleanCmakeCache)
  doFirst {
    delete "${projectDir}/.cxx"
  }
}

task createNativeDepsDirectories() {
  downloadsDir.mkdirs()
  thirdPartyNdkDir.mkdirs()
}

task downloadBoost(dependsOn: createNativeDepsDirectories, type: Download) {
+   def transformedVersion = BOOST_VERSION.replace("_", ".")
+   def srcUrl = "https://boostorg.jfrog.io/artifactory/main/release/${transformedVersion}/source/boost_${BOOST_VERSION}.tar.gz"
+   if (rnMinorVersion < 69) {
+         srcUrl = "https://github.com/react-native-community/boost-for-react-native/releases/download/v${transformedVersion}-0/boost_${BOOST_VERSION}.tar.gz"
+   }
+   src(srcUrl)
  onlyIfNewer(true)
  overwrite(false)
  dest(new File(downloadsDir, "boost_${BOOST_VERSION}.tar.gz"))
}

task prepareBoost(dependsOn: boostPath ? [] : [downloadBoost], type: Copy) {
  from(boostPath ?: tarTree(resources.gzip(downloadBoost.dest)))
  from("${reactNativeThirdPartyDir}/boost/Android.mk")
  include("Android.mk", "boost_${BOOST_VERSION}/boost/**/*.hpp", "boost/boost/**/*.hpp")
  includeEmptyDirs = false
  into("${thirdPartyNdkDir}/boost")
  doLast {
    file("${thirdPartyNdkDir}/boost/boost").renameTo("${thirdPartyNdkDir}/boost/boost_${BOOST_VERSION}")
  }
}

task downloadDoubleConversion(dependsOn: createNativeDepsDirectories, type: Download) {
  src("https://github.com/google/double-conversion/archive/v${DOUBLE_CONVERSION_VERSION}.tar.gz")
  onlyIfNewer(true)
  overwrite(false)
  dest(new File(downloadsDir, "double-conversion-${DOUBLE_CONVERSION_VERSION}.tar.gz"))
}

task prepareDoubleConversion(dependsOn: dependenciesPath ? [] : [downloadDoubleConversion], type: Copy) {
  from(dependenciesPath ?: tarTree(downloadDoubleConversion.dest))
  from("${reactNativeThirdPartyDir}/double-conversion/Android.mk")
  include("double-conversion-${DOUBLE_CONVERSION_VERSION}/src/**/*", "Android.mk")
  filesMatching("*/src/**/*", { fname -> fname.path = "double-conversion/${fname.name}" })
  includeEmptyDirs = false
  into("${thirdPartyNdkDir}/double-conversion")
}

task downloadFolly(dependsOn: createNativeDepsDirectories, type: Download) {
  src("https://github.com/facebook/folly/archive/v${FOLLY_VERSION}.tar.gz")
  onlyIfNewer(true)
  overwrite(false)
  dest(new File(downloadsDir, "folly-${FOLLY_VERSION}.tar.gz"))
}

task prepareFolly(dependsOn: dependenciesPath ? [] : [downloadFolly], type: Copy) {
  from(dependenciesPath ?: tarTree(downloadFolly.dest))
  from("${reactNativeThirdPartyDir}/folly/Android.mk")
  include("folly-${FOLLY_VERSION}/folly/**/*", "Android.mk")
  eachFile { fname -> fname.path = (fname.path - "folly-${FOLLY_VERSION}/") }
  includeEmptyDirs = false
  into("${thirdPartyNdkDir}/folly")
}

task downloadGlog(dependsOn: createNativeDepsDirectories, type: Download) {
  src("https://github.com/google/glog/archive/v${GLOG_VERSION}.tar.gz")
  onlyIfNewer(true)
  overwrite(false)
  dest(new File(downloadsDir, "glog-${GLOG_VERSION}.tar.gz"))
}

// Prepare glog sources to be compiled, this task will perform steps that normally should've been
// executed by automake. This way we can avoid dependencies on make/automake
task prepareGlog(dependsOn: dependenciesPath ? [] : [downloadGlog], type: Copy) {
  duplicatesStrategy = "include"
  from(dependenciesPath ?: tarTree(downloadGlog.dest))
  from("${reactNativeThirdPartyDir}/glog/")
  include("glog-${GLOG_VERSION}/src/**/*", "Android.mk", "config.h")
  includeEmptyDirs = false
  filesMatching("**/*.h.in") {
    filter(ReplaceTokens, tokens: [
      ac_cv_have_unistd_h           : "1",
      ac_cv_have_stdint_h           : "1",
      ac_cv_have_systypes_h         : "1",
      ac_cv_have_inttypes_h         : "1",
      ac_cv_have_libgflags          : "0",
      ac_google_start_namespace     : "namespace google {",
      ac_cv_have_uint16_t           : "1",
      ac_cv_have_u_int16_t          : "1",
      ac_cv_have___uint16           : "0",
      ac_google_end_namespace       : "}",
      ac_cv_have___builtin_expect   : "1",
      ac_google_namespace           : "google",
      ac_cv___attribute___noinline  : "__attribute__ ((noinline))",
      ac_cv___attribute___noreturn  : "__attribute__ ((noreturn))",
      ac_cv___attribute___printf_4_5: "__attribute__((__format__ (__printf__, 4, 5)))"
    ])
    it.path = (it.name - ".in")
  }
  into("${thirdPartyNdkDir}/glog")

  doLast {
    copy {
      from(fileTree(dir: "${thirdPartyNdkDir}/glog", includes: ["stl_logging.h", "logging.h", "raw_logging.h", "vlog_is_on.h", "**/src/glog/log_severity.h"]).files)
      includeEmptyDirs = false
      into("${thirdPartyNdkDir}/glog/exported/glog")
    }
  }
}

task extractAARHeaders {
  doLast {
    configurations.extractHeaders.files.each {
      def file = it.absoluteFile
      def packageName = file.name.tokenize('-')[0]
      copy {
        from zipTree(file)
        into "${reactNativeDir}/ReactAndroid/src/main/jni/first-party/${packageName}/headers"
        include "**/*.h"
      }
    }
  }
}

task extractSOFiles {
  doLast {
    configurations.extractSO.files.each {
      def file = it.absoluteFile
      def packageName = file.name.tokenize('-')[0]
      copy {
        from zipTree(file)
        into "${reactNativeDir}/ReactAndroid/src/main/jni/first-party/${packageName}/"
        include "jni/**/*.so"
      }
    }
  }
}

dependencies {
  // noinspection GradleDynamicVersion
  implementation "com.facebook.yoga:proguard-annotations:1.19.0"
  implementation "com.facebook.fbjni:fbjni-java-only:" + FBJNI_VERSION
  implementation "com.facebook.react:react-native:+" // From node_modules

  extractHeaders("com.facebook.fbjni:fbjni:" + FBJNI_VERSION + ":headers")
  extractSO("com.facebook.fbjni:fbjni:" + FBJNI_VERSION)

  def v8AAR = fileTree("${v8AndroidDir}/dist").matching({ it.include "**/**/*.aar" }).singleFile
  extractSO(files(v8AAR))
}

+ task unpackReactNativeAAR {
+     def buildType = "debug"
+     tasks.all({ task ->
+         if (task.name == "buildCMakeRelease") {
+             buildType = "release"
+         }
+     })
+     def rnAarMatcher = "**/react-native/**/*${buildType}.aar"
+     if (rnMinorVersion < 69) {
+         rnAarMatcher = "**/**/*.aar"
+     }
+     def rnAAR = fileTree("$reactNativeDir/android").matching({ it.include rnAarMatcher }).singleFile
+     def file = rnAAR.absoluteFile
 +    def packageName = file.name.tokenize('-')[0]
+     copy {
 +       from zipTree(file)
+        into "$reactNativeDir/ReactAndroid/src/main/jni/first-party/$packageName/"
+         include "jni/**/*.so"
+     }
+ }

task downloadNdkBuildDependencies {
  if (!boostPath) {
    dependsOn(downloadBoost)
  }
  dependsOn(downloadDoubleConversion)
  dependsOn(downloadFolly)
  dependsOn(downloadGlog)
}

+ task prepareThirdPartyNdkHeaders(dependsOn:[downloadNdkBuildDependencies, prepareBoost, prepareDoubleConversion, prepareFolly, prepareGlog, unpackReactNativeAAR]) {
}

tasks.whenTaskAdded { task ->
  if (
      !task.name.contains("Clean") && (
        task.name.startsWith("externalNativeBuild")
        || task.name.startsWith("buildCMake")
        || task.name.startsWith("configureCMake"))
  ) {
    task.dependsOn(prepareThirdPartyNdkHeaders)
    extractAARHeaders.dependsOn(prepareThirdPartyNdkHeaders)
    extractSOFiles.dependsOn(prepareThirdPartyNdkHeaders)
    task.dependsOn(extractAARHeaders)
    task.dependsOn(extractSOFiles)
  }
}

CmakeLists.txt

#
# Copyright (c) Software Mansion <swmansion.com>.
# Copyright (c) Kudo Chien.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
#

cmake_minimum_required(VERSION 3.5.1)
project(react-native-v8)

set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS "-DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare")

# if(${NATIVE_DEBUG})
#   set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g")
#   set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")
# endif()

if(${ANDROID_ABI} STREQUAL "arm64-v8a" OR ${ANDROID_ABI} STREQUAL "x86_64")
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DV8_COMPRESS_POINTERS")
endif()

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "")

set(PACKAGE_NAME "v8executor")
set(SRC_DIR "${CMAKE_SOURCE_DIR}/src/main/cpp")

set(RN_SO_DIR "${RN_DIR}/ReactAndroid/src/main/jni/first-party/react/jni")
set(FBJNI_HEADERS_DIR "${RN_SO_DIR}/../../fbjni/headers")

set(V8RUNTIME_COMMON_DIR "${CMAKE_SOURCE_DIR}/../src/v8runtime")
file(GLOB SOURCES_V8RUNTIME  "${V8RUNTIME_COMMON_DIR}/*.cpp")

add_library(
  ${PACKAGE_NAME}
  SHARED
  ${SOURCES_V8RUNTIME}
  "${SRC_DIR}/V8ExecutorFactory.cpp"
  "${SRC_DIR}/OnLoad.cpp"
)

# includes

file(GLOB LIBFBJNI_INCLUDE_DIR ${FBJNI_HEADERS_DIR})

target_include_directories(
  ${PACKAGE_NAME}
  PRIVATE
  "${V8RUNTIME_COMMON_DIR}"
  "${LIBFBJNI_INCLUDE_DIR}"
  "${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
  "${BUILD_DIR}/third-party-ndk/double-conversion"
  "${BUILD_DIR}/third-party-ndk/folly"
  "${BUILD_DIR}/third-party-ndk/glog/exported"
  "${RN_DIR}/ReactAndroid/src/main/jni"
  "${RN_DIR}/ReactCommon"
  "${RN_DIR}/ReactCommon/jsi"
  "${RN_DIR}/ReactCommon/jsiexecutor"
  "${V8_ANDROID_DIR}/dist/include"
)

# find libraries

file(GLOB LIBRN_DIR "${RN_SO_DIR}/${ANDROID_ABI}")
file(GLOB LIBV8_DIR "${RN_SO_DIR}/../../v8/jni/${ANDROID_ABI}")

find_library(
  LOG_LIB
  log
)

find_library(
  REACT_NATIVE_JNI_LIB
  reactnativejni
  PATHS ${LIBRN_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)
find_library(
  GLOG_LIB
  glog
  PATHS ${LIBRN_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)
find_library(
  FBJNI_LIB
  fbjni
  PATHS ${LIBRN_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)
find_library(
  JSI_LIB
  jsi
  PATHS ${LIBRN_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)
find_library(
  JSINSPECTOR_LIB
  jsinspector
  PATHS ${LIBRN_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)
find_library(
  V8_ANDROID_LIB
  v8android
  PATHS ${LIBV8_DIR}
  NO_CMAKE_FIND_ROOT_PATH
)

# reactnative_internal_static
file(GLOB INCLUDE_RN_JSIREACT_CPP  "${RN_DIR}/ReactCommon/jsiexecutor/jsireact/*.cpp")
file(GLOB INCLUDE_RN_REACTPERFLOGGER_CPP  "${RN_DIR}/ReactCommon/reactperflogger/reactperflogger/*.cpp")

add_library(
  reactnative_internal_static
  STATIC
  "${INCLUDE_RN_JSIREACT_CPP}"
  "${INCLUDE_RN_REACTPERFLOGGER_CPP}"
  "${RN_DIR}/ReactCommon/cxxreact/JSExecutor.cpp"
)

target_include_directories(
  reactnative_internal_static
  PRIVATE
  "${BUILD_DIR}/third-party-ndk/boost/boost_${BOOST_VERSION}"
  "${BUILD_DIR}/third-party-ndk/double-conversion"
  "${BUILD_DIR}/third-party-ndk/folly"
  "${BUILD_DIR}/third-party-ndk/glog/exported"
  "${RN_DIR}/ReactCommon"
  "${RN_DIR}/ReactCommon/jsi"
  "${RN_DIR}/ReactCommon/jsiexecutor"
  "${RN_DIR}/ReactCommon/jsinspector"
  "${RN_DIR}/ReactCommon/reactperflogger"
)


+  if(${REACT_NATIVE_TARGET_VERSION} LESS 69)
+      find_library(
+              FOLLY_LIB
+              folly_json
+              PATHS ${LIBRN_DIR}
+              NO_CMAKE_FIND_ROOT_PATH
+     )
+  else()
+      find_library(
+              FOLLY_LIB
+             folly_runtime
+              PATHS ${LIBRN_DIR}
+             NO_CMAKE_FIND_ROOT_PATH
+      )
+  endif()

target_link_libraries(
  reactnative_internal_static
  ${FOLLY_LIB}
)

# link to shared libraries

set_target_properties(${PACKAGE_NAME} PROPERTIES LINKER_LANGUAGE CXX)

target_link_libraries(
  ${PACKAGE_NAME}
  ${LOG_LIB}
  ${JSI_LIB}
  ${JSINSPECTOR_LIB}
  ${GLOG_LIB}
  ${FBJNI_LIB}
+  ${FOLLY_LIB}
  ${REACT_NATIVE_JNI_LIB}
  ${V8_ANDROID_LIB}
  reactnative_internal_static
  android
)

Build Error:

> Task :react-native-v8:buildCMakeDebug[arm64-v8a]
C/C++: ninja: Entering directory `/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/android/.cxx/Debug/25l3f2i1/arm64-v8a'
C/C++: In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:8:
C/C++: In file included from ../../../../../src/v8runtime/V8RuntimeFactory.h:11:
C/C++: In file included from ../../../../../src/v8runtime/V8RuntimeConfig.h:10:
C/C++: In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/cxxreact/JSBigString.h:10:
C/C++: In file included from ../../../../build/third-party-ndk/folly/folly/Exception.h:23:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/system_error:149:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string:504:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string_view:175:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__string:56:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:643:
C/C++: /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3003:32: error: allocating an object of abstract class type 'rnv8::V8Runtime'
C/C++: /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:17:15: note: in instantiation of function template specialization 'std::__ndk1::make_unique<rnv8::V8Runtime, std::__ndk1::unique_ptr<rnv8::V8RuntimeConfig, std::__ndk1::default_delete<rnv8::V8RuntimeConfig> >, std::__ndk1::shared_ptr<facebook::react::MessageQueueThread> &>' requested here
C/C++: /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsi/jsi/jsi.h:277:22: note: unimplemented pure virtual method 'createPropNameIDFromSymbol' in 'V8Runtime'
C/C++: In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:8:
C/C++: In file included from ../../../../../src/v8runtime/V8RuntimeFactory.h:11:
C/C++: In file included from ../../../../../src/v8runtime/V8RuntimeConfig.h:10:
C/C++: In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/cxxreact/JSBigString.h:10:
C/C++: In file included from ../../../../build/third-party-ndk/folly/folly/Exception.h:23:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/system_error:149:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string:504:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string_view:175:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__string:56:
C/C++: In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:643:
C/C++: /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3003:32: error: allocating an object of abstract class type 'rnv8::V8Runtime'
C/C++: /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:24:15: note: in instantiation of function template specialization 'std::__ndk1::make_unique<rnv8::V8Runtime, const rnv8::V8Runtime *&, std::__ndk1::unique_ptr<rnv8::V8RuntimeConfig, std::__ndk1::default_delete<rnv8::V8RuntimeConfig> > >' requested here

> Task :react-native-v8:buildCMakeDebug[arm64-v8a] FAILED

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.3.3/userguide/command_line_interface.html#sec:command_line_warnings
717 actionable tasks: 27 executed, 690 up-to-date

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':react-native-v8:buildCMakeDebug[arm64-v8a]'.
> Build command failed.
  Error while executing process /home/ammarahm-ed/Android/sdk/cmake/3.18.1/bin/ninja with arguments {-C /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/android/.cxx/Debug/25l3f2i1/arm64-v8a v8executor}
  ninja: Entering directory `/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/android/.cxx/Debug/25l3f2i1/arm64-v8a'
  [1/7] Building CXX object CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp.o
  FAILED: CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp.o 
  /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang++ --target=aarch64-none-linux-android21 --gcc-toolchain=/home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64 --sysroot=/home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot -Dv8executor_EXPORTS -I../../../../../src/v8runtime -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactAndroid/src/main/jni/first-party/react/jni/../../fbjni/headers -I../../../../build/third-party-ndk/boost/boost_1_76_0 -I../../../../build/third-party-ndk/double-conversion -I../../../../build/third-party-ndk/folly -I../../../../build/third-party-ndk/glog/exported -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactAndroid/src/main/jni -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsi -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsiexecutor -I/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/v8-android-jit-nointl/dist/include -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -fexceptions -fno-omit-frame-pointer -frtti -Wno-sign-compare -DV8_COMPRESS_POINTERS -O0 -fno-limit-debug-info  -fPIC -std=c++14 -MD -MT CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp.o -MF CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp.o.d -o CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp.o -c /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp
  In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:8:
  In file included from ../../../../../src/v8runtime/V8RuntimeFactory.h:11:
  In file included from ../../../../../src/v8runtime/V8RuntimeConfig.h:10:
  In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/cxxreact/JSBigString.h:10:
  In file included from ../../../../build/third-party-ndk/folly/folly/Exception.h:23:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/system_error:149:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string:504:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string_view:175:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__string:56:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:643:
  /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3003:32: error: allocating an object of abstract class type 'rnv8::V8Runtime'
      return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
                                 ^
  /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:17:15: note: in instantiation of function template specialization 'std::__ndk1::make_unique<rnv8::V8Runtime, std::__ndk1::unique_ptr<rnv8::V8RuntimeConfig, std::__ndk1::default_delete<rnv8::V8RuntimeConfig> >, std::__ndk1::shared_ptr<facebook::react::MessageQueueThread> &>' requested here
    return std::make_unique<V8Runtime>(std::move(config), jsQueue);
                ^
  /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsi/jsi/jsi.h:277:22: note: unimplemented pure virtual method 'createPropNameIDFromSymbol' in 'V8Runtime'
    virtual PropNameID createPropNameIDFromSymbol(const Symbol& sym) = 0;
                       ^
  In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:8:
  In file included from ../../../../../src/v8runtime/V8RuntimeFactory.h:11:
  In file included from ../../../../../src/v8runtime/V8RuntimeConfig.h:10:
  In file included from /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/cxxreact/JSBigString.h:10:
  In file included from ../../../../build/third-party-ndk/folly/folly/Exception.h:23:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/system_error:149:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string:504:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/string_view:175:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/__string:56:
  In file included from /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/algorithm:643:
  /home/ammarahm-ed/Android/sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/sysroot/usr/include/c++/v1/memory:3003:32: error: allocating an object of abstract class type 'rnv8::V8Runtime'
      return unique_ptr<_Tp>(new _Tp(_VSTD::forward<_Args>(__args)...));
                                 ^
  /home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8RuntimeFactory.cpp:24:15: note: in instantiation of function template specialization 'std::__ndk1::make_unique<rnv8::V8Runtime, const rnv8::V8Runtime *&, std::__ndk1::unique_ptr<rnv8::V8RuntimeConfig, std::__ndk1::default_delete<rnv8::V8RuntimeConfig> > >' requested here
    return std::make_unique<V8Runtime>(sharedV8Runtime, std::move(config));
                ^
  2 errors generated.
  [2/7] Building CXX object CMakeFiles/reactnative_internal_static.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsiexecutor/jsireact/JSINativeModules.cpp.o
  [3/7] Building CXX object CMakeFiles/v8executor.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native-v8/src/v8runtime/V8Runtime.cpp.o
  [4/7] Building CXX object CMakeFiles/v8executor.dir/src/main/cpp/OnLoad.cpp.o
  [5/7] Building CXX object CMakeFiles/reactnative_internal_static.dir/home/ammarahm-ed/Repos/notesnook-mobile/node_modules/react-native/ReactCommon/jsiexecutor/jsireact/JSIExecutor.cpp.o
  ninja: build stopped: subcommand failed.
  


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 1m 28s
Kudo commented

close via b7e0726