我试图使用通过V8编译的vcpkg install v8库,但是收到了以下错误:
Failed to deserialize the V8 snapshot blob. This can mean that the snapshot blob file is corrupted or missing.
我正在随附的hello-world.cc示例上测试它:
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();
Isolate::CreateParams create_params;
create_params.array_buffer_allocator =
v8::ArrayBuffer::Allocator::NewDefaultAllocator();
Isolate* isolate = Isolate::New(create_params); // << here is the crash
Isolate::Scope isolate_scope(isolate);此错误是在Isolate* isolate = Isolate::New(create_params);中生成的,因为内部变量i_isole没有分配任何snapshot_blog:
if (!i::Snapshot::Initialize(i_isolate)) {
// If snapshot data was provided and we failed to deserialize it must
// have been corrupted.
if (i_isolate->snapshot_blob() != nullptr) {
FATAL(
"Failed to deserialize the V8 snapshot blob. This can mean that the "
"snapshot blob file is corrupted or missing.");
}不幸的是,我无法找到对此错误的任何引用。谢谢你的建议。
更新:我正在Visual 2019上试用,32位构建和64位构建也一样。
更新:基于vcpkg.json文件,版本为"9.0.257.17“。我将尝试更新到最新的版本,如果这不是一些已经修复的错误。
发布于 2021-10-25 11:40:30
要使v8::V8::InitializeExternalStartupData(argv[0]);工作,请确保文件snapshot_blob.bin与您编译的可执行文件位于同一个目录中。或者,确保您正在传递正确的路径,而不是argv[0]。
我对vcpkg install v8一无所知;您得到的库可能是在没有V8_USE_EXTERNAL_STARTUP_DATA的情况下编译的,在这种情况下,您也应该关闭构建的外部启动数据。如果您根本没有snapshot_blob.bin文件,这将是一个指示,表明情况是这样的。
https://stackoverflow.com/questions/69699327
复制相似问题