chromium编译避坑日记

编译环境

  • 操作系统:Windows 10
  • IDE:Visual Studio 2022 Community
  • 编译器:LLVM 17.0.6
  • chromiu版本:99.0.4844.94

clang版本

  • 错误
error: static_assert failed "Error in C++ Standard Library usage.
_EMIT_STL_ERROR(STL1000, "Unexpected compiler version, expected Clang 16.0.0 or newer.");
note: expanded from macro '_EMIT_STL_ERROR' static_assert(false, "Error in C++ Standard Library usage.")
  • 原因:该版本的chromium代码自带的clang版本为14,编译环境要求clang 16+
  • 方法:(有其他的方法还请告知)
    1. 安装LLVM 17.0.6
    2. 拷贝安装好的LLVM到${SRC}\third_party\llvm-build\LLVM
    3. 修改${SRC}\third_party\llvm-build\clang.gni文件
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/toolchain/toolchain.gni")

# 修改为新的clang路径
default_clang_base_path = "//third_party/llvm-build/LLVM"

declare_args() {
  # Indicates if the build should use the Chrome-specific plugins for enforcing
  # coding guidelines, etc. Only used when compiling with Chrome's Clang, not
  # Chrome OS's.
  clang_use_chrome_plugins =
      is_clang && !is_nacl && current_os != "zos" &&
      default_toolchain != "//build/toolchain/cros:target"

  clang_base_path = default_clang_base_path
}

error: unable to find plugin 'find-bad-constructs'

  • 原因:不支持自定义编译器
  • 对策:修改args.gn
gn gen --ide=vs2022 --args="clang_use_chrome_plugins=false" out\Default

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值