Building for 32-bit Windows

21 views
Skip to first unread message

Alex Humphrey

unread,
Apr 15, 2021, 7:47:58 AMApr 15
to skia-discuss
I'm trying to build Skia for 32-bit Windows. I was able to make a build for 64-bit Windows eventually but upon following the instructions for 32-bit builds I'm met with a wall of errors. I've seen other threads with the same issues but they are outdated and contain little practical info.

Threads:

GN Gen args:
gn gen out/debug_32 --args='is_official_build=true skia_use_expat=false skia_use_libjpeg_turbo_encode=false skia_use_libjpeg_turbo_decode=false skia_use_libpng_encode=false skia_use_libpng_decode=false skia_use_libwebp_encode=false skia_use_libwebp_decode=false skia_us e_zlib=false skia_use_icu=false skia_use_harfbuzz=false win_vc="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC" win_sdk="C:/Program Files (x86)/Windows Kits/10" target_cpu="x86" extra_cflags=["/MTd"]' --ide="vs"

I have downloaded the VS Build Tools and reinstalled my Windows SDK multiple times.
I was unable to get Clang working when building 64-bit so I am not attempting to use it currently. From what I can tell there is an issue with SetEnv.cmd missing as that is not included in the Build Tools anymore but I am unsure.

Error:
'C:/Program' is not recognized as an internal or external command, operable program or batch file.

I do not know enough about CLIs and bash scripts etc to be able to solve this myself so I'm hoping someone has updated info on 32-bit builds.

Alex Humphrey

unread,
Apr 15, 2021, 7:59:30 AMApr 15
to skia-discuss
Full Error Message:

[1/949] compile ../../src/ports/SkFontHost_win.cpp FAILED: obj/src/ports/fontmgr_win_gdi.SkFontHost_win.obj cmd.exe /c C:/Program Files (x86)/Windows Kits/10/bin/SetEnv.cmd /x86 && "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x86/cl.exe" /nologo /showIncludes /FC -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DWIN32_LE AN_AND_MEAN -DNOMINMAX -DNDEBUG -DSK_GAMMA_APPLY_TO_A8 -DSKIA_IMPLEMENTATION=1 "-IC:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/include" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/shared" "-IC:/Program Files ( x86)/Windows Kits/10/Include/10.0.19041.0/ucrt" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/winrt" -I../.. /wd5030 /bigobj /utf-8 /O2 /Zc:inline /MTd /std:c++17 /GR- /c ../../src/ports /SkFontHost_win.cpp /Foobj/src/ports/fontmgr_win_gdi.SkFontHost_win.obj /Fd"obj/fontmgr_win_gdi_c.pdb" 'C:/Program' is not recognized as an internal or external command, operable program or batch file.

Ben Wagner

unread,
Apr 15, 2021, 9:49:15 AMApr 15
to skia-d...@googlegroups.com
It looks like you're just running into
https://skia.googlesource.com/skia/+/be834bfa2c3a3bc411c906f172354c103e013c78/gn/toolchain/BUILD.gn#86
where $win_sdk has spaces which aren't being escaped (or quoted).
> --
> You received this message because you are subscribed to the Google Groups "skia-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/ab1313d4-9459-4068-8de3-b40f7378d253n%40googlegroups.com.

Alex Humphrey

unread,
Apr 15, 2021, 9:54:35 AMApr 15
to skia-discuss
What's happening there is the script is attempting to access SetEnv.cmd which is non-existent. The path itself is properly whitespaced & quoted etc.

Ben Wagner

unread,
Apr 15, 2021, 9:55:46 AMApr 15
to skia-d...@googlegroups.com
Of course that's the cause of the immediate error. It would require
investigation to see if the x86 side of this should be updated to
match the arm64 side, except for replacing the last 'x64' with 'x86'.

Ben Wagner

unread,
Apr 15, 2021, 10:00:09 AMApr 15
to skia-d...@googlegroups.com
On Thu, Apr 15, 2021 at 9:54 AM Alex Humphrey
<ahum...@silhouettesoftware.com> wrote:
>
> What's happening there is the script is attempting to access SetEnv.cmd which is non-existent. The path itself is properly whitespaced & quoted etc.
>
> On Thursday, 15 April 2021 at 14:49:15 UTC+1 bungeman wrote:
>>
>> It looks like you're just running into
>> https://skia.googlesource.com/skia/+/be834bfa2c3a3bc411c906f172354c103e013c78/gn/toolchain/BUILD.gn#86
>> where $win_sdk has spaces which aren't being escaped (or quoted).
>>
>> On Thu, Apr 15, 2021 at 7:59 AM Alex Humphrey
>> <ahum...@silhouettesoftware.com> wrote:
>> >
>> > Full Error Message:
>> >
>> > [1/949] compile ../../src/ports/SkFontHost_win.cpp FAILED: obj/src/ports/fontmgr_win_gdi.SkFontHost_win.obj cmd.exe /c C:/Program Files (x86)/Windows Kits/10/bin/SetEnv.cmd /x86 && "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/bin/HostX64/x86/cl.exe" /nologo /showIncludes /FC -D_CRT_SECURE_NO_WARNINGS -D_HAS_EXCEPTIONS=0 -DWIN32_LE AN_AND_MEAN -DNOMINMAX -DNDEBUG -DSK_GAMMA_APPLY_TO_A8 -DSKIA_IMPLEMENTATION=1 "-IC:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29910/include" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/shared" "-IC:/Program Files ( x86)/Windows Kits/10/Include/10.0.19041.0/ucrt" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/um" "-IC:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0/winrt" -I../.. /wd5030 /bigobj /utf-8 /O2 /Zc:inline /MTd /std:c++17 /GR- /c ../../src/ports /SkFontHost_win.cpp /Foobj/src/ports/fontmgr_win_gdi.SkFontHost_win.obj /Fd"obj/fontmgr_win_gdi_c.pdb" 'C:/Program' is not recognized as an internal or external command, operable program or batch file.

The first C:/Program Files (x86)/Windows Kits/10/bin/SetEnv.cmd in the
above is not quoted or escaped, which is the cause of the error
message given. Whether or not SetEnv exists doesn't really matter at
this point. However, if it does not exist anyway, then obviously
quoting will not fix that.

>> >
>> > On Thursday, 15 April 2021 at 12:47:58 UTC+1 Alex Humphrey wrote:
>> >>
>> >> I'm trying to build Skia for 32-bit Windows. I was able to make a build for 64-bit Windows eventually but upon following the instructions for 32-bit builds I'm met with a wall of errors. I've seen other threads with the same issues but they are outdated and contain little practical info.
>> >>
>> >> Threads:
>> >> - https://groups.google.com/g/skia-discuss/c/8lUtOBHt1Dk/m/4DTbwzkpBwAJ
>> >> - https://groups.google.com/g/skia-discuss/c/ycNGJPHrCVo/m/Vh9EtpxRBwAJ
>> >> - https://groups.google.com/g/skia-discuss/c/Lt63B8FFBSI
>> >>
>> >> GN Gen args:
>> >> gn gen out/debug_32 --args='is_official_build=true skia_use_expat=false skia_use_libjpeg_turbo_encode=false skia_use_libjpeg_turbo_decode=false skia_use_libpng_encode=false skia_use_libpng_decode=false skia_use_libwebp_encode=false skia_use_libwebp_decode=false skia_us e_zlib=false skia_use_icu=false skia_use_harfbuzz=false win_vc="C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC" win_sdk="C:/Program Files (x86)/Windows Kits/10" target_cpu="x86" extra_cflags=["/MTd"]' --ide="vs"
>> >>
>> >> I have downloaded the VS Build Tools and reinstalled my Windows SDK multiple times.
>> >> I was unable to get Clang working when building 64-bit so I am not attempting to use it currently. From what I can tell there is an issue with SetEnv.cmd missing as that is not included in the Build Tools anymore but I am unsure.
>> >>
>> >> Error:
>> >> 'C:/Program' is not recognized as an internal or external command, operable program or batch file.
>> >>
>> >> I do not know enough about CLIs and bash scripts etc to be able to solve this myself so I'm hoping someone has updated info on 32-bit builds.
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups "skia-discuss" group.
>> > To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
>> > To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/ab1313d4-9459-4068-8de3-b40f7378d253n%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups "skia-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to skia-discuss...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/skia-discuss/d5ebfbfc-249b-4bf1-8030-06d7ef19b30fn%40googlegroups.com.

Alex Humphrey

unread,
Apr 16, 2021, 5:14:34 AMApr 16
to skia-discuss
Again, I have put quotes into that path string correctly and received the same error regardless.

I was able to find a dumb solution by messing with the scripts:

toolchain("msvc") {
  lib_switch = ""
  lib_dir_switch = "/LIBPATH:"

  bin = "$win_vc/Tools/MSVC/$win_toolchain_version/bin/HostX64/$target_cpu"

  env_setup = ""
  if (target_cpu == "x86") {
    # Toolchain asset includes a script that configures for x86 building.
    # We don't support x86 builds with local MSVC installations.
    # env_setup = "$shell $win_sdk/bin/SetEnv.cmd /x86 && " <----------------------------------- ** Comment out this line **
  } else if (target_cpu == "arm64") {
    # ARM64 compiler is incomplete - it relies on DLLs located in the host toolchain directory.
    env_setup = "$shell set \"PATH=%PATH%;$win_vc\\Tools\\MSVC\\$win_toolchain_version\\bin\\HostX64\\x64\" && "
  }

As a non-google user of Skia I would strongly suggest updating the information on the Skia site for using Skia in a project. Far too many of the steps just do not work and the entire experience has been a months-long headache.
Reply all
Reply to author
Forward
0 new messages