Hello!

Could you please try to apply this patch https://crrev.com/c/6375266 and
add v8_monolithic_for_shared_library=true to your GN args?

On Thu, Mar 20, 2025 at 7:06 AM Pradish <pradis...@gmail.com> wrote:

> I am able to build V8 as a static library using the following args.gn
>
> *V8 Version: 13.4.114.19, *but when trying to link it statically with
> another shared libraray which is part of our application it is failing with
> errors
>
>
> On Linux RHEL 8
>
> the args.gn used is
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *v8_static_library = true is_component_build = false is_debug = false
> target_cpu = "x64" use_custom_libcxx = false v8_monolithic = true
> v8_use_external_startup_data = false is_clang = false
> clang_use_chrome_plugins = false treat_warnings_as_errors = false
> v8_enable_fast_torque = false v8_enable_sandbox = false v8_enable_backtrace
> = false v8_enable_disassembler = false v8_enable_object_print = false
> v8_enable_verify_heap = false dcheck_always_on = false
> v8_enable_i18n_support = false use_sysroot = false v8_enable_webassembly =
> false*
>
> *Errors:*
> *release/libv8_monolith.a(api.o): relocation R_X86_64_TPOFF32 against
> symbol `_ZN2v88internal18g_current_isolate_E' can not be used when making a
> shared object; recompile with -fPIC*
>
>
> * /release/libv8_monolith.a(isolate.o): relocation R_X86_64_TPOFF32
> against symbol `_ZN2v88internal21g_current_local_heap_E' can not be used
> when making a shared object; recompile with -fPIC*
>
> on further exploring the errors, we found that this declaration in the
> isolate.h is causing the issue
>
> * in isolate.h*
>
> it is declared as
>
>  __attribute__((tls_model(V8_TLS_MODEL))) extern thread_local Isolate*
> g_current_isolate_ V8_CONSTINIT;
>
> *in Isolate.cc*
>
> thread_local Isolate::PerIsolateThreadData*
> g_current_per_isolate_thread_data_
>     V8_CONSTINIT = nullptr;
>
> thread_local Isolate* g_current_isolate_ V8_CONSTINIT = nullptr;
>
>
>
> After some google , i changed the code to  the following
>
> *in Isolate.h*
> * __attribute__((tls_model("global-dynamic"))) extern thread_local
> Isolate* g_current_isolate_ V8_CONSTINIT;*
>
>
> *in isolate.cc *
>
>
>
>
>
>
> *__attribute__((tls_model("global-dynamic")))thread_local
> Isolate::PerIsolateThreadData* g_current_per_isolate_thread_data_
> V8_CONSTINIT =
> nullptr;__attribute__((tls_model("global-dynamic")))thread_local Isolate*
> g_current_isolate_ V8_CONSTINIT = nullptr;*
>
> Still no success.
>
> also note that this was working earlier when the V8 libraries where shared
> libraires , but after moveing to static this issue is seen
>
> can anyone share some pointers or a fix to resolve the issue.
>
>  regards
>
> Pradish
>
> --
> --
> 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 visit
> https://groups.google.com/d/msgid/v8-users/349430fd-d9af-47b4-9412-57ceb2a18e9dn%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-users/349430fd-d9af-47b4-9412-57ceb2a18e9dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Igor Sheludko

Software Engineer

ish...@google.com


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten
haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen,
dass die E-Mail an die falsche Person gesendet wurde.



This e-mail is confidential. If you received this communication by mistake,
please don't forward it to anyone else, please erase all copies and
attachments, and please let me know that it has gone to the wrong person.

-- 
-- 
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 visit 
https://groups.google.com/d/msgid/v8-users/CAOAEZ4MboN9bXSp21do2C5dcbSgebdMjMct9jZxwd0phAv-fRQ%40mail.gmail.com.

Reply via email to