New issue
Advanced search Search tips

Issue 801154 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Jun 2018
Cc:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug



Sign in to add a comment

GN, cflags -= ["xxx"] Can not remove default cflags

Reported by sainim...@gmail.com, Jan 11 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36

Steps to reproduce the problem:
executable("NihaoSkia") {
  testonly = true
  if (is_win) {
    cflags -= [
      "/WX",  # Treat warnings as errors.
    ]
  }
  defines = [
    "WIN32"
  ]
  sources = [
    "HelloWorld.cpp",
  ]
  include_dirs = [
    "E:\Fts\Proj\Test\DFVision_Proj\DFVisionConsole_Common\include",
  ]
  deps = [
    "//:flags",
    "//:gpu_tool_utils",
    "//:sk_app",
    "//:skia",
    "//:tool_utils",
    "//:views",
  ]
  # ldflags -= [ "/SUBSYSTEM:CONSOLE" ]
  # ldflags += [ "/SUBSYSTEM:WINDOWS" ]
}
---------------------------------
I'm using -= oporator in my BUILD.gn, I want to remove some default cflags and ldflags, but "-=" does not work.

What is the expected behavior?
cflags -= ["xxx"] operation removes "xxx" from inherited cflags

What went wrong?
The error messages:

ERROR at //NihaoSkia/src/BUILD.gn:8:5: Undefined identifier.
    cflags -= [
    ^-----
See //BUILD.gn:2017:5: which caused the file to be included.
    "//NihaoSkia/src:NihaoSkia",
    ^--------------------------
ninja: error: rebuilding 'build.ninja': subcommand failed

Did this work before? N/A 

Chrome version: 60.0.3112.90  Channel: n/a
OS Version: 10.0
Flash Version:
 

Comment 1 by sainim...@gmail.com, Jan 29 2018

If this is not a bug, please tell how to implement removing strings in cflags or in ldflags with inherted cflags or ldflags
 Issue 806647  has been merged into this issue.
Cc: thakis@chromium.org
thakis@ can you respond and close this issue out.
Status: WontFix (was: Unconfirmed)
See `gn help configs`. If you need to remove a cflag, it needs to be in its own config.

For /WX you're in luck: If you set `treat_warnings_as_errors = false` in your args.gn, we won't pass that for any target. (But we always want /WX for all targets in the official chromium build.)
Labels: Build-Tools-GN

Sign in to add a comment