New issue
Advanced search Search tips

Issue 625874 link

Starred by 3 users

Issue metadata

Status: Untriaged
Owner: ----
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

gn should warn or error if a static_library has no inputs

Project Member Reported by brucedaw...@chromium.org, Jul 5 2016

Issue description

The 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.

 
If 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.
Seems like :generated should actually be a group() instead, given what it's actually doing ...
Components: Build

Sign in to add a comment