WebRTC not building for Windows too

1.2k views Asked by At

Like in this question WebRTC not building for Windows, I can't build WebRTC on a Windows 7 64-bit with VS 2015 but the issue is different. The fetch and gclient sync go well without error. But when I run the gn gen out/WebRTC, then I get the below error

ERROR at //third_party/protobuf/proto_library.gni:229:15: File is not inside out
put directory.
    outputs = get_path_info(protogens, "abspath")
              ^---------------------------------
The given file should be in the output directory. Normally you would specify
"$target_out_dir/foo" or "$target_gen_dir/foo". I interpreted this as
"//out/Default/gen/webrtc/rtc_tools/event_log_visualizer/chart.pb.h".
See //webrtc/rtc_tools/BUILD.gn:184:3: whence it was called.
  proto_library("chart_proto") {
  ^-----------------------------
See //BUILD.gn:16:5: which caused the file to be included.
"//webrtc/rtc_tools",
^-------------------
Traceback (most recent call last):
  File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 459, in <module>
    sys.exit(main())
  File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 455, in main
    return commands[sys.argv[1]](*sys.argv[2:])
  File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 431, in GetTool
chainDir
    win_sdk_dir = SetEnvironmentAndGetSDKDir()
  File "D:/temp/webrtc-checkout/src/build/vs_toolchain.py", line 424, in SetEnvi
ronmentAndGetSDKDir
    return NormalizePath(os.environ['WINDOWSSDKDIR'])
  File "D:\temp\depot_tools\win_tools-2_7_6_bin\python\bin\lib\os.py", line 423,
 in __getitem__
    return self.data[key.upper()]
KeyError: 'WINDOWSSDKDIR'

I tried to add the variables mentioned in the above question but it didn't helped. Any help would be greatly appreciated.

2

There are 2 answers

0
Vladimir Neustroev On

You need set LIB and INCLUDE in envirnment variables (windows sdk). And set PATH to the correct version of python (I think that 2.7.6) too.

So your envirnment variables should be:

LIB=C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\ucrt\x64;
C:\Program Files (x86)\Windows Kits\10\Lib\10.0.15063.0\um\x64

INCLUDE=C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um;
C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\winrt

PATH=C:\src\depot_tools\python276_bin\

Please mark if it worked

0
qknight On

libwebrtc

I'm using libwebrtc from https://github.com/cloudwebrtc/libwebrtc-build where that compile is wrapped inside a CMake custom call and I tried to modify LIB/INCLUDE but you probably refer to the Visual Studio IDE variables (which the command line does not have or where it does not work as I expected it).

My conservative solution now is to print this message before the libwebrtc compile:

if(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")
message("============================== C:/Program Files (x86)/Windows Kits/10/Redist/ucrt missing ==========================")
message("C:/Program Files (x86)/Windows Kits/10/Redist/ucrt can not be found")
message(" normally it contains files like /DLLs/x64/ucrtbase.dll and is required for libwebrtc to build")
message(FATAL_ERROR "Please copy the directory C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/ucrt into C:/Program Files (x86)/Windows Kits/10/Redist/")
endif(NOT EXISTS "C:/Program Files (x86)/Windows Kits/10/Redist/ucrt")

Another would be to patch https://github.com/nareix/webrtc.build/blob/69e87f529e935111b2b8c774ce283366fa2157d0/vs_toolchain.py#L212 to (pseudocode):

ucrt_dll_dirs = os.path.join("C:/Program Files (x86)/Windows Kits/10/Redist/10.0.18362.0/", 'DLLs', target_cpu)

But since that python code is checked out from the libwebrtc and potentially overridden periodically I go with the manual solution.

xcopy (manual copy of files)

xcopy /Y /E /I "c:\Program Files (x86)\Windows Kits\10\Redist\10.0.18362.0\ucrt" "c:\Program Files (x86)\Windows Kits\10\Redist\

alternate discussions

All solutions proposed in https://bugs.chromium.org/p/webrtc/issues/detail?id=7677#c24 also failed for me.

wish

I just wish that the python devs would have spent this another environment variable where we could pass in the directory to look into. Or even better, why did Microsoft create such a crappy infrastructure in the first place -> on UNIX one could use a concept as 'pkg-config' for custom library detection.