2

I am trying to cross build chromium on mac host. I have followed the instructions from https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/win_cross.md and everything seems fine. But when I run autoninja -C out/win chrome I face with the following error. Any help would be appreciated.

ninja: Entering directory `out/win'
[0/1] Regenerating ninja files
ERROR at //build/config/win/visual_studio_version.gni:27:7: Script returned non-zero exit code.
      exec_script("../../vs_toolchain.py", [ "get_toolchain_dir" ], "scope")
      ^----------
Current dir: /chromium/src/out/win/
Command: python3 /chromium/src/build/vs_toolchain.py get_toolchain_dir
Returned 1.
stderr:

Traceback (most recent call last):
  File "/chromium/src/build/vs_toolchain.py", line 587, in <module>
    sys.exit(main())
  File "/chromium/src/build/vs_toolchain.py", line 583, in main
    return commands[sys.argv[1]](*sys.argv[2:])
  File "/chromium/src/build/vs_toolchain.py", line 561, in GetToolchainDir
    win_sdk_dir = SetEnvironmentAndGetSDKDir()
  File "/chromium/src/build/vs_toolchain.py", line 554, in SetEnvironmentAndGetSDKDir
    return NormalizePath(os.environ['WINDOWSSDKDIR'])
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/os.py", line 679, in __getitem__
    raise KeyError(key) from None
KeyError: 'WINDOWSSDKDIR'

See //third_party/angle/gni/angle.gni:35:5: whence it was imported.
    import("//build/config/win/visual_studio_version.gni")
    ^----------------------------------------------------
See //chrome/elevation_service/BUILD.gn:7:1: whence it was imported.
import("//build/toolchain/win/midl.gni")
^--------------------------------------
See //BUILD.gn:660:7: which caused the file to be included.
      "//chrome/elevation_service:elevation_service_unittests",
      ^-------------------------------------------------------
FAILED: build.ninja 
../../buildtools/mac/gn --root=../.. -q --ide=vs --regeneration gen .
ninja: error: rebuilding 'build.ninja': subcommand failed
Asesh
  • 3,186
  • 2
  • 21
  • 31
Hetero
  • 39
  • 2
  • You're building in MAC but getting a `WINDOWSSDKDIR`? Isn't it possible the source you pulled is expecting the build on a Windows machine? – Altimus Prime Jun 30 '22 at 04:14
  • @AltimusPrime I am trying to build chromium for windows from a mac host, as mentioned in the chromium official instructions. – Hetero Jun 30 '22 at 04:18
  • @Asesh, Are you sure? the documentation says it is possible for both mac and linux. – Hetero Jun 30 '22 at 04:19
  • @Hetero Did you package your Windows SDK directory? Your error specifically is saying that it can't find it. https://chromium.googlesource.com/chromium/src.git/+/HEAD/docs/win_cross.md#if-you_re-not-at-google – Altimus Prime Jun 30 '22 at 04:24
  • @AltimusPrime, yes I have done it. I have exported those two variables. Also, I am working on the main branch. – Hetero Jun 30 '22 at 04:27
  • 'GYP_MSVS_HASH_1023ce2e82': '603e7cd151' 'DEPOT_TOOLS_WIN_TOOLCHAIN_BASE_URL': '~/chromium/windowsSDk' Are set clearly. – Hetero Jun 30 '22 at 04:38
  • Looks like it's possible now, must be been recently updated. It was possible to do so from Linux only few months/years back. – Asesh Jun 30 '22 at 05:20

0 Answers0