我一直按照以下页面中详细说明的步骤为 Linux ARM 设备交叉编译和构建 chromium (v87):https://chromium.googlesource.com/chromium/src/+/master/docs/linux/build_instructions。 MD
我已经成功地为 ARM 目标构建了 chrome 二进制文件,但我现在的目标是尝试减少成功构建后给出的 chrome 二进制输出的大小。目前,chrome 二进制文件的大小为 190mb,考虑到几年前执行的以前的 chromium (v70) 版本的 chrome 二进制输出大小约为 80mb,这太大了。
我相信大小的急剧增加可能是由于较新的 chromium 版本中包含大量依赖项,这意味着由gn gen out/***
or生成的额外 deps 文件gn args out/***
,我一直在寻找方法来尝试删除不需要的库以生成更小的 chrome 二进制文件。我试图修改在BUILD.GN
chromium 目录的根目录中找到的根文件,将某些 vars 设置为 false 以试图阻止 gn 命令添加不需要的库/依赖项 deps 文件,但这仍然会导致相同数量的依赖项文件放置在我的构建输出文件夹中并执行autoninja -C out/*** chrome
构建 chrome 会再次给出一个大型 chrome 二进制文件(190mb):
# Copyright (c) 2013 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.
# This is the root build file for GN. GN will start processing by loading this
# file, and recursively load all dependencies until all dependencies are either
# resolved or known not to exist (which will cause the build to fail). So if
# you add a new build file, there must be some path of dependencies from this
# file to your new one or GN won't know about it.
import("//build/config/chromeos/ui_mode.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/features.gni")
import("//build/config/sanitizers/sanitizers.gni")
import("//build/config/ui.gni")
import("//build/gn_logs.gni")
import("//build/util/generate_wrapper.gni")
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/media/router/features.gni")
import("//components/nacl/features.gni")
import("//device/vr/buildflags/buildflags.gni")
import("//extensions/buildflags/buildflags.gni")
import("//gpu/vulkan/features.gni")
import("//media/gpu/args.gni")
import("//media/media_options.gni")
import("//remoting/remoting_enable.gni")
import("//third_party/closure_compiler/compile_js.gni")
import("//third_party/openh264/openh264_args.gni")
import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
import("//ui/base/ui_features.gni")
import("//ui/gl/features.gni")
import("//v8/gni/snapshot_toolchain.gni")
import("//v8/gni/v8.gni")
#Variable declarations in an attempt to stop building certain dependencies/packages:
#enable_openscreen = false
#enable_remoting = false
#enable_nacl = false
#media_use_ffmpeg = false
#use_openh264 = false
#enable_vulkan = false
#enable_ipc_fuzzer = false
#enable_vr = false
下面是我用来构建 190mb 铬二进制文件的args.gn参数:
target_cpu="arm"
arm_version=7
target_os="linux"
arm_arch="armv7-a"
arm_float_abi="hard"
arm_fpu="neon"
arm_tune="cortex-a9"
arm_use_neon=true
arm_use_thumb=true
use_alsa=false
use_jumbo_build=true
use_gnome_keyring=false
is_debug = false
symbol_level = 0
enable_nacl = false
blink_symbol_level=0
# Set build arguments here. See `gn help buildargs`.
任何有关如何减小 chrome 输出文件大小的帮助或指导将不胜感激。