[libc-commits] [PATCH] D147475: WIP: [libc] Fix potential install errors related to missing headers

Stephen Neuendorffer via Phabricator via libc-commits libc-commits at lists.llvm.org
Mon Apr 3 14:25:28 PDT 2023


stephenneuendorffer created this revision.
Herald added subscribers: libc-commits, ecnelises, tschuett.
Herald added projects: libc-project, All.
stephenneuendorffer requested review of this revision.

The current code seems to assume that any header required by a
particular target is also a dependency of libc.a.  If this is not
the case, then the 'install' rule can break because it will try to
install a header file which has not, in fact, been generated.
This is really a fundamental problem with the way that
libc/include/CMakeList.txt manages the install header files and
targets, but there doesn't appear to be a good way to fix it in
current versions of cmake (which are limited in understanding the
interaction between file sets of custom targets and the install
rule).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D147475

Files:
  libc/lib/CMakeLists.txt


Index: libc/lib/CMakeLists.txt
===================================================================
--- libc/lib/CMakeLists.txt
+++ libc/lib/CMakeLists.txt
@@ -34,6 +34,13 @@
       ARCHIVE_OUTPUT_NAME ${archive_0}
   )
   list(APPEND added_archive_targets ${archive_1})
+
+  # The dependency below is necessary because it's possible for libc-headers to generate
+  # and want to install headers that no component entrypoint depends on.
+  # This causes issues when running 'make install' because libc-headers is all implemented
+  # with custom targets and there is not good support for describing install dependencies
+  # on custom targets.
+  add_dependencies(${archive_1} libc-headers)
 endforeach()
 
 if(LIBC_TARGET_TRIPLE)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D147475.510608.patch
Type: text/x-patch
Size: 730 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20230403/5472ed6b/attachment.bin>


More information about the libc-commits mailing list