构建和调试使用铬视觉工作室给错误:错误LNK1112:模块机种'64',目标机型“X86”冲突错误、机种、机型、模块

2023-09-08 10:37:34 作者:王的风范

我要调试的铬code,以检查它是如何编译的JavaScript code。我已经下载了铬code,并试图使用Visual Studio构建CEF的解决方案文件,但我收到以下错误:

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:

错误LNK1112:模块机型'64',目标机型X86冲突 \ third_party \ libjpeg_turbo \ jccolss2-64.obj cefclient

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

错误MSB3073:命令拨打ninja.exe -C .. \出\调试\ cefclient 退出,code 1,D:\依禅\铬\铬\铬\ SRC \ CEF \ cefclient.vcxproj 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

谁能帮我解决这个错误

谢谢 依禅耆那教

推荐答案

铬只能在64位的Windows建成,这并不重要,如果你正在构建32位的64位重要。 Windows 7的64位或更高版本是必须的。 看来你已经配置版本为64位(如果你使用的是忍者,最有可能与设置GYP_DEFINES = TARGET_ARCH = 64 ),但你正在构建32位,最有可能使用 的忍者-C了\调试的。这么看来,你已经配置的64版本,但要构建32位。 64位版本是在Debug_x64(或Debug_64,我现在不记得了)。 所以: - 如果配置TARGET_ARCH = 64,建立与忍者-C了\ Debug_x64 的 - 如果配置TARGET_ARCH = IA32(或让空的,我觉得默认的构建是在Windows 32位),建立与忍者-C了\调试的

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你不能建立在同一个目录 - 但也许我错了 - 32和64版本(因为生成的.ninja的文件,主要是)。 如果您使用的是设置GYP_GENERATORS = MSVS忍者,忍者(主要是如果要生成Visual Studio解决方案),它可以工作,但不支持MSVS忍者,也保持(再)

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).

编辑:从Visual Studio示例忍者建立。 VS外部工具>添加类似的条目: 标题的构建libcef调试 命令的F:\ dev的\ CEF \ 2357 \运行build.bat (F中来源:\ dev的\ CEF \ 2357 \ 86 \铬) 参数的调试 初始目录的F:\ dev的\ CEF \ 2357 我的布局是这个(建立分公司是2357): F:\ dev的\ CEF \ 2357的根目录的 /    automate-git.py   的build.bat    86 /     铬/ 的build.bat低于文件; 86 /目录中手动创建。在86我有铬的检出(CEF和depot_tools也将出现在86 /)。 我的build.bat文件是这样的(详细信息可以很容易地计算出):

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