[CMake] Error out on installation when there is already an installation when setting directory permissions

John R. Cary cary at txcorp.com
Sat May 5 10:49:23 EDT 2012


This is a followup to http://www.cmake.org/pipermail/cmake/2011-April/044095.html:

    On 04/28/2011 01:51 PM, John R. Cary wrote:
    >/  This is in reference to
    />/
    />/  iter.cary$ cmake --version
    />/  cmake version 2.8.3
    />/  iter.cary$ uname -a
    />/  Linux iter.txcorp.com 2.6.29.4-167.fc11.x86_64 #1 SMP Wed May 27
    />/  17:27:08 EDT 2009 x86_64 x86_64 x86_64 GNU/Linux
    />/
    />/
    />/  We have a situation where a package needs to be
    />/  rebuilt because some dependency is rebuilt.  In
    />/  this case, trilinos needs rebuilding because it
    />/  depends on openmpi and the version of opempi gets
    />/  updated.
    />/
    />/  Typically, these installations are in a common area,
    />/  but by different people.  So one night Joe triggers
    />/  a build a trilinos.  Then the next night a new version
    />/  of openmpi is available, so Mary triggers a build of
    />/  openmpi and then trilinos.
    />/
    />/  In this situation, Mary's installation of trilinos
    />/  fails, because cmake's installation does not overwrite
    />/  some files:
    />/
    />/  -- Installing:
    />/  /usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_DLLExportMacro.h
    />/  -- Up-to-date:
    />/  /usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_AbstractFactory.hpp
    />/  CMake Error at packages/teuchos/src/cmake_install.cmake:54 (FILE):
    />/     file INSTALL cannot set permissions on
    />/
    />/  "/usr/local/contrib/trilinos-10.2.0-ser/include/Teuchos_AbstractFactory.hpp"
    />/  Call Stack (most recent call first):
    />/     packages/teuchos/cmake_install.cmake:48 (INCLUDE)
    />/     cmake_install.cmake:41 (INCLUDE)
    />/
    />/  but then apparently tries to set the permissions anyway.  But
    />/  since it did not overwrite, Mary does not own the files, and
    />/  so she cannot set the perms.  The result being that the installation
    />/  errors out as above, possibly not completing, but at the very
    />/  least returning an error code that must be chased down.
    />/
    />/  It seems to me that one should overinstall, even if the
    />/  file is there, if one is going to try to set permissions
    />/  afterwards.  Is there a way to force such overinstallation
    />/  in cmake?  Or perhaps not error out on a perm change if the
    />/  exising perms are okay?
    />/
    />/  Thx....John Cary
    /
    You might try "make install CMAKE_INSTALL_ALWAYS=1", cf. [1].

    Regards,

    Michael

    [1]http://www.cmake.org/Wiki/CMake_Useful_Variables


Except that now I am at

$ cmake --version
cmake version 2.8.6
$ uname -a
Linux zippy.txcorp.com 2.6.32-71.el6.x86_64 #1 SMP Fri May 20 03:51:51 BST 2011 x86_64 x86_64 x86_64 GNU/Linux
$ gcc --version
gcc (GCC) 4.6.2


Using CMAKE_INSTALL_ALWAYS=1 works for files, but if there
is a directory installed by a previous user, it does not:

   file INSTALL cannot set permissions on
   "/internal/txphysics-r1533-ser/tests/txeedldata-tests/accepted_output"
Call Stack (most recent call first):
   tests/cmake_install.cmake:45 (INCLUDE)
   cmake_install.cmake:87 (INCLUDE)


make: *** [install] Error 1

(/internal/txphysics-r1533-ser/tests/txeedldata-tests/accepted_output is a
directory.)

It seems that even with CMAKE_INSTALL_ALWAYS=1, previously installed
directories are not removed before the new installation.  Is there a
way to make this happen?

Thx.....John




More information about the CMake mailing list