Windows: Build failed for x86 target within x64 machine

209 views
Skip to first unread message

Lalith Kumar

unread,
Jul 14, 2023, 6:28:34 AM7/14/23
to Chromium-dev
[31725/74916] RUST(BIN) win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe.pdb
FAILED: win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe.pdb 

_for_rust_host_build_tools/prebuilt_rustc_sysroot\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib\\libcompiler_builtins.rlib" "kernel32.lib" "advapi32.lib" "bcrypt.lib" "kernel32.lib" "ntdll.lib" "userenv.lib" "ws2_32.lib" "kernel32.lib" "libcmt.lib" "/NXCOMPAT" "/LIBPATH:win_clang_x86_for_rust_host_build_tools/prebuilt_rustc_sysroot\\lib\\rustlib\\x86_64-pc-windows-msvc\\lib" "/OUT:win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe" "/OPT:REF,ICF" "/DEBUG" "/guard:cf" "--color-diagnostics" "/call-graph-profile-sort:no" "/TIMESTAMP:1688274000" "/lldignoreenv" "/pdbpagesize:8192" "/OPT:REF" "/OPT:ICF" "/INCREMENTAL:NO" "/FIXED:NO" "/OPT:NOLLDTAILMERGE" "/PROFILE" "/PDBSourcePath:o:\\fake\\prefix" "/OPT:ICF" "/DEBUG" "/pdbaltpath:%_PDB%" "/NATVIS:../../build/config/c++/libc++.natvis" "/DEFAULTLIB:libcpmt.lib" "/FIXED:NO" "/ignore:4199" "/ignore:4221" "/NXCOMPAT" "/DYNAMICBASE" "/INCREMENTAL:NO" "/SUBSYSTEM:CONSOLE,5.02" "/guard:cf" "/WX" "-libpath:..\\..\\third_party\\llvm-build\\Release+Asserts\\lib\\clang\\17\\lib\\windows" "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\ATLMFC\\lib\\x86" "-libpath:C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Tools\\MSVC\\14.36.32532\\lib\\x86" "-libpath:C:\\Program Files (x86)\\Windows Kits\\NETFXSDK\\4.8\\lib\\um\\x86" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\lib\\10.0.22621.0\\ucrt\\x86" "-libpath:C:\\Program Files (x86)\\Windows Kits\\10\\\\lib\\10.0.22621.0\\\\um\\x86" "/MACHINE:X64" "/PDB:win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe.pdb" "../../third_party/llvm-build/Release+Asserts/lib/clang/17/lib/windows/clang_rt.builtins-x86_64.lib"
  = note: lld-link: error: libcmt.lib(chkstk.obj): machine type x86 conflicts with x64
          lld-link: error: libcmt.lib(std_type_info_static.obj): machine type x86 conflicts with x64
          lld-link: error: libcmt.lib(delete_scalar_size.obj): machine type x86 conflicts with x64
          lld-link: error: libcmt.lib(delete_scalar.obj): machine type x86 conflicts with x64

Dana Jansens

unread,
Jul 14, 2023, 11:06:48 AM7/14/23
to lalit...@gmail.com, Chromium-dev
Hi Lilith,


The same build is working there, and it also works for me locally.

Can you determine what is different in your configuration?

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/877c65a1-b880-48c1-9088-bcf7454bfcf1n%40chromium.org.

Lalith Kumar

unread,
Jul 14, 2023, 1:06:29 PM7/14/23
to Chromium-dev, Dana Jansens, Chromium-dev, lalit...@gmail.com
With files generation just used the below command:

gn gen out\WindowsX86  --args="target_cpu="x86" v8_symbol_level=0 symbol_level=0 blink_symbol_level=0"

I am not sure about other configurations, I do have every toolsets required for x86 with VS2022

Dana Jansens

unread,
Jul 14, 2023, 1:15:58 PM7/14/23
to Lalith Kumar, Chromium-dev
I believe you're pointing to the 64 bit Windows CRT, that's what libcmt is. Probably you need a 32bit developer environment set up, but maybe you're using the 64 bit environment. I hope that helps point you toward the answer.

Lalith Kumar

unread,
Jul 14, 2023, 1:22:57 PM7/14/23
to Dana Jansens, Chromium-dev
Oh does the environment set up differs for x86 

Couldn't see anything in this doc, could you mention what must be checked for that case (To enable the environment for 32 bit building)?

Dana Jansens

unread,
Jul 14, 2023, 1:26:13 PM7/14/23
to Lalith Kumar, Chromium-dev
What I understand is that you must run some batch files to set up paths to all your Visual Studio tools and libraries/sdks. This is typically done by running the "developer shell" or whatever it's called that is a cmd terminal but with those things set up. Visual Studio provides another version of that shell that is for x86 development.

If you're working inside Visual Studio, then it would be an option in there somewhere I would presume - I have no familiarity there.

Lalith Kumar

unread,
Jul 14, 2023, 1:28:01 PM7/14/23
to Chromium-dev, Dana Jansens, Chromium-dev, Lalith Kumar
Wouldn't `set  vs2022_install` env variable do the job here ?

I am checking out with cmd terminal only

Couldn't find any specific batch scripts by the way

Dana Jansens

unread,
Jul 14, 2023, 1:39:00 PM7/14/23
to Lalith Kumar, Chromium-dev
I don't think so. If you're not specifically setting up a 32-bit (x86) environment, the default will be 64-bit (x64).

Bruce Dawson

unread,
Jul 15, 2023, 8:53:01 PM7/15/23
to Chromium-dev, Dana Jansens, Chromium-dev, Lalith Kumar
Developers shouldn't have to set up a 32-bit or 64-bit environment. They should be able to build from a command prompt that has no extra entries in the path (other than depot_tools) and no LIB or INCLUDE variables set. When DEPOT_TOOLS_WIN_TOOLCHAIN is set to zero it is the responsibility of our scripts to set up the environment based on the gn args.

This is not a scenario that is tested well at Google (we use a packaged toolchain) so it is likely that some recent changes to do with rust have introduced an incompatibility.

I just did the following steps (I had to escape the quotes around x86) and was able to easily reproduce the problem:

set DEPOT_TOOLS_WIN_TOOLCHAIN=0
gclient sync
gn gen out\WindowsX86  --args="target_cpu=\"x86\" v8_symbol_level=0 symbol_level=0 blink_symbol_level=0"
ninja -C out\WindowsX86 win_clang_x86_for_rust_host_build_tools/compiler_builtins_compiler_builtins_vunknown_build_script.exe

I then tested again with DEPOT_TOOLS_WIN_TOOLCHAIN=1 and it succeeded. This is a bug in the rust build setup.

I filed crbug.com/1465165. This is a serious bug for anybody trying to build 32-bit Chrome without a packaged toolchain.

Lalith Kumar

unread,
Jul 17, 2023, 12:02:02 AM7/17/23
to Chromium-dev, Bruce Dawson, Dana Jansens, Chromium-dev, Lalith Kumar
Yeah thanks Bruce,
Hope this bug is fixed at the earliest

As suggested by Dana the environment initialization has also failed for my case. Used the Native x86 dev prompt.
Reply all
Reply to author
Forward
0 new messages