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.

Reply via email to