Reputation: 9094
I have seen similar questions, but none of them seem to work for me. I am using the hello-world example code as a basis:
v8::V8::InitializeICUDefaultLocation(argv[0]);
v8::V8::InitializeExternalStartupData(argv[0]);
std::unique_ptr<v8::Platform> platform = v8::platform::NewDefaultPlatform();
v8::V8::InitializePlatform(platform.get());
v8::V8::Initialize();
// Create a new Isolate and make it the current one.
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator =
v8::ArrayBuffer::Allocator::NewDefaultAllocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
The segfault happens in the last line above. I link against libv8_monolith. I get the following abort:
Thread 1 "hiram-renderer-" received signal SIGSEGV, Segmentation fault.
__GI___libc_free (warning: Could not find DWO CU obj/v8_initializers/interpreter-generator.dwo(0x41869846475c35aa) referenced by CU at offset 0x18018ec [in module /home/csnelson/meps/projects/mf/renderer-hiram/.build/renderer-hiram/linux/amd64/debug/engine/hiram-renderer-engine-test]
mem=0x400000000000000) at malloc.c:3085
3085 malloc.c: No such file or directory.
(gdb) bt
#0 __GI___libc_free (mem=0x400000000000000) at malloc.c:3085
#1 0x00000000023510e8 in v8::internal::interpreter::GenerateBytecodeHandler(v8::internal::Isolate*, v8::internal::interpreter::Bytecode, v8::internal::interpreter::OperandScale, int, v8::internal::AssemblerOptions const&) () at ../../src/interpreter/interpreter-generator.cc:3304
warning: Could not find DWO CU obj/v8_initializers/setup-builtins-internal.dwo(0x2e9f81fe7c4f3a21) referenced by CU at offset 0x18010a8 [in module /home/csnelson/meps/projects/mf/renderer-hiram/.build/renderer-hiram/linux/amd64/debug/engine/hiram-renderer-engine-test]
#2 0x0000000001f648b3 in v8::internal::(anonymous namespace)::GenerateBytecodeHandler(v8::internal::Isolate*, int, char const*, v8::internal::interpreter::OperandScale, v8::internal::interpreter::Bytecode) () at ../../src/builtins/setup-builtins-internal.cc:284
#3 0x0000000001f55960 in v8::internal::SetupIsolateDelegate::SetupBuiltinsInternal(v8::internal::Isolate*) ()
at ../../src/builtins/setup-builtins-internal.cc:348
warning: Could not find DWO CU obj/v8_init/setup-isolate-full.dwo(0xe7b834785ad1ac3a) referenced by CU at offset 0x1801028 [in module /home/csnelson/meps/projects/mf/renderer-hiram/.build/renderer-hiram/linux/amd64/debug/engine/hiram-renderer-engine-test]
#4 0x0000000001f401c7 in SetupBuiltins () at ../../src/setup-isolate-full.cc:18
warning: Could not find DWO CU obj/v8_base/isolate.dwo(0xe943b1082c1ddbf9) referenced by CU at offset 0xd9abfc [in module /home/csnelson/meps/projects/mf/renderer-hiram/.build/renderer-hiram/linux/amd64/debug/engine/hiram-renderer-engine-test]
#5 0x00000000019665b3 in Init () at ../../src/isolate.cc:3363
#6 0x0000000001965cdd in v8::internal::Isolate::InitWithoutSnapshot() () at ../../src/isolate.cc:3254
warning: Could not find DWO CU obj/v8_base/api.dwo(0xbdbb31bc688b926c) referenced by CU at offset 0x1d5b0a [in module /home/csnelson/meps/projects/mf/renderer-hiram/.build/renderer-hiram/linux/amd64/debug/engine/hiram-renderer-engine-test]
#7 0x0000000001235bd7 in Initialize () at ../../src/api.cc:8205
#8 0x000000000123612f in New () at ../../src/api.cc:8217
#9 0x0000000001119b11 in main (argc=1, argv=0x7fffffffe3b8) at ../../../../../engine/test/main.cpp:28
Any help would be appreciated. I've tried a number of things, compiling with snapshots enabled and disabled and so on. Nothing seems to make any difference.
Upvotes: 1
Views: 428
Reputation: 9094
As it turns out, I was building against v8 head. I don't know if head is broken or not, since d8 and all of the test programs worked fine. However, when I compiled a minimal program taking the v8 hello world source almost verbatim the initialize hung indefinitely.
Finally, I discovered that I needed to do a full checkout of the source. Previously I was doing:
fetch --no-history v8
However, when I did a checkout of the branch:
git checkout branch-heads/7.2
And then ran:
gclient sync
It would always fail. Now I run:
fetch v8
git checkout branch-heads/7.2
gclient sync
Then I configure my build and compile. The resulting libv8_monolith.a works with both my minimal test harness and the more complete app I am trying to embed in.
There very well may be an interaction with a later v8 and something in my larger app. However, for now things are working so I hope that it's just a bug in head that is misbehaving with my environment.
Upvotes: 1