v8::ScriptOrigin inline constructor not visible

53 views
Skip to first unread message

Adam Bennett

unread,
Jun 21, 2022, 12:23:34 PM6/21/22
to v8-users
I'm getting an error trying to construct a ScriptOrigin object. Confirming the compiler error, my IDE only resolves the implicit copy and move constructors.

v8_api.cc: error: no matching constructor for initialization of 'v8::ScriptOrigin'

I'm building my project with CMake and Apple clang version 13.1.6 and using an embedded v8 with args.gn:

v8_static_library=true
v8_monolithic=true
v8_use_external_startup_data=false
is_component_build=false
use_custom_libcxx=false

If I change v8config.h to define V8_INLINE as an empty string, I still can't resolve v8::ScriptOrigin::ScriptOrigin(...).

When I run nm I get:

libv8_monolith.a:v8-inspector-impl.o: 0000000000001070 0000000000000000 T v8::ScriptOrigin::ScriptOrigin(v8::Isolate*, v8::Local<v8::Value>, int, int, bool, int, v8::Local<v8::Value>, bool, bool, bool, v8::Local<v8::Data>)
libv8_monolith.a:v8-inspector-impl.o: 00000000000070a0 0000000000000000 T v8::ScriptOrigin::ScriptOrigin(v8::Isolate*, v8::Local<v8::Value>, int, int, bool, int, v8::Local<v8::Value>, bool, bool, bool, v8::Local<v8::Data>)

It looks like it's exporting a symbol twice for each object that uses it.

I get the same nm result when I build libv8_monolith.a with args.gn `v8_no_inline=true`, or without it or if I replace the #define V8_INLINE blocks with `#define V8_INLINE inline` or `#define V8_INLINE /*not inlining*/` or delete V8_INLINE from ScriptOrigin.

I'm stumped. Why is it being exported as a symbol whether I build with `v8_no_inline` or not and why is it being exported twice for each comp unit that uses it?

I should be able to modify the v8-message.h header file to not be inline and then I could resolve the constructor from my codebase. However, I'm guessing it wouldn't link against it because there's duplicate symbols in the lib.

Because I've never used inline I created a sandbox project and (consistent with the docs I've read) confirmed that inlining prevents an external symbol and linking from another object. My sample project does not show symbols for always_inlined fns yet I see them in libv8_monolith.a.

How does this API work within the v8 codebase, or from other embedders like node.js or sample v8 code I've seen demoing module resolution (and using ScriptOrigin)?

Adam Bennett

unread,
Jun 23, 2022, 11:54:20 AM6/23/22
to v8-users
Reply all
Reply to author
Forward
0 new messages