gn should warn or error if a static_library has no inputs |
||
Issue descriptionThe VC++ lib.exe tool generates no .lib file if there are no inputs. This means that a .lib file with no inputs will cause subsequent links to fail because the .lib file will be missing. And "macOS's libtool also warns if there are no input files". Therefore we should either get gn to throw an error if a static_library has no input, or we should silently make it work (by adding a NOP input). The former seems more likely. Having gn throw an error for .lib files with no inputs would make the error obvious, and would make it happen much earlier (during generation of .ninja files). Currently the error may not occur until many minutes of building have elapsed, and the root cause is initially cryptic. Another alternative would be to have gn silently convert empty static_library targets to source_set targets, since those can handle having no inputs.
,
Jul 6 2016
Seems like :generated should actually be a group() instead, given what it's actually doing ...
,
Nov 10 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by brucedaw...@chromium.org
, Jul 6 2016If source_set("generated") in third_party/WebKit/Source/core/BUILD.gn is changed to static_library then the Windows build will succeed but obj/third_party/WebKit/Source/core/generated.lib will always be considered dirty because it is not generated because it has no inputs. I initially thought this was an example of where disallowing a static_library with no inputs would unnecessarily cause a build break, but since this static_library causes the build to never be clean this is really just another example of why a static_library with no inputs should be a fatal error at the .ninja generation stage.