LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 4500 - cmake: "make install" tries to set permissions on target directories
Summary: cmake: "make install" tries to set permissions on target directories
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks: 15732
  Show dependency tree
 
Reported: 2009-07-03 03:33 PDT by Duncan Sands
Modified: 2014-02-10 05:00 PST (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments
LLVM patch to avoid setting include/ permissions (1.39 KB, patch)
2014-01-27 09:11 PST, Brad King
Details
Clang patch to avoid setting include/ permissions (1.44 KB, patch)
2014-01-27 09:11 PST, Brad King
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Sands 2009-07-03 03:33:44 PDT
For me "make install" when using cmake fails with:

Install the project...
-- Install configuration: ""
-- Installing: /usr/local/./include
CMake Error at cmake_install.cmake:36 (FILE):
  file Problem setting permissions on directory "/usr/local/./include"

Indeed I don't have permission to change permissions on /usr/local/./include.
And why would I need to?  There's no problem installing files inside that
directory, and setting their permissions.  I think the fact that cmake is
trying to set permissions on /usr/local/include is a bug.
Comment 1 Daniel Dunbar 2009-07-11 15:41:46 PDT
Is this an LLVM bug though, or a cmake bug?
Comment 2 Duncan Sands 2009-07-11 21:52:09 PDT
I don't know - cmake is an opaque mystery to me.  How can I tell?
Comment 3 Daniel Dunbar 2009-07-11 21:57:15 PDT
I CCed Doug in the hopes he would know.
Comment 4 Chandler Carruth 2012-06-25 03:57:51 PDT
This seems likely to be this CMake bug: 
http://public.kitware.com/Bug/view.php?id=10978
Comment 5 Brad King 2014-01-27 09:11:14 PST
Created attachment 11949 [details]
LLVM patch to avoid setting include/ permissions
Comment 6 Brad King 2014-01-27 09:11:43 PST
Created attachment 11950 [details]
Clang patch to avoid setting include/ permissions
Comment 7 Brad King 2014-01-27 09:14:09 PST
This is actually a bug in LLVM and Clang's CMake code and not in CMake.  The install(DIRECTORY) command documents how it sets permissions on directories, and it is consistent with the behavior observed here.  We should not ask CMake to install the top-level "include/" directory for us because it is not exclusive to LLVM or Clang.  Instead we should ask it only to handle the "include/llvm", "include/llvm-c", "include/clang", and "include/clang-c" subdirectories.

I've just attached a patch to LLVM and another to Clang to fix this issue.
Comment 8 Chandler Carruth 2014-01-28 14:51:45 PST
(In reply to comment #7)
> This is actually a bug in LLVM and Clang's CMake code and not in CMake.  The
> install(DIRECTORY) command documents how it sets permissions on directories,
> and it is consistent with the behavior observed here.  We should not ask
> CMake to install the top-level "include/" directory for us because it is not
> exclusive to LLVM or Clang.  Instead we should ask it only to handle the
> "include/llvm", "include/llvm-c", "include/clang", and "include/clang-c"
> subdirectories.
> 
> I've just attached a patch to LLVM and another to Clang to fix this issue.

Can you post it to the commit list for review? (Or use Phabricator to do so?)

Thanks for tracking down the root cause of this issue.
Comment 9 Brad King 2014-01-28 15:53:34 PST
(In reply to comment #8)
> Can you post it to the commit list for review?

http://thread.gmane.org/gmane.comp.compilers.llvm.cvs/173963
Comment 10 NAKAMURA Takumi 2014-02-10 05:00:25 PST
I had been missing this PR for long time, ... :(

Fixed in r201075 and r201076.

I have confirmed Brad fixed this issue with prerequisites:

  - root owns PREFIX.
  - subdirectories, bin, include, lib, and share are owned by root but writable to installer. (in this case, me)