当前位置:   article > 正文

windows编译chromium

windows编译chromium

1.下载chromium代码

git clone --recursive https://github.com/chromium/chromium.git

2.根据下载代码中的DEPS文件招到每个依赖项的位置,用自己的方法或者替代方法下载下来放在指定位置,主要是下面几个网址难搞

  1. 'android_git': 'https://android.googlesource.com',
  2. 'aomedia_git': 'https://aomedia.googlesource.com',
  3. 'boringssl_git': 'https://boringssl.googlesource.com',
  4. 'chromium_git': 'https://chromium.googlesource.com',
  5. 'dawn_git': 'https://dawn.googlesource.com',
  6. 'pdfium_git': 'https://pdfium.googlesource.com',
  7. 'quiche_git': 'https://quiche.googlesource.com',
  8. 'skia_git': 'https://skia.googlesource.com',
  9. 'swiftshader_git': 'https://swiftshader.googlesource.com',
  10. 'webrtc_git': 'https://webrtc.googlesource.com',

本来就是编译windows,可以不下载安卓的东西,第一个忽略

下载boringssl 放在目录 src/third_party/boringssl/src 中

  1. mkdir src/third_party/boringssl/
  2. cd src/third_party/boringssl/
  3. git clone --recursive https://github.com/google/boringssl  src

下载skia 放在src/third_party/skia

  1. cd src/third_party/
  2. git clone --recursive https://github.com/google/skia

下载webrtc  放在src/third_party/webrtc

  1. cd src/third_party
  2. git clone --recursive https://github.com/ibaoger/webrtc

下边的都一样直接去各个地方下载就行了,没有代理只能这么干费点劲

下载玩这些还不算还要把buildtools build base tools 下载下来,这是编译要用的工具,没有办法只能找个代理去下载,我这里有以前下载的,直接考过去大部分都能用,如果是编译新手还是照着官方的一步一步来

编译遇到的问题

1.最新版的会要求安装debug tools

You must installWindows 10 SDK version 10.0.19041.0 including the "Debugging Tools for Windows" feature.

把这个选上就行

2. LANGUAGE.timestamp

python build\util\lastchange.py build\util\LASTCHANGE

 东拼西凑终于可以gn成功了,脚本如下:

  1. set PATH=D:\WorkStation\webrtcsln\depot_tools;%PATH%
  2. set GYP_MSVS_VERSION=2019
  3. set vs2019_install=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
  4. set GYP_MSVS_OVERRIDE_PATH=D:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise
  5. set GYP_GENERATORS=msvs-ninja,ninja
  6. set WINDOWSSDKDIR=C:\Program Files (x86)\Windows Kits\10
  7. set DEPOT_TOOLS_WIN_TOOLCHAIN=0
  8. REM ninja -C out/Default
  9. gn gen out/Default --ide=vs2019

开始生成执行程序

ninja -C out/Default chrome -d explain

报了一大堆dirty,missing错

,查看了一下错误原来是llvm构建工具链还没有,拷贝了一份以前的src\third_party\llvm-build\Release+Asserts,有些参数不支持了报错

  1. clang-cl: error: unknown argument ignored in clang-cl: '-fno-delete-null-pointer-checks' [-Werror,-Wunknown-argument]
  2. clang-cl: error: unknown argument ignored in clang-cl: '-fno-ident' [-Werror,-Wunknown-argument]
  3. clang-cl: error: unknown argument ignored in clang-cl: '-ffile-compilation-dir=.' [-Werror,-Wunknown-argument]

只能下载相应版本的

python ./src/tools/clang/scripts/update.py

获取工具链地址,正如你所料的肯定是下不下来,让别人替你下载

然后拷贝到src\third_party\llvm-build\Release+Asserts

https://commondatastorage.googleapis.com/chromium-browser-clang/Win/clang-llvmorg-14-init-3940-gafc45ff0-2.tgz

google做东西,好像什么都是未跨平台考虑的,很多编译构建不方便的地方大不了自己搞一套,反正是不用msys这类的跨平台工具,bazel/ninja/gn用起来挺方便,不过在国内还是cmake比较方便,要是改成cmake就好了 

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/笔触狂放9/article/detail/882259
推荐阅读
相关标签
  

闽ICP备14008679号