简体   繁体   English

通过GN构建铬时,如何为特定目标提供自定义链接器标记?

[英]How to provide custom linker flags to a particular target while building chromium through GN?

I am trying to build latest chromium (cef) on my local machine. 我正在尝试在本地计算机上构建最新的铬(CEF)。 I have been successful in building it through automate-git.py using the GN framework. 我已经使用GN框架通过automate-git.py成功构建了它。 However, I also need to provide some extra linker flags to a specific target (libcef). 但是,我还需要为特定目标(libcef)提供一些额外的链接器标志。

I believe this is to be done through changes in args.gn file while creating a new build directory. 我相信这是通过在创建新的构建目录时更改args.gn文件来完成的。 But, I could not get sufficient documentation regarding how exactly to provide linker flags to a specific target in GN. 但是,我没有足够的文档来说明如何精确地为GN中的特定目标提供链接器标志。

Any help would be appreciated. 任何帮助,将不胜感激。

About chromium build configurations, you can reference the following links: 关于铬的构建配置,您可以参考以下链接:

  1. Build Instructions (Android) https://www.chromium.org/developers/how-tos/android-build-instructions 建立说明(Android) https://www.chromium.org/developers/how-tos/android-build-instructions

  2. The guide of gn build system https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/quick_start.md gn构建系统指南https://chromium.googlesource.com/chromium/src/+/master/tools/gn/docs/quick_start.md

  3. About the link flags, you can reference: ldflags https://codereview.chromium.org/1887303003/diff/20001/build/config/compiler/BUILD.gn 关于链接标志,您可以参考: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" ] } 

    } }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM