我正在尝试在我的本地机器上构建最新的铬(cef)。我使用GN框架通过automate-git.py成功构建了它。但是,我还需要为特定目标(libcef)提供一些额外的链接器标志。
我相信这是通过在创建新的构建目录时更改args.gn文件来完成的。但是,我无法获得关于如何在GN中为特定目标提供链接器标志的充分文档。
任何帮助都将不胜感激。
答案 0 :(得分:0)
关于铬构建配置,您可以参考以下链接:
构建说明(Android) https://www.chromium.org/developers/how-tos/android-build-instructions
gn构建系统的指南 https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/quick_start.md
关于链接标志,您可以参考:ldflags https://codereview.chromium.org/1887303003/diff/20001/build/config/compiler/BUILD.gn
ldflags += [
"-fPIC",
"-Wl,-z,noexecstack",
"-Wl,-z,now",
"-Wl,-z,relro",
]
if (!using_sanitizer) {
if (!use_cfi_diag) {
ldflags += [ "-Wl,-z,defs" ]
}
# Functions interposed by the sanitizers can make ld think
# that some libraries aren't needed when they actually are,
# http://crbug.com/234010. As workaround, disable --as-needed.
if (!is_nacl && !is_android) {
# TODO(pcc): Fix linker bug which requires us to link pthread
# unconditionally here (crbug.com/623236).
ldflags += [
"-Wl,--no-as-needed",
"-lpthread",
]
}
ldflags += [ "-Wl,--as-needed" ]
}
}