[libc-commits] [PATCH] D99636: libc: Default LIBC_INSTALL_PREFIX to ${CMAKE_INSTALL_PREFIX}

Nathan Chancellor via Phabricator via libc-commits libc-commits at lists.llvm.org
Tue Mar 30 21:17:13 PDT 2021


nathanchance created this revision.
nathanchance added a reviewer: sivachandra.
Herald added subscribers: libc-commits, mgorny.
Herald added a project: libc-project.
nathanchance requested review of this revision.

b22f448c21e718a3b6 <https://reviews.llvm.org/rGb22f448c21e718a3b6219df89169f38d436189c6> added a rule to install libllvmlibc.a to
${LIBC_INSTALL_PREFIX}/${LIBC_INSTALL_LIBRARY_DIR}, which will be /lib
by default, which is disruptive to builds that stay within a user's
/home holder:

  $ ninja install
  ...
  -- Installing: /lib/libllvmlibc.a
  CMake Error at projects/libc/lib/cmake_install.cmake:54 (file):
    file INSTALL cannot copy file
   "/home/nathan/cbl/github/tc-build/build/llvm/stage1/projects/libc/lib/libllvmlibc.a"
    to "/lib/libllvmlibc.a": Permission denied.
  Call Stack (most recent call first):
    projects/libc/cmake_install.cmake:51 (include)
    projects/cmake_install.cmake:47 (include)
    cmake_install.cmake:76 (include)
  ...

Change LIBC_INSTALL_PREFIX's default value to ${CMAKE_INSTALL_PREFIX} so
that 'ninja install' does not attempt to install anything outside of the
user's requested installation location.

Signed-off-by: Nathan Chancellor <nathan at kernel.org>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99636

Files:
  libc/CMakeLists.txt


Index: libc/CMakeLists.txt
===================================================================
--- libc/CMakeLists.txt
+++ libc/CMakeLists.txt
@@ -14,7 +14,7 @@
 # Path libc/scripts directory.
 set(LIBC_BUILD_SCRIPTS_DIR "${LIBC_SOURCE_DIR}/utils/build_scripts")
 
-set(LIBC_INSTALL_PREFIX "" CACHE STRING "Define libc destination prefix.")
+set(LIBC_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX} CACHE PATH "Define libc destination prefix.")
 
 set(LIBC_TARGET_OS ${CMAKE_SYSTEM_NAME})
 string(TOLOWER ${LIBC_TARGET_OS} LIBC_TARGET_OS)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D99636.334337.patch
Type: text/x-patch
Size: 530 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libc-commits/attachments/20210331/0f6f2b55/attachment.bin>


More information about the libc-commits mailing list