gpt4 book ai didi

c++ - 在 Visual Studio 中构建和链接 V8

转载 作者:可可西里 更新时间:2023-11-01 18:38:21 24 4
gpt4 key购买 nike

我真的很难弄清楚如何在 Windows 上构建 Google 的 V8。

到目前为止我有:

  • 已安装 depot_tools
  • 获取 v8:获取 v8
  • 创建项目文件:gn gen --ide=vs2015 out/Default
  • 在 VS2015 中构建整个解决方案

我的问题是,这只会产生大量的 .obj 文件,而不会产生 .lib 文件。

我已将项目(v8、v8_base、v8_libbase 等)设置为配置类型:静态库 (.lib): Project config screenshot

我不确定如何让 Visual Studio 生成库文件。任何帮助表示赞赏!

更新

我已经通过以下步骤成功生成了库文件:

  • 打开 VS 开发者命令行
  • 导航到包含 v8_basev8_libbasev8_external_snapshotv8_libplatform 的 obj 文件的目录。
  • 对于其中的每一个,使用 lib 命令手动构建一个 .lib,例如lib/o:v8_base *.obj
  • 将所有这些 lib 文件与 icui18n.libicuuc.lib 一起复制到一个目录中(这些文件在构建期间创建得很好。)

我现在正在尝试实际使用这些库,但遇到了一个新问题,非常感谢您的帮助。我在 VS 中链接了以下库:v8_base.lib; v8_libbase.lib; v8_external_snapshot.lib; v8_lib平台.lib; icui18n.lib; icuuc.lib; winmm.lib;,但是我遇到了一些未解析符号的问题:

unresolved external symbol "public: static void __cdecl v8::sampler::Sampler::TearDown(void)" (?TearDown@Sampler@sampler@v8@@SAXXZ) referenced in function "public: static void __cdecl v8::internal::V8::TearDown(void)" (?TearDown@V8@internal@v8@@SAXXZ) TriviaBot   v8_base.lib(v8.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::Stop(void)" (?Stop@Sampler@sampler@v8@@QEAAXXZ) referenced in function "private: void __cdecl v8::internal::Isolate::Deinit(void)" (?Deinit@Isolate@internal@v8@@AEAAXXZ) v8_base.lib(isolate.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::Stop(void)" (?Stop@Sampler@sampler@v8@@QEAAXXZ) v8_base.lib(log.obj)
unresolved external symbol "public: __cdecl v8::sampler::Sampler::Sampler(class v8::Isolate *)" (??0Sampler@sampler@v8@@QEAA@PEAVIsolate@2@@Z) referenced in function "public: __cdecl v8::internal::Ticker::Ticker(class v8::internal::Isolate *,int)" (??0Ticker@internal@v8@@QEAA@PEAVIsolate@12@H@Z) v8_base.lib(log.obj)
unresolved external symbol "public: __cdecl v8::sampler::Sampler::Sampler(class v8::Isolate *)" (??0Sampler@sampler@v8@@QEAA@PEAVIsolate@2@@Z) v8_base.lib(cpu-profiler.obj)
unresolved external symbol "public: virtual __cdecl v8::sampler::Sampler::~Sampler(void)" (??1Sampler@sampler@v8@@UEAA@XZ) referenced in function "public: virtual void * __cdecl v8::internal::Ticker::`scalar deleting destructor'(unsigned int)" (??_GTicker@internal@v8@@UEAAPEAXI@Z)
unresolved external symbol "public: virtual __cdecl v8::sampler::Sampler::~Sampler(void)" (??1Sampler@sampler@v8@@UEAA@XZ) v8_base.lib(cpu-profiler.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::Start(void)" (?Start@Sampler@sampler@v8@@QEAAXXZ) referenced in function "public: void __cdecl v8::internal::Profiler::Engage(void)" (?Engage@Profiler@internal@v8@@QEAAXXZ) v8_base.lib(log.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::IncreaseProfilingDepth(void)" (?IncreaseProfilingDepth@Sampler@sampler@v8@@QEAAXXZ) referenced in function "public: void __cdecl v8::internal::Profiler::Engage(void)" (?Engage@Profiler@internal@v8@@QEAAXXZ) v8_base.lib(log.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::IncreaseProfilingDepth(void)" (?IncreaseProfilingDepth@Sampler@sampler@v8@@QEAAXXZ) v8_base.lib(cpu-profiler.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::DecreaseProfilingDepth(void)" (?DecreaseProfilingDepth@Sampler@sampler@v8@@QEAAXXZ) referenced in function "public: void __cdecl v8::internal::Profiler::Disengage(void)" (?Disengage@Profiler@internal@v8@@QEAAXXZ) v8_base.lib(log.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::DecreaseProfilingDepth(void)" (?DecreaseProfilingDepth@Sampler@sampler@v8@@QEAAXXZ) v8_base.lib(cpu-profiler.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::DoSample(void)" (?DoSample@Sampler@sampler@v8@@QEAAXXZ) referenced in function "public: virtual void __cdecl v8::internal::SamplingThread::Run(void)" (?Run@SamplingThread@internal@v8@@UEAAXXZ) v8_base.lib(log.obj)
unresolved external symbol "public: void __cdecl v8::sampler::Sampler::DoSample(void)" (?DoSample@Sampler@sampler@v8@@QEAAXXZ) v8_base.lib(cpu-profiler.obj)
unresolved external symbol "public: static void __cdecl v8::sampler::Sampler::SetUp(void)" (?SetUp@Sampler@sampler@v8@@SAXXZ) referenced in function "private: static void __cdecl v8::internal::V8::InitializeOncePerProcessImpl(void)" (?InitializeOncePerProcessImpl@V8@internal@v8@@CAXXZ) v8_base.lib(v8.obj)

所有错误似乎都与 v8::sampler 有关 - 再次感谢您的帮助!

最佳答案

看来我又在回答我自己的问题了。我希望我在问题中列出的信息对像我一样受过时文档困扰的任何人都有用。

除了我什至没有注意到 v8_libsampler 项目并忘记为其生成库文件之外,我的更新涵盖了所有需要的内容。一旦我这样做并链接它,我就可以开始运行了!

关于c++ - 在 Visual Studio 中构建和链接 V8,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38674676/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com