Hi,
I am embedding v8 into my C++ application and I am trying to use a recent, stable version. I built 12.8 (e6286d70c55da94a8e12658918989b9b9dc325c8).
I was unable to build with `use_custom_libcxx` set to false and I read online that MSVC support is mostly a nice-to-have. To use this, though, I believe I have to use the clang-cl and libc++ from the v8 build process to build my application that is embedding it.
So, I've been trying for a few weeks now to migrate. Things seem to be working mostly fine, but I am running into some build issues with my applications that I cannot resolve.
Below I am going to share some reproducible snippets of code and their errors. Hopefully someone will be able to put me in the right direction because I am very stuck.
I can't figure out how to put in code blocks, so please forgive the formatting.
# test.cpp
------------------
#include <stdexcept>
#include <memory>
int main() {
throw std::runtime_error("Hello, World!"); // breaks
std::make_shared<int>(2); // breaks
std::make_unique<int>(2); // this is fine
}
```
clang-cl.exe -v test.cpp -fuse-ld=lld /clang:-fexceptions /EHsc -I"W:\third_party\libcxx\include" -I"W:\third_party\libcxx\include.19" -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG "W:\third_party\libcxx\Debug\lib\libc++.dll.lib"
```
In the command above, the include directories are `//third_party/libc++/src/include` and `//third_party/llvm-build/Release+Asserts/lib/clang/19/lib/include` from the v8 project respectively.
The files `__assertion_handler` and `__config_site` were both copied into the first include dir from `//build_tools/third_party/libc++`
The errors:
```
"W:\\VSSource\\repos\\ViciOnlineSDL2\\third_party\\clang\\lld-link" -out:test.exe "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\lib\\x64" "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.41.34120\\atlmfc\\lib\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\ucrt\\x64" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.26100.0\\um\\x64" -nologo "C:\\Users\\kovac\\AppData\\Local\\Temp\\test-7eb16d.obj" "W:\\VSSource\\repos\\ViciOnlineSDL2\\third_party\\libcxx\\Debug\\lib\\libc++.dll.lib"
lld-link: error: undefined symbol: __declspec(dllimport) public: __cdecl std::runtime_error::runtime_error(char const *)
>>> referenced by C:\Users\kovac\AppData\Local\Temp\test-7eb16d.obj:(main)
lld-link: error: undefined symbol: public: __cdecl std::runtime_error::runtime_error(class std::runtime_error const &)
>>> referenced by C:\Users\kovac\AppData\Local\Temp\test-7eb16d.obj:(_CT??_R0?AVruntime_error@std@@@8??0runtime_error@std@@QEAA@AEBV01@@Z24)
lld-link: error: undefined symbol: public: virtual __cdecl std::runtime_error::~runtime_error(void)
>>> referenced by C:\Users\kovac\AppData\Local\Temp\test-7eb16d.obj:(_TI2?AVruntime_error@std@@)
clang-cl: error: linker command failed with exit code 1 (use -v to see invocation)
```