Page MenuHomePhabricator

[lldb] Fix that 'ninja clean' breaks the build by deleting debugserver_vers.c

Authored by teemperor on Oct 3 2019, 1:02 AM.



We mark debugserver_vers.c as a generated file in CMake. This means that when we run ninja clean we end up deleting that file,
but any following ninja invocation will fail due to the file missing. The file can't be generated as ninja doesn't know it has to
rerun CMake to create the file. Turns out that marking the output of configure_file as generated is wrong as explained in this bug report:

This patch just removes that property. The only side effect of this seems to be that this file maybe shows up in your IDE when
opening our CMake project, but that seems like a small sacrifice.

This patch can be quickly tested by running ninja clean ; ninja lldbDebugserverCommon. Before this patch the build will fail
due to debugserver_vers.c missing.

Diff Detail


Event Timeline

teemperor created this revision.Oct 3 2019, 1:02 AM
Herald added a project: Restricted Project. · View Herald TranscriptOct 3 2019, 1:02 AM
labath accepted this revision.Oct 3 2019, 2:00 AM

This paragraph from that bug is interesting too:

According to the 3.11 documentation for the GENERATED source file property, it should be used to indicate "Is this source file generated as part of the build or CMake process."  Earlier documentation does not mention "CMake process".  I was originally using it because "This information is then used to exempt the file from any existence or validity checks.", otherwise CMake would complain a about the missing source file.

Unfortunately, the cmake maintainer did not circle back to answer that, so we don't know the official cmake position, but my interpretation of this paragraph is the same as that of OP (i.e., that setting this property is the right thing to do, and the fact that it does not work is a bug in ninja or its cmake generator).

That said, this clearly does not work at the moment, so removing it is the best workaround we have.

This revision is now accepted and ready to land.Oct 3 2019, 2:00 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2019, 2:51 AM