I found the problem out myself.

I had to add cpp flags to build.gradle like below.

```
externalNativeBuild {
    cmake {
        cppFlags "-DV8_COMPRESS_POINTERS -DV8_31BIT_SMIS_ON_64BIT_ARCH"
    }
}
```

I also got an error below.

```
2022-05-22 18:50:30.448 24553-24553/com.example.v8api E/v8: Embedder-vs-V8 
build configuration mismatch. On embedder side pointer compression is 
DISABLED while on V8 side it's ENABLED.
```

2022年5月21日土曜日 0:19:42 UTC+9 Kazuya Hiruma:

> Recently, I'm trying to use V8 in my Android app with libv8_monolith.a.
>
> I buillt it on Ubuntu on WSL successfly. I use it in my app with set up 
> code below.
>
> ```
> using namespace v8;
> Isolate* isolate_;
> Global<Context> context_;
> Isolate::CreateParams create_params;
> std::unique_ptr<Platform> platform_;
>
> void initV8()
> {
>     V8::InitializeICU();
>
>     platform_ = v8::platform::NewDefaultPlatform();
>     V8::InitializePlatform(platform_.get());
>     
>     V8::Initialize(); // Here will crash!
> }
>
> extern "C" JNIEXPORT jstring JNICALL
> Java_com_edo_v8api_MainActivity_stringFromJNI(
>         JNIEnv* env,
>         jobject /* this */) {
>     std::string hello = "Hello from C++";
>     
>     initV8();
>
>     return env->NewStringUTF(hello.c_str());
> }
> ```
>
> Then, I got below error.
>
>
> -----------------------------------------------------------------------------------------------
> A/libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 27338 
> (com.edo.v8api), pid 27338 (com.edo.v8api)
>
> -----------------------------------------------------------------------------------------------
>
> I'm not sure why this error was occurred. Should I do more but I put 
> v8_monolith.a into the Android project? I imported libv8_monolith.a only.
>
>

-- 
-- 
v8-users mailing list
v8-users@googlegroups.com
http://groups.google.com/group/v8-users
--- 
You received this message because you are subscribed to the Google Groups 
"v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-users/1c5f4ce0-721b-4f40-83a2-1e2a64f9f45en%40googlegroups.com.

Reply via email to