[CMake] CPack 2.6.2: can't create temporary directory

Petri Hodju petrihodju at yahoo.com
Mon Oct 13 06:05:40 EDT 2008


Hi!

I have put together a custom way of building packages inspired by Stuart Herring posted here earlier:

Fri Apr 4 20:39:04 EDT 2008
[CMake] CPack: Building Multiple Packages

Everything is working fine with version 2.6.0 but things break up with 2.6.2. The
error I get is like:

CPack Error: Problem creating temporary directory: /opt/test

So, I'm not sure if there is a bug in 2.6.2 or has something changed between 2.6.0 and 2.6.2 which I don't take into account. 

I have attached to this mail a tar package containing full example of the problem.

For those who can't bother with the tar file here is written out the CMakeLists.txt & CPackConfig.in files, which make it all happen:

CMakeLists.txt:

#===============================================================================
# Top level project makefile
#===============================================================================

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)

PROJECT(test)

SET(VERSION_MAJOR 0)
SET(VERSION_MINOR 1)
SET(VERSION_PATCH 2)
SET(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")

#-------------------------------------------------------------------------------
# macro for creating packages.
#-------------------------------------------------------------------------------

ADD_CUSTOM_TARGET(pack)

MACRO(ADD_PACKAGE COMPONENT)
  SET(TARGET pack-${COMPONENT})
  SET(CONFIG "CPackConfig-${COMPONENT}.cmake")
  SET(PACKAGE ${COMPONENT})
  CONFIGURE_FILE("CPackConfig.in" "${CONFIG}" @ONLY)
  ADD_CUSTOM_TARGET(${TARGET} COMMAND cpack --config "${CONFIG}")
  ADD_DEPENDENCIES(pack ${TARGET})
ENDMACRO(ADD_PACKAGE)

#-------------------------------------------------------------------------------
# installation path settings
#-------------------------------------------------------------------------------

SET(CMAKE_SET_DESTDIR "ON")
SET(CMAKE_INSTALL_PREFIX "/opt/test")
SET(CPACK_GENERATOR "DEB" "RPM")

#-------------------------------------------------------------------------------
# create test binary
#-------------------------------------------------------------------------------

ADD_EXECUTABLE(bin1 "bin1.cc")
INSTALL(TARGETS bin1 DESTINATION "bin" COMPONENT "binaries")
ADD_PACKAGE(binaries)

CPackConfig.in:

#===============================================================================
# template for package generation
#===============================================================================

SET(CMAKE_SET_DESTDIR "@CMAKE_SET_DESTDIR@")
SET(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
SET(CPACK_SET_DESTDIR "@CMAKE_SET_DESTDIR@")
SET(CPACK_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")

SET(CPACK_PACKAGE_VERSION_MAJOR @VERSION_MAJOR@)
SET(CPACK_PACKAGE_VERSION_MINOR @VERSION_MINOR@)
SET(CPACK_PACKAGE_VERSION_PATCH @VERSION_PATCH@)

SET(CPACK_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CPACK_GENERATOR "@CPACK_GENERATOR@")

SET(CPACK_INSTALL_CMAKE_PROJECTS "@PROJECT_BINARY_DIR@;@PROJECT_NAME@;@PACKAGE@;/")
SET(CPACK_PACKAGE_FILE_NAME "@PROJECT_NAME at -@PACKAGE at -@VERSION at -@CMAKE_SYSTEM_NAME@")
SET(CPACK_PACKAGE_NAME "@PROJECT_NAME@")
SET(CPACK_PACKAGE_VENDOR "Test Vendor")
SET(CPACK_PACKAGE_CONTACT "test at vendor.org")
SET(CPACK_PACKAGE_DESCRIPTION_FILE "@PROJECT_BINARY_DIR@/Description.txt")
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Test @PACKAGE@ Package")
SET(CPACK_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")

and finally here is the output I get with cmake 2.6.0 and 2.6.2

Best regards,
Petri Hodju

--------------------------- with cmake 2.6.0 ---------------------------------

pho at host:~/misc/code/cpack$ cmake --version
cmake version 2.6-patch 0

pho at host:~/misc/code/cpack$ cpack --version
cpack version 2.6-patch 0

pho at host:~/misc/code/cpack$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pho/misc/code/cpack

pho at host:~/misc/code/cpack$ make
Scanning dependencies of target bin1
[100%] Building CXX object CMakeFiles/bin1.dir/bin1.cc.o
Linking CXX executable bin1
[100%] Built target bin1

pho at host:~/misc/code/cpack$ make pack
Scanning dependencies of target pack-binaries
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: test
CPack: - Install project: test
CPack: Compress package
CPack: Finalize package
CPack: Package /home/pho/misc/code/cpack/test-binaries-0.1.2-Linux.deb generated.
CPack: Create package using RPM
CPack: Install projects
CPack: - Run preinstall target for: test
CPack: - Install project: test
CPack: Compress package
CPack: Finalize package
CPack: Package /home/pho/misc/code/cpack/test-binaries-0.1.2-Linux.rpm generated.
Built target pack-binaries
Scanning dependencies of target pack
Built target pack

--------------------------- with cmake 2.6.2 ---------------------------------

pho at host:~/misc/code/cpack$ cmake --version
cmake version 2.6-patch 2

pho at host:~/misc/code/cpack$ cpack --version
cpack version 2.6-patch 2

pho at host:~/misc/code/cpack$ cmake .
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pho/misc/code/cpack

pho at host:~/misc/code/cpack$ make
Scanning dependencies of target bin1
[100%] Building CXX object CMakeFiles/bin1.dir/bin1.cc.o
Linking CXX executable bin1
[100%] Built target bin1

pho at host:~/misc/code/cpack$ make pack
Scanning dependencies of target pack-binaries
CPack: Create package using DEB
CPack: Install projects
CPack: - Run preinstall target for: test
CPack: - Install project: test
CPack Error: Problem creating temporary directory: /opt/test
CPack Error: Error when generating package: test
make[3]: *** [CMakeFiles/pack-binaries] Error 1
make[2]: *** [CMakeFiles/pack-binaries.dir/all] Error 2
make[1]: *** [CMakeFiles/pack.dir/rule] Error 2
make: *** [pack] Error 2



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081013/d59e6af4/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cpack.tar.gz
Type: application/gzip
Size: 991 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081013/d59e6af4/attachment.bin>


More information about the CMake mailing list