Hi Ben,

I believe that all of the issues you've seen are due to V8's reliance on the 
Clang-specific compiler flag /Zc:dllExportIncludes-. This flag says "if a 
function is both inline and declspec(dll(ex|im)port), then ignore the declspec 
part". This flag gave a nice speedup to Chromium component builds when it was 
introduced, but no trybots build without it, so building without that flag has 
been regularly broken since. When you try to link using MSVC, it dutifully 
tries to find the functions that are marked dllimport, but Clang never exported 
them due to this flag.

Some possibly useful resources:

LLVM post about this flag: 
http://blog.llvm.org/2018/11/30-faster-windows-builds-with-clang-cl_14.html?m=1
V8 bug about problems building without this flag: 
https://bugs.chromium.org/p/v8/issues/detail?id=9465&can=1&q=dllexportinlines&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary%20HW%20OS%20Component%20Stars
Explanation of MSVC's behavior on inline dllexport functions: 
https://devblogs.microsoft.com/oldnewthing/20140109-00/?p=2123
Request to add this flag to MSVC: 
https://developercommunity.visualstudio.com/idea/374754/implement-zcdllexportinlines-aka-fvisibility-inlin.html





________________________________
From: v8-dev@googlegroups.com <v8-dev@googlegroups.com> on behalf of Ben Ernst 
<boi...@gmail.com>
Sent: Friday, November 15, 2019 6:11 PM
To: v8-dev <v8-dev@googlegroups.com>
Subject: [EXTERNAL] [v8-dev] Re: Intention to contribute, to fix MSVC 
"component build", broken from v7.2 onwards.

I have a quick question someone might be able to help with. This is a slightly 
different angle to my parent post, in this question I'm using the clang build 
(not the MSVC build), building the component build (successfully), and then 
importing the DLL into an MSVC project. I get five unresolved symbols detailed 
below. Why on earth would CLANG not export these symbols? Is there any way I 
might be able to fix this in V8?

__declspec(dllimport) public: void __cdecl 
v8::ObjectTemplate::SetIndexedPropertyHandler(void (__cdecl*)(unsigned 
int,class v8::PropertyCallbackInfo<class v8::Value> const &),void 
(__cdecl*)(unsigned int,class v8::Local<class v8::Value>,class 
v8::PropertyCallbackInfo<class v8::Value> const &),void (__cdecl*)(unsigned 
int,class v8::PropertyCallbackInfo<class v8::Integer> const &),void 
(__cdecl*)(unsigned int,class v8::PropertyCallbackInfo<class v8::Boolean> const 
&),void (__cdecl*)(class v8::PropertyCallbackInfo<class v8::Array> const 
&),class v8::Local<class v8::Value>)
__declspec(dllimport) public: __cdecl v8::Isolate::Scope::Scope(class 
v8::Isolate *)
__declspec(dllimport) public: __cdecl v8::Isolate::Scope::~Scope(void)
__declspec(dllimport) public: __cdecl 
v8::EscapableHandleScope::~EscapableHandleScope(void)
__declspec(dllimport) public: char * __cdecl 
v8::String::Utf8Value::operator*(void)


On Saturday, 16 November 2019 10:01:33 UTC+10:30, Ben Ernst wrote:
Hey all,

I intend to try my hand at contributing here, so I'm introducing myself in 
accordance with the directions on the "contributing to V8" page. The MSVC 
"component build" of V8 has been broken since v7.2. I will do my best to get it 
working again. I thoroughly appreciate any guidance along the way. Dan Elphick 
has been a huge help 
already<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fforum%2F%23!topic%2Fv8-users%2FwjRGE98lIGY&data=02%7C01%7Cseth.brenith%40microsoft.com%7C817d5b875b174d3e5b0c08d76a3a4ccf%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637094670941298149&sdata=RNqzCjzuYO77mgxVIjN8haF%2BSiVZQsrJ3HTqQujpwD0%3D&reserved=0>.
 This is my first time contributing to a big project, I will do my best to work 
in accordance with the documented processes. If you're wondering why the clang 
build is not working for me, here's my linker 
errors<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fforum%2F%23!topic%2Fv8-users%2FQxdXGgMsgZY&data=02%7C01%7Cseth.brenith%40microsoft.com%7C817d5b875b174d3e5b0c08d76a3a4ccf%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637094670941308140&sdata=Rn3Qd4wRD%2BWSQFsbiSbg%2FblQxOhoklbM09qh7nSWhAE%3D&reserved=0>.
 Speaking from a position of a relative newbie, it looks like clang doesn't 
think it needs to export certain symbols, but MSVC expects them to be exported.

I do have a question someone might be able to help me with. If I manage to get 
this build working, would it be possible/practical/desirable to add this 
configuration to the CI build system long term? Dan did mention it's "not 
officially supported".

Any way, wish me luck.
Cheers,
Ben

--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev<https://nam06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fgroups.google.com%2Fgroup%2Fv8-dev&data=02%7C01%7Cseth.brenith%40microsoft.com%7C817d5b875b174d3e5b0c08d76a3a4ccf%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637094670941308140&sdata=2iy6LqCV%2FYSH7H80RV%2FfCaohLeY%2FB2m%2F%2FQsg2FztjKg%3D&reserved=0>
---
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
v8-dev+unsubscr...@googlegroups.com<mailto:v8-dev+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/ff6d54b0-c658-4e8c-bc4f-2fc73f5035c7%40googlegroups.com<https://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fv8-dev%2Fff6d54b0-c658-4e8c-bc4f-2fc73f5035c7%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=02%7C01%7Cseth.brenith%40microsoft.com%7C817d5b875b174d3e5b0c08d76a3a4ccf%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637094670941318135&sdata=TbHmLoubBEYj8CtQq7ytlh2izaHGw%2FkDoKhHcHHnIG4%3D&reserved=0>.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/MN2PR00MB047705247F8CC837333CD9558B730%40MN2PR00MB0477.namprd00.prod.outlook.com.

Reply via email to