1

I want to debug the chromium code to check how it compiles the javascript code. I have downloaded the chromium code and trying to build cef solution file using visual studio but I am getting the following error:

error LNK1112: module machine type 'x64' conflicts with target machine type 'X86' \third_party\libjpeg_turbo\jccolss2-64.obj cefclient

error MSB3073: The command "call ninja.exe -C ..\out\Debug\ cefclient" exited with code 1. D:\Ishan\Chromium\Chromium\chromium\src\cef\cefclient.vcxproj cefclient

Can anyone help me to resolve this error

Thanks Ishan jain

ishan jain
  • 681
  • 3
  • 10
  • 27

2 Answers2

2

Chromium can be built only on 64-bit Windows, it doesn't matter if you are building 32-bit on 64-bit. Windows 7 x64 or later is a must.

It seems you have configured build to be 64-bit (if you are using ninja, most likely with SET GYP_DEFINES=target_arch=x64) but you are building 32-bit, most likely using
ninja -C out\Debug. So it seems you have a configured a 64-build but you are building 32-bit.

64-bit build is in Debug_x64 (or Debug_64, I don't remember now). So:
- if you configured target_arch=x64, build with ninja -C out\Debug_x64
- if you configured target_arch=ia32 (or let empty, I think default build is 32-bit on Windows), build with ninja -C out\Debug

AFAIK you cannot build in the same directory - but maybe I'm wrong - both 32 and 64 build (because of the generated .ninja files, mainly). If you are using SET GYP_GENERATORS=msvs-ninja,ninja (mainly if you are generating Visual Studio solution), it may work, but msvs-ninja is not supported, nor maintained (anymore).

Edit: ninja build from Visual Studio example.
VS External Tools > Add an entry like:
Title Build libcef Debug
Command F:\dev\CEF\2357\build.bat
(sources in F:\dev\CEF\2357\x86\chromium)
Arguments debug
Initial directory F:\dev\CEF\2357

My layout is this (build branch is 2357):
F:\dev\CEF\2357 root directory
/
  automate-git.py
  build.bat
  x86/
    chromium/

build.bat is the file below; x86/ directory is manually created. Under x86 I have the checkout of chromium (cef and depot_tools will appear also under x86/).


My build.bat file is like this (details can be easily figured out):

@echo off

:: set env vars affecting CEF build
SET GYP_GENERATORS=msvs-ninja,ninja
SET GYP_MSVS_VERSION=2013
SET DEPOT_TOOLS_WIN_TOOLCHAIN=0
SET GYP_DEFINES=target_arch=ia32
SET DEPOT_TOOLS=F:\dev\CEF\2357\x86\depot_tools
SET PATH=%DEPOT_TOOLS%;%PATH%

set ROOTDIST=F:\dev\CEF\2357\x86\.deploy\
set BUILDOUT=F:\dev\CEF\2357\x86\chromium\src\out
set REDIST=F:\dev\CEF\2357\x86\chromium\src\cef\tools\distrib\win
set CEFDIST=3.43.0.2357.18.20150512

:: change to directory if not already there
PUSHD
set CURDIR=%CD%
@echo Current directory is %CURDIR%
if [%CURDIR%] EQU [F:\dev\CEF\2357] goto l_config
F:
cd F:\dev\CEF\2357 
set CURDIR=%CD%
@echo Current directory changed to %CURDIR%

:l_config
F:\dev\CEF\2357\automate-git.py --download-dir=F:\dev\CEF\2357\x86 --branch=2357 --no-update
goto l_build

:l_build
cd x86\chromium\src

if [%1%] EQU [all] goto l_build_all
if [%1%] EQU [debug] goto l_build_dbg
if [%1%] EQU [release] goto l_build_rel
if [%1%] EQU [distrib] goto l_build_distrib
if [%1%] EQU [distclean] goto l_build_distclean
if [%1%] EQU [clean] goto l_build_clean
goto l_error

:l_build_all
@echo Building libcef branch 2357 Debug.
ninja -C out\Debug cefclient
@echo Building libcef branch 2357 Release.
ninja -C out\Release cefclient
@echo Build libcef Debug,Release branch 2357 finished.
goto l_build_distclean

:l_build_dbg
@echo Building libcef branch 2357 Debug.
ninja -C out\Debug cefclient
@echo Build libcef Debug branch 2357 finished.
goto l_end

:l_build_rel
@echo Building libcef branch 2357 Release.
ninja -C out\Release cefclient
@echo Build libcef Release branch 2357 finished.
goto l_end

:l_build_clean
@echo Cleaning build libcef branch 2357.
ninja -C out\Debug -t clean cefclient
ninja -C out\Release -t clean cefclient
@echo Clean libcef branch 2357 finished.
goto l_end

:l_build_distclean
@echo Clean libcef branch 2357 %CEFDIST% distribution.
rmdir /s /q %ROOTDIST%\%CEFDIST%
goto l_build_distrib

:l_build_distrib
@echo Make libcef branch 2357 %CEFDIST% distribution.
@echo Deploy directory: %ROOTDIST%%CEFDIST%
:: /.patch 
:: /include
::  /base
::   /internal
::  /capi
::  /internal
::  /wrapper
:: /lib
::  /Win32
::   /Debug
::    /lib
::    /locales
::   /Release
::    /lib
::    /locales
::
:: ensure target path
mkdir %ROOTDIST%\%CEFDIST%
mkdir %ROOTDIST%\%CEFDIST%\include
mkdir %ROOTDIST%\%CEFDIST%\lib
mkdir %ROOTDIST%\%CEFDIST%\lib\Win32
mkdir %ROOTDIST%\%CEFDIST%\lib\Win32\Debug
mkdir %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib
mkdir %ROOTDIST%\%CEFDIST%\lib\Win32\Release
mkdir %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib

:: include files
xcopy    f:\dev\CEF\2357\x86\chromium\src\cef\include         %ROOTDIST%\%CEFDIST%\include             /S /E /Y /I 
:: bdCefVer.h
copy  /Y f:\dev\CEF\2357\x86\chromium\src\cef\bdCefVer.h      %ROOTDIST%\%CEFDIST%\bdCefVer.h

:: Debug
:: locales
xcopy    %BUILDOUT%\Debug\locales   %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\locales   /S /E /Y /I 
:: lib
copy /Y %BUILDOUT%\Debug\libcef.dll.lib                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\libcef.dll.lib
copy /Y %BUILDOUT%\Debug\libEGL.dll.lib                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\libEGL.dll.lib
copy /Y %BUILDOUT%\Debug\libGLESv2.dll.lib                  %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\libGLESv2.dll.lib
copy /Y %BUILDOUT%\Debug\ffmpegsumo.dll.lib                 %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\ffmpegsumo.dll.lib
copy /Y %BUILDOUT%\Debug\obj\cef\cef_sandbox.lib            %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\cef_sandbox.lib
copy /Y %BUILDOUT%\Debug\obj\cef\libcef_dll_wrapper.lib     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\libcef_dll_wrapper.lib
copy /Y %BUILDOUT%\Debug\obj\cef\libcef_static.lib          %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\lib\libcef_static.lib
:: binaries, paks, redistributables
copy /Y %BUILDOUT%\Debug\natives_blob.bin                   %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\natives_blob.bin
copy /Y %BUILDOUT%\Debug\snapshot_blob.bin                  %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\snapshot_blob.bin
copy /Y %BUILDOUT%\Debug\icudtl.dat                         %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\icudtl.dat
:: copy /Y %REDIST%\d3dcompiler_43.dll                      %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\d3dcompiler_43.dll
copy /Y %BUILDOUT%\Debug\d3dcompiler_47.dll                 %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\d3dcompiler_47.dll
copy /Y %BUILDOUT%\Debug\ffmpegsumo.dll                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\ffmpegsumo.dll
copy /Y %BUILDOUT%\Debug\ffmpegsumo.dll.pdb                 %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\ffmpegsumo.dll.pdb
copy /Y %BUILDOUT%\Debug\libcef.dll                         %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libcef.dll
copy /Y %BUILDOUT%\Debug\libcef.dll.pdb                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libcef.dll.pdb
copy /Y %BUILDOUT%\Debug\libEGL.dll                         %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libEGL.dll
copy /Y %BUILDOUT%\Debug\libEGL.dll.pdb                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libEGL.dll.pdb
copy /Y %BUILDOUT%\Debug\libGLESv2.dll                      %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libGLESv2.dll
copy /Y %BUILDOUT%\Debug\libGLESv2.dll.pdb                  %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\libGLESv2.dll.pdb
copy /Y %BUILDOUT%\Debug\cefclient.exe                      %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\cefclient.exe
copy /Y %BUILDOUT%\Debug\wow_helper.exe                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\wow_helper.exe
copy /Y %BUILDOUT%\Debug\wow_helper.pdb                     %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\wow_helper.pdb
copy /Y %BUILDOUT%\Debug\cef.pak                            %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\cef.pak
copy /Y %BUILDOUT%\Debug\cef_100_percent.pak                %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\cef_100_percent.pak
copy /Y %BUILDOUT%\Debug\cef_200_percent.pak                %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\cef_200_percent.pak
copy /Y %BUILDOUT%\Debug\devtools_resources.pak             %ROOTDIST%\%CEFDIST%\lib\Win32\Debug\devtools_resources.pak

:: Release
:: locales
xcopy    %BUILDOUT%\Release\locales %ROOTDIST%\%CEFDIST%\lib\Win32\Release\locales /S /E /Y /I /F
:: lib
copy /Y %BUILDOUT%\Release\libcef.dll.lib                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\libcef.dll.lib
copy /Y %BUILDOUT%\Release\libEGL.dll.lib                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\libEGL.dll.lib
copy /Y %BUILDOUT%\Release\libGLESv2.dll.lib                %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\libGLESv2.dll.lib
copy /Y %BUILDOUT%\Release\ffmpegsumo.dll.lib               %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\ffmpegsumo.dll.lib
copy /Y %BUILDOUT%\Release\obj\cef\libcef_dll_wrapper.lib   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\libcef_dll_wrapper.lib
copy /Y %BUILDOUT%\Release\obj\cef\libcef_static.lib        %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\libcef_static.lib
copy /Y %BUILDOUT%\Release\obj\cef\cef_sandbox.lib          %ROOTDIST%\%CEFDIST%\lib\Win32\Release\lib\cef_sandbox.lib
:: binaries, paks, redistributables
copy /Y %BUILDOUT%\Release\natives_blob.bin                 %ROOTDIST%\%CEFDIST%\lib\Win32\Release\natives_blob.bin
copy /Y %BUILDOUT%\Release\snapshot_blob.bin                %ROOTDIST%\%CEFDIST%\lib\Win32\Release\snapshot_blob.bin
copy /Y %BUILDOUT%\Release\icudtl.dat                       %ROOTDIST%\%CEFDIST%\lib\Win32\Release\icudtl.dat
:: copy /Y %REDIST%\d3dcompiler_43.dll                      %ROOTDIST%\%CEFDIST%\lib\Win32\Release\d3dcompiler_43.dll
copy /Y %BUILDOUT%\Release\d3dcompiler_47.dll               %ROOTDIST%\%CEFDIST%\lib\Win32\Release\d3dcompiler_47.dll
copy /Y %BUILDOUT%\Release\ffmpegsumo.dll                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\ffmpegsumo.dll
copy /Y %BUILDOUT%\Release\ffmpegsumo.dll.pdb               %ROOTDIST%\%CEFDIST%\lib\Win32\Release\ffmpegsumo.dll.pdb
copy /Y %BUILDOUT%\Release\libcef.dll                       %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libcef.dll
copy /Y %BUILDOUT%\Release\libcef.dll.pdb                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libcef.dll.pdb
copy /Y %BUILDOUT%\Release\libEGL.dll                       %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libEGL.dll
copy /Y %BUILDOUT%\Release\libEGL.dll.pdb                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libEGL.dll.pdb
copy /Y %BUILDOUT%\Release\libGLESv2.dll                    %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libGLESv2.dll
copy /Y %BUILDOUT%\Release\libGLESv2.dll.pdb                %ROOTDIST%\%CEFDIST%\lib\Win32\Release\libGLESv2.dll.pdb
copy /Y %BUILDOUT%\Release\cefclient.exe                    %ROOTDIST%\%CEFDIST%\lib\Win32\Release\cefclient.exe
copy /Y %BUILDOUT%\Release\wow_helper.exe                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\wow_helper.exe
copy /Y %BUILDOUT%\Release\wow_helper.pdb                   %ROOTDIST%\%CEFDIST%\lib\Win32\Release\wow_helper.pdb
copy /Y %BUILDOUT%\Release\cef.pak                          %ROOTDIST%\%CEFDIST%\lib\Win32\Release\cef.pak
copy /Y %BUILDOUT%\Release\cef_100_percent.pak              %ROOTDIST%\%CEFDIST%\lib\Win32\Release\cef_100_percent.pak
copy /Y %BUILDOUT%\Release\cef_200_percent.pak              %ROOTDIST%\%CEFDIST%\lib\Win32\Release\cef_200_percent.pak
copy /Y %BUILDOUT%\Release\devtools_resources.pak           %ROOTDIST%\%CEFDIST%\lib\Win32\Release\devtools_resources.pak

copy /Y %REDIST%\README.redistrib.txt                       %ROOTDIST%\%CEFDIST%\README.redistrib.txt

@echo Making distribution libcef Debug,Release branch 2357 finished.
goto l_end

:l_error
@echo Invalid or missing option.
goto l_end

:l_end
F:
cd F:\dev\CEF\2357 
POPD
Cristian Amarie
  • 160
  • 1
  • 8
  • Actually I am able to build now using command prompt which uses ninja. But If I use visual studio to build the chromium, even with debugging configuration is x64, it creates build files in out/Debug directory instead of out/Debug_x64. And it doesnot build full and break in between with above mentioned errors. – ishan jain May 11 '15 at 09:59
  • Because is configured to build x86, and not x64. You can set up ninja build from VS. – Cristian Amarie May 11 '15 at 12:11
  • Can you tell me how I can setup ninja build from VS? It would be very helpful. And one more thing is that can I build from starting in VS, actually I can debug already run cef, but I want to understand all the processes going on when it starts building. – ishan jain May 12 '15 at 17:24
  • @ishan jain Answer edited; now contains explanation and sample bat file. – Cristian Amarie May 13 '15 at 15:29
  • That solved a problem for me :) By the way, is there any ready built version of chrome binaries / webrtc on windows?? – Saw Aug 15 '15 at 21:34
  • @MohamedSakherSawan If you are looking for chrome binaries, probably on Chrome Canary or dev channels. If you are looking for CEF, check [cefbuilds.com](http://cefbuilds.com). – Cristian Amarie Aug 19 '15 at 07:03
0

Are you running 64-bit Windows? This file makes it sound like you can only build 64-bit on 64-bit OS. If you are it may still help - you can see how they determine host and target.

https://code.google.com/p/v8/source/browse/branches/bleeding_edge/src/base/build_config.h?r=24402

PhysicalEd
  • 784
  • 7
  • 10
  • I have checked out 64 bit code, now I am getting above error. – ishan jain Apr 29 '15 at 16:03
  • Yes, but are you running 64-bit Windows OS on the machine you are trying to build on? That looks like what it is complaining about. – PhysicalEd Apr 29 '15 at 16:52
  • So what I want to build 64 bit chrome and using 64 windows. Can't we do it? – ishan jain Apr 29 '15 at 16:58
  • Did you follow instructions from this page? https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding For example, this is called out in one step "When performing a 64-bit build on Windows (any branch) or OS X (branch 2171 or older) set GYP_DEFINES=target_arch=x64." – PhysicalEd Apr 29 '15 at 19:09
  • Yes I followed this link and steps given in this link. – ishan jain Apr 29 '15 at 19:21
  • I'm sorry, I don't know how to help then. If I think of anything I will add a comment. I've not seen this error personally. – PhysicalEd Apr 29 '15 at 21:30
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/76622/discussion-between-ishan-jain-and-physicaled). – ishan jain Apr 30 '15 at 09:47