Build only Chromium Network Stack from CEF

Discussion of current events and participation in intelligent conversation with other CEF users.

Build only Chromium Network Stack from CEF

Postby asah » Thu Jun 25, 2020 1:56 am

Hello Everyone!

I'm working on a project (in VS 2017 -MSVC toolchain) which is dependent on network stack of the Chromium browser. Getting few linking errors (Unresolved External Symbol) related with std::basic_string. Everything was fine till chromium v57.

Details:
1. used CEF-3904 to pull chromium source (78.0.3904.108) and ran create.bat file.
2. for building binaries,
Code: Select all
ninja -C out/Release_GN_x86 chrome_net /*net_with_v8*/

- (internally replaced net_with_v8 to chrome_net in various BUILD.gn files accordingly)
- GN args flag, is_component_build=true

Got binaries (chrome_net.dll, net.dll, base.dll, etc., and their respective *.lib files), added these in my project.
The project compiled successfully (of-course by commenting the __clang__ error) but giving few linking errors as below:
Code: Select all
Error   LNK2001   unresolved external symbol "public: bool __thiscall net::HttpRequestHeaders::GetHeader(class base::BasicStringPiece<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > > const &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *)const " (?GetHeader@HttpRequestHeaders@net@@QBE_NABV?$BasicStringPiece@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@base@@PAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)   Client   <path_stripped>\chromium_transport.obj   1   


Above symbol is exported in net.dll, I dumped symbol table using objdump and found std::__1::basic_string:
Code: Select all
$ objdump -t net.dll.lib | grep GetHeader
[  3](sec  1)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 __imp_?GetHeader@HttpRequestHeaders@net@@QBE_NABV?$BasicStringPiece@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@base@@PAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z
[  5](sec  3)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 ?GetHeader@HttpRequestHeaders@net@@QBE_NABV?$BasicStringPiece@V?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@base@@PAV?$basic_string@DU?$char_traits@D@__1@std@@V?$allocator@D@23@@__1@std@@@Z


I tried to disable custom C++ library by using below flags (I'm aware of the fact that chromium switched to clang-cl on windows from v64):
GN args flag, "use_custom_libcxx=false" and "use_custom_libcxx_for_host=false", but ninja gave lots of compile time error in chrome_net build.

I found that CEF exports C API from libcef_dll_wrapper.lib as per this comment:https://www.magpcss.org/ceforum/viewtopic.php?f=6&t=17036#p43106 by Marshall.

Is there any way I can change the C++ library in chrome_net build given that I have to use MSVC only for my project? Or I need to do something else which will be more efficient.

Any help is appreciated. Thanks in advance!
asah
Newbie
 
Posts: 3
Joined: Wed Jun 24, 2020 11:38 pm

Re: Build only Chromium Network Stack from CEF

Postby magreenblatt » Thu Jun 25, 2020 10:01 am

Your question appears unrelated to CEF. Looks like you've already asked on the appropriate net-dev mailing list.
magreenblatt
Site Admin
 
Posts: 10310
Joined: Fri May 29, 2009 6:57 pm

Re: Build only Chromium Network Stack from CEF

Postby asah » Thu Jun 25, 2020 11:51 pm

Yeah, as I was not sure about the correct platform to ask from, I posted it on both places.
But In general, could we somehow consume clang-cl binary in some msvc project which is ABI incompatible with it?
asah
Newbie
 
Posts: 3
Joined: Wed Jun 24, 2020 11:38 pm

Re: Build only Chromium Network Stack from CEF

Postby magreenblatt » Fri Jun 26, 2020 6:45 am

You would need to wrap it in a C ABI, similar to how libcef is designed, to avoid leaking stl and runtime dependencies.
magreenblatt
Site Admin
 
Posts: 10310
Joined: Fri May 29, 2009 6:57 pm

Re: Build only Chromium Network Stack from CEF

Postby asah » Mon Jun 29, 2020 6:35 am

Thanks for the reply!
It seems like chromium already has cronet (C API wrapper for mobile devices) which has "native" build support for x86/x64. Hoping to use that in my VS project.
asah
Newbie
 
Posts: 3
Joined: Wed Jun 24, 2020 11:38 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 1 guest