I am sure you don't want to statically link libv8.a multiple times.

I think you need to statically link libv8.a with your main program and force 
all symbols to be exported.  Then your loaded .so can find the symbols for 
libv8 in your main program.

Ideally you shouldn't have to static link with libv8.a at all.  I bet there are 
gcc/ld flags that would allow all to be .so.

On Oct 6, 2011, at 7:25 AM, Ondřej Žára wrote:

> Hi Mike,
> 
> first of all, the dlopen() call is okay: all my modules (in the failing 
> scenario described above) are linked with (static) libv8.a, so they do not 
> lack V8 symbols. The dlsym() call, on the other hand, begins interacting with 
> V8 API, which segfaults - most probably because of some global state V8 
> depends on (and is confused by having multiple V8 instances in memory).
> 
> As for the GCC option to export all symbols: do you suggest compiling v8cgi 
> itself first (with libv8.a), then linking all secondary modules against this 
> binary, not against libv8?
> 
> 
> Thanks,
> Ondrej
> 
> 
> 
> 2011/10/6 Michael Schwartz <[email protected]>
> Hey Ondrej,
> 
> There are flags for GCC that force export of ALL public symbols.  This should 
> allow your .so to find the symbols in your main binary.  There may be another 
> switch that forces the whole .a file to be linked in, not just the referenced 
> (by your main binary) symbols.
> 
> Hope that's enough to get you going in the right direction.
> 
> 
>  
> Also, you are probably getting an error on dlopen(), so you should not be 
> calling dlsym()…
> 
> :)
> 
> On Oct 4, 2011, at 10:51 PM, ondras wrote:
> 
>> Hi,
>> 
>> please forgive if this question is not directly related to V8 itself, but 
>> rather to gcc/c++ usage.
>> 
>> My project (v8cgi) uses a main binary and several (loadable) modules. These 
>> modules are implemented as shared libraries; both the main binary and 
>> modules use V8.
>> Under normal circumstances, I use a shared V8 library and everything works 
>> cool.
>> 
>> One of v8cgi users recently suggested if it would be possible to use a 
>> static build of libv8. I tried that and failed: having V8 linked to both the 
>> main binary *and* all the modules seems to crash badly (segfault) when I 
>> dlsym() the first external module.
>> 
>> 1) is the static V8 the reason why the scenario described above segfaults?
>> 2) how can I avoid this? Is it actually possible to use static V8 from 
>> within those loadable modules?
>> 
>> 
>> Thanks,
>> Ondrej Zara
>> 
>> 
>> -- 
>> v8-users mailing list
>> [email protected]
>> http://groups.google.com/group/v8-users
> 
> 
> -- 
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users
> 
> 
> -- 
> v8-users mailing list
> [email protected]
> http://groups.google.com/group/v8-users

-- 
v8-users mailing list
[email protected]
http://groups.google.com/group/v8-users

Reply via email to