Build only Chromium Network Stack from CEF
Posted: 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,
- (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:
Above symbol is exported in net.dll, I dumped symbol table using objdump and found std::__1::basic_string:
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!
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!