WebRTC在Windows下的编译过程

最近有项目用到WebRTC的源码,由于WebRTC下载及编译有些麻烦,所以把过程记录一下,以便有需要的童鞋参考。

WebRTC
下载完成后,在源码 src 目录下有一个 all.sln VS 解决方案文件,打开它后可以看到有二百多个项目。 这时选择 Debug 版本编译整个解决方案,通常整个解决方案不可能一次性编译通过,而且每台机器的环境,和 WebRTC 的源码版本的不同,也会造成不一样的编译错误。下面就我在编译过程中遇到的问题及解决办法罗列如下:


 

1. 安装Python,从下面的网址下载并安装,然后把python安装目录加入到系统PATH的环境变量中,修改后需要重启VS

https://www.python.org/ftp/python/2.7.9/python-2.7.9.amd64.msi

 

2. 安装WDK,从微软的官网下载,并安装。在很多项目中会用到atlthunk.lib文件,新建WDK_DIR系统环境变量值为WDK的安装目录,例如C:\WinDDK\7600.16385.1\lib\ATL\i386。修改后需要重启VS

 

3. 警告被视为错误 - 没有生成“object”文件。

解决办法:改变项目的属性,把否警告被视为错误设为 “否(/WX-)”,有很多个工程需要设置

 

4. 无法找到system_wrappers_default.lib文件,到src\build\Debug\lib 目录下。

解决办法:把编译出来的system_wrappers.lib复制一份并改名为 system_wrappers_default.lib

 

5. 无法解析的外部符号 _intel_aes_encrypt_init_128,该符号在函数 _aes_InitContext 中被引用。

解决办法:把nss_static项目预处理器定义中的USE_HW_AES和INTEL_GCM去掉

 

6. error MSB3721: 命令“call python "..\..\tools\swarming_client\isolate.py" "check" "--result" "..\..\build\Debug\common_audio_unittests.isolated" "--isolate" "common_audio_unittests.isolate" "--path-variable" "DEPTH" "..\.." "--path-variable" "PRODUCT_DIR" "..\..\build\Debug\ " "--config-variable" "OS=win" "--config-variable" "chromeos=0" "--config-variable" "component=static_library" "--config-variable" "internal_gles2_conform_tests=0" "--config-variable" "icu_use_data_file_flag=1" "--config-variable" "use_openssl=0"”已退出,返回代码为 1。


解决办法:在控制面板中找到区域和语音->管理->非Unicode程序的语言->英语

 

7. error LNK2005: "class ATL::CAtlWinModule ATL::_AtlWinModule" (?_AtlWinModule@ATL@@3VCAtlWinModule@1@A) 已经在 libjingle_media.lib(win32devicemanager.obj) 中定义。

解决办法:在peerconnection_client项目的链接器->命令行中加入:/FORCE:MULTIPLE


8, 安装DX


9,audio_device_core_win里有两个函数在调用WEBRTC工程里报无法解析的外部符号  


A, 把audio_device_core_win.h和audio_device_core_win.cc从项目中去除 并修改AudioDeviceModuleImpl::CreatePlatformSpecificObjects函数  把下面的屏蔽掉

       if (AudioDeviceWindowsCore::CoreAudioIsSupported())
        {
            create *Windows Core Audio* implementation
           ptrAudioDevice = new AudioDeviceWindowsCore(Id());
           WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id, "Windows Core Audio APIs will be utilized");
        }
        else


B,由于工程里没包含Dmoguids.lib Msdmo.lib  wmcodecdspuuid.lib 造成的编译不过  把这三个LIB包含进工程即可  我是包含在了调用webrtc的工程里了 应该是在webrtc工程里包含最好了。


10,   编译yasm--generate_files工程时 出现“error MSB6006: “cmd.exe”已退出,代码为 1。” 

修改.\webrtc-9540-d92f267-windows\src\third_party\yasm\source\patched-yasm\modules\arch\x86\gen_x86_insn.py 把file改成open

name 'file' is not defined 

when compile the third-party of webRTC
there meet a problem.(It caused by me istalled a single python which version is just 3.11)
complie output is name 'file' is not defined
for this sentence "output_groups(file(os.path.join(out_dir, "x86insns.c"), "wt"))"
------------------------------------------------------------------------------------------------------------------
there is a  article about this problem

python版本3.11

源码:

poem = '''\
Programming is fun
When the work is done
if you wanna make your work also fun:
use Python!
'''

f = file('poem.txt', 'w') # open for 'w'riting
f.write(poem) # write text to file
f.close() # close the file

f = file('poem.txt')
# if no mode is specified, 'r'ead mode is assumed by default
while True:
line = f.readline()
if len(line) == 0: # Zero length indicates EOF
break
print (line),
# Notice comma to avoid automatic newline added by Python
f.close() # close the file

错误提示:

Traceback (most recent call last):
File "C:/Python31/004.py", line 8, in <module>
f = file('poem.txt', 'w') # open for 'w'riting
NameError: name 'file' is not defined

解决办法:file()改为open()

---------------------------------------------------------------------------------------------------------

I simplely resolved it by removed the python path which added by myself in the ms common properties.


此问题与python版本有关



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值