CEF - Build tests with MDd failure

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

CEF - Build tests with MDd failure

Postby JoaoCosta » Tue Oct 10, 2017 3:49 am

Hello everyone,

I'm trying to update a windows project that depends on CEF and the CEF client test sample.

I'm currently trying to upgrade the project using the automated build cef_binary_3.3163.1671.g700dc25_windows32.tar.bz2

Due to compatibility reasons, I need to build CEF with the Runtime Library as "/MDd" or "/MD" and to simplify the process, I've decided to first build both libcef_dll_wrapper and cefclient and then proceed to update and build my project.

To do so, I've changed the file cef_variables.cmake. In particular, I've changed the CEF_COMPILER_FLAGS_DEBUG and CEF_COMPILER_FLAGS_RELEASE to

Code: Select all
list(APPEND CEF_COMPILER_FLAGS_DEBUG
     /MDd          # Multithreaded debug runtime
     /RTC1         # Disable optimizations
     /Od           # Enable basic run-time checks
)
list(APPEND CEF_COMPILER_FLAGS_RELEASE
     /MD           # Multithreaded release runtime
     /O2           # Optimize for maximum speed
     /Ob2          # Inline any suitable function
     /GF           # Enable string pooling
)


When using the default flags ("/MTd" or "/MT") there seems to be no issue and both the libcef_dll_wrapper and the cefclient projects are built with no errors.
However, using the new flags, while the libcef_dll_wrapper build works, the cefclient build throws the following linker error

Code: Select all
Severity    Code    Description Project File    Line    Suppression State
Error   LNK2038 mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value 'MDd_DynamicDebug' in binding_test.obj  cefclient   D:\Workspace\CEF\build\tests\cefclient\cef_sandbox.lib(at_exit.obj)


In addition, here is the output from the cmake command

Code: Select all
-- The C compiler identification is MSVC 19.0.24215.1
-- The CXX compiler identification is MSVC 19.0.24215.1
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio                                                                                                                                                                                                14.0/VC/bin/cl.exe
-- Check for working C compiler: D:/Program Files (x86)/Microsoft Visual Studio                                                                                                                                                                                                14.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studi                                                                                                                                                                                               o 14.0/VC/bin/cl.exe
-- Check for working CXX compiler: D:/Program Files (x86)/Microsoft Visual Studi                                                                                                                                                                                               o 14.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- *** CEF CONFIGURATION SETTINGS ***
-- Generator:                    Visual Studio 14 2015
-- Platform:                     Windows
-- Project architecture:         x86
-- Binary distribution root:     D:/Workspace/CEF
-- CEF Windows sandbox:          ON
-- Visual Studio ATL support:    ON
-- Standard libraries:           comctl32.lib;rpcrt4.lib;shlwapi.lib;ws2_32.lib;                                                                                                                                                                                               dbghelp.lib;psapi.lib;version.lib;winmm.lib
-- Compile defines:              __STDC_CONSTANT_MACROS;__STDC_FORMAT_MACROS;WIN                                                                                                                                                                                               32;_WIN32;_WINDOWS;UNICODE;_UNICODE;WINVER=0x0601;_WIN32_WINNT=0x601;NOMINMAX;WI                                                                                                                                                                                               N32_LEAN_AND_MEAN;_HAS_EXCEPTIONS=0;PSAPI_VERSION=1;CEF_USE_SANDBOX;CEF_USE_ATL
-- Compile defines (Debug):
-- Compile defines (Release):    NDEBUG;_NDEBUG
-- C compile flags:              /MP;/Gy;/GR-;/W4;/WX;/wd4100;/wd4127;/wd4244;/w                                                                                                                                                                                               d4481;/wd4512;/wd4701;/wd4702;/wd4996;/Zi
-- C compile flags (Debug):      /MDd;/RTC1;/Od
-- C compile flags (Release):    /MD;/O2;/Ob2;/GF
-- C++ compile flags:            /MP;/Gy;/GR-;/W4;/WX;/wd4100;/wd4127;/wd4244;/w                                                                                                                                                                                               d4481;/wd4512;/wd4701;/wd4702;/wd4996;/Zi
-- C++ compile flags (Debug):    /MDd;/RTC1;/Od
-- C++ compile flags (Release):  /MD;/O2;/Ob2;/GF
-- Exe link flags:                /MANIFEST:NO;/LARGEADDRESSAWARE
-- Exe link flags (Debug):       /DEBUG
-- Exe link flags (Release):
-- Shared link flags:
-- Shared link flags (Debug):    /DEBUG
-- Shared link flags (Release):
-- CEF Binary files:             chrome_elf.dll;d3dcompiler_43.dll;d3dcompiler_4                                                                                                                                                                                               7.dll;libcef.dll;libEGL.dll;libGLESv2.dll;natives_blob.bin;snapshot_blob.bin
-- CEF Resource files:           cef.pak;cef_100_percent.pak;cef_200_percent.pak                                                                                                                                                                                               ;cef_extensions.pak;devtools_resources.pak;icudtl.dat;locales
-- Configuring done
-- Generating done
-- Build files have been written to: D:/Workspace/CEF/build


Is there any change that I am missing in the CMakeLists or the macro files?
I thought that changing the macro variables would change the settings for both projects at the same time and thus, they'd be compatible.
JoaoCosta
Newbie
 
Posts: 6
Joined: Tue Oct 10, 2017 3:11 am

Re: CEF - Build tests with MDd failure

Postby magreenblatt » Tue Oct 10, 2017 1:15 pm

You will need to disable the sandbox (run cmake with -DUSE_SANDBOX=Off)
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm

Re: CEF - Build tests with MDd failure

Postby cretz » Tue Oct 10, 2017 5:04 pm

Not necessarily addressing your main issue, but I also needed to change these same args on the libcef wrapper DLL build. I wrote a little script that changes the vcxproj files to what I needed. Here is the code that does the replacement: https://github.com/cretz/doogie/blob/00 ... #L260-L274.
cretz
Techie
 
Posts: 34
Joined: Mon Jun 26, 2017 11:41 am

Re: CEF - Build tests with MDd failure

Postby JoaoCosta » Wed Oct 11, 2017 4:33 am

Thank you. The USE_SANDBOX=OFF option worked.

From my understanding, the cef_sandbox.lib that comes with the automated build uses MTd.
I think the method to use this lib and MDd is to build cef from source using MDd instead of using the automated builds.

Is there any important regarding the use of sandbox rather than not using it?
JoaoCosta
Newbie
 
Posts: 6
Joined: Tue Oct 10, 2017 3:11 am

Re: CEF - Build tests with MDd failure

Postby magreenblatt » Wed Oct 11, 2017 4:45 am

The security benefits of the sandbox are recommended if you're browsing random sites on the internet. If you control the content loaded in the browser then it's not as important.
magreenblatt
Site Admin
 
Posts: 12408
Joined: Fri May 29, 2009 6:57 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 54 guests