Building and debugging Chromium using visual studio giving error : error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

邮差的信 提交于 2019-12-25 06:55:08

问题


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


回答1:


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



回答2:


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



来源:https://stackoverflow.com/questions/29931279/building-and-debugging-chromium-using-visual-studio-giving-error-error-lnk1112

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!