This is an archive of the discontinued LLVM Phabricator instance.

[CMAKE] Fix 'clean' target not working
ClosedPublic

Authored by pdhaliwal on Jun 30 2020, 12:42 AM.

Details

Summary

cmake was still considering the empty value of ${fake_version_inc}
even if it was not defined.

Diff Detail

Event Timeline

pdhaliwal created this revision.Jun 30 2020, 12:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 30 2020, 12:42 AM

Thank you for looking into it, i also encountered ninja clean not working.

phosek added inline comments.Jun 30 2020, 10:22 AM
llvm/include/llvm/Support/CMakeLists.txt
26

Can you use ${generated_files} here as well for OUTPUT and avoid duplicating this command?

pdhaliwal marked an inline comment as done.Jun 30 2020, 7:00 PM
pdhaliwal added inline comments.
llvm/include/llvm/Support/CMakeLists.txt
26

Hi, I had initially tried using ${generated_files} for OUTPUT as well but then ninja started complaining with following error (only in cases where llvm_vc was not defined)

ninja: error: 'include/llvm/Support/VCSRevision.h', needed by 'include/llvm/Support/CMakeFiles/llvm_vcsrevision_h', missing and no known rule to make it
vsapsai accepted this revision.Jul 1 2020, 12:20 PM

With this change ninja clean works without errors for me (also regular ninja, ninja install). Approving from the functional perspective only, don't know CMake good enough to say if it can benefit from any improvements.

This revision is now accepted and ready to land.Jul 1 2020, 12:20 PM

@phosek Let me know if this is good to land.

This revision was landed with ongoing or failed builds.Jul 29 2020, 4:34 AM
This revision was automatically updated to reflect the committed changes.

This commit appears to be causing an error when I run CMake:

CMake Error:

Running

 '/usr/bin/ninja-build' '-C' '/home/tstellar/llvm-project/llvm-build' '-t' 'cleandead'

failed with:

 ninja: error: remove(include/llvm/Support): Directory not empty

CMake Generate step failed. Build files cannot be regenerated correctly.

This commit appears to be causing an error when I run CMake:

CMake Error:

Running

 '/usr/bin/ninja-build' '-C' '/home/tstellar/llvm-project/llvm-build' '-t' 'cleandead'

failed with:

 ninja: error: remove(include/llvm/Support): Directory not empty

CMake Generate step failed. Build files cannot be regenerated correctly.

That can't be it. I was seeing that very error before this patch,
which is why i was happy to see this patch, hoping that it would fix it.

Reverting this patch seems to fix the error for me. Are you still seeing this same error in trunk?

Reverting this patch seems to fix the error for me. Are you still seeing this same error in trunk?

Just tried, and nope, works fine now. @pdhaliwal - thanks, i think!
Perhaps it's cache invalidation issue, and you need a fresh build dir?