0

就像在这个问题WebRTC not building for Windows中一样,我无法在带有 VS 2015 的 Windows 7 64 位上构建 WebRTC,但问题有所不同。fetchgclient 同步顺利进行,没有错误。但是当我运行 gn gen out/WebRTC 时,我得到以下错误

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'

我尝试添加上述问题中提到的变量,但没有帮助。任何帮助将不胜感激。

4

2 回答 2

0

您需要在环境变量(windows sdk)中设置 LIB 和 INCLUDE。并将 PATH 设置为正确版本的 python(我认为是 2.7.6)。

所以你的环境变量应该是:

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\

请标记是否有效

于 2017-09-10T19:17:09.960 回答
0

libwebrtc

我正在使用来自https://github.com/cloudwebrtc/libwebrtc-build的 libwebrtc,其中该编译包含在 CMake 自定义调用中,我尝试修改 LIB/INCLUDE 但您可能指的是 Visual Studio IDE 变量(其中命令行没有或无法按我预期的那样工作)。

我现在的保守解决方案是在 libwebrtc 编译之前打印此消息:

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

另一个是将https://github.com/nareix/webrtc.build/blob/69e87f529e935111b2b8c774ce283366fa2157d0/vs_toolchain.py#L212修补到(伪代码):

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

但是由于该 python 代码是从 libwebrtc 中检出的,并且可能会定期被覆盖,因此我使用手动解决方案。

xcopy(文件的手动副本)

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\

替代讨论

https://bugs.chromium.org/p/webrtc/issues/detail?id=7677#c24中提出的所有解决方案对我来说也都失败了。

希望

我只是希望 python 开发人员会使用另一个环境变量,我们可以在其中传递目录进行查看。甚至更好的是,为什么微软一开始就创建了如此糟糕的基础架构-> 在 UNIX 上,人们可以使用“pkg-config”的概念来进行自定义库检测。

于 2020-04-30T07:26:03.940 回答