View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0011735CMakeCPackpublic2011-01-20 14:522011-01-21 02:03
ReporterTorsten Rohlfing 
Assigned ToEric NOULARD 
PrioritynormalSeveritymajorReproducibilityalways
StatusclosedResolutionfixed 
PlatformAppleOSOS Version
Product VersionCMake 2.8.3 
Target VersionCMake 2.8.4Fixed in VersionCMake 2.8.4 
Summary0011735: Generators create empty archives using component groups
DescriptionPackaging of component groups seems to be completely broken in CMake 2.8.3: generated packages are empty.

The problem seems to be that CPack installs all files in a single file system tree, regardless of what component they belong to, but then expects to package them from per-component trees.
Steps To Reproduce1. Download attached file, "source.tar.gz"
2. tar -xzvf source.tar.gz
3. mkdir build ; cd build; cmake ..
4. make package

Afterwards, running "find _CPack_Packages/" will produce something like the following:

_CPack_Packages/
_CPack_Packages//Darwin
_CPack_Packages//Darwin/TGZ
_CPack_Packages//Darwin/TGZ/SomeToolkit
_CPack_Packages//Darwin/TGZ/SomeToolkit/documentation
_CPack_Packages//Darwin/TGZ/SomeToolkit/documentation/usr
_CPack_Packages//Darwin/TGZ/SomeToolkit/documentation/usr/local
_CPack_Packages//Darwin/TGZ/SomeToolkit/headers
_CPack_Packages//Darwin/TGZ/SomeToolkit/headers/usr
_CPack_Packages//Darwin/TGZ/SomeToolkit/headers/usr/local
_CPack_Packages//Darwin/TGZ/SomeToolkit/libraries
_CPack_Packages//Darwin/TGZ/SomeToolkit/libraries/usr
_CPack_Packages//Darwin/TGZ/SomeToolkit/libraries/usr/local
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local/doc
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local/doc/SOMEFILE
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local/include
_CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local/include/header.h
_CPack_Packages//Darwin/TGZ/SomeToolkit-development.tar.gz
_CPack_Packages//Darwin/TGZ/SomeToolkit-runtime.tar.gz

Clearly, the two package files are both installed below

 _CPack_Packages//Darwin/TGZ/SomeToolkit/usr/local/

but the package archives are created from

  _CPack_Packages//Darwin/TGZ/SomeToolkit/documentation
  _CPack_Packages//Darwin/TGZ/SomeToolkit/headers
  _CPack_Packages//Darwin/TGZ/SomeToolkit/libraries

which are empty.
Additional InformationI have observed essentially the same behaviour using PackageMaker generator on Mac and ZIP on Windows.
TagsNo tags attached.
Attached Filesgz file icon source.tar.gz [^] (1,040 bytes) 2011-01-20 14:52

 Relationships
related to 0011452closedEric NOULARD Pack component install for archives breaks MySQL packaging 

  Notes
(0024965)
Eric NOULARD (developer)
2011-01-20 15:00

I'm not able to test ON MacOS but I'll try on Linux.

2 questions:

1) Why did you ?
   SET(CPACK_SET_DESTDIR "ON")

2) Could you try with CMake 2.8.4-rc1 ?
(0024966)
Torsten Rohlfing (reporter)
2011-01-20 15:30

I set "CPACK_SET_DESTDIR" because if I don't I get this:

CMake Error at /Users/torsten/tmp/build/cmake_install.cmake:39 (FILE):
  file INSTALL cannot copy file "/Users/torsten/tmp/header.h" to
  "/usr/local/include/header.h".

Will try 2.8.4-rc1 next.
(0024969)
Torsten Rohlfing (reporter)
2011-01-20 15:51

Okay - 2.8.4-rc1 does NOT create empty archive (TGZ at least).

Mostly, though, that seems to be because it is simply ignoring the defined components and groups to create one single joint archive. Apparently this is reverting to pre-2.8.3 behaviour.
(0024972)
Eric NOULARD (developer)
2011-01-20 16:32
edited on: 2011-01-20 16:32

Ok I did test myself on Linux and here comes the full story:

1) Never do such thing like

   INSTALL(FILES header.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/ COMPONENT headers)

   instead you should do

   INSTALL(FILES header.h DESTINATION include/ COMPONENT headers)

   If you use ${CMAKE_INSTALL_PREFIX}/include this is an ABSOLUTE
   destination which the reason you need to set(CPACK_SET_DESTDIR "ON")

2) CPack 2.8.2 TGZ (or ZIP) generator did not support component install.

   CPack 2.8.3 does but contains [at least] 2 bugs:
     - the default behavior was to generate several files
       which is a backward compatibilty breakage (see other bug)

     - it seems to contains a bug w.r.t. the DESTDIR "ON" + Component.
       which was currently unoticed


3) CPack 2.8.4 supports component install for TGZ, ZIP and RPM
   but this IS not the default behavior in order to be backward compatible.

   If you want to obtain component for TGZ or ZIP you must define
   set(CPACK_ARCHIVE_COMPONENT_INSTALL "ON")

   and
   set(CPACK_RPM_COMPONENT_INSTALL "ON")
   for RPM.

   RPM won't currently support the DESTDIR ON + Component
   TGZ, ZIP and other archive generator should.


My advices:
   Do not use install rules with absolute path DESTINATION unless you
   really need it.
   Do not CPACK_SET_DESTDIR to ON unless you know you really need it.

(0024975)
Eric NOULARD (developer)
2011-01-20 16:41

Note that if you want to customize CPack behavior depending on
CPack generator invoked you can use a
CPACK_PROJECT_CONFIG_FILE

see
http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#Overall_usage_.28common_to_all_generators.29 [^]

beginning of up-to-date documentation concerning CPack generator
supporting component is here:
http://www.cmake.org/Wiki/CMake:Component_Install_With_CPack#Principles_of_CPack_Component_Packaging [^]
(0024976)
Eric NOULARD (developer)
2011-01-20 16:51

Will wait from feedback from Torsten before closing this
(0024977)
Torsten Rohlfing (reporter)
2011-01-20 18:37

Seems to work with 2.8.4 and your suggestions. Thanks for your help Eric!
(0024986)
Eric NOULARD (developer)
2011-01-21 02:03

You're Welcome.
Note that if you do not use ABSOLUTE install path nor DESTDIR "ON"
this should work with 2.8.3 as well.

 Issue History
Date Modified Username Field Change
2011-01-20 14:52 Torsten Rohlfing New Issue
2011-01-20 14:52 Torsten Rohlfing File Added: source.tar.gz
2011-01-20 15:00 Eric NOULARD Note Added: 0024965
2011-01-20 15:30 Torsten Rohlfing Note Added: 0024966
2011-01-20 15:51 Torsten Rohlfing Note Added: 0024969
2011-01-20 16:07 Eric NOULARD Assigned To => Eric NOULARD
2011-01-20 16:07 Eric NOULARD Status new => assigned
2011-01-20 16:32 Eric NOULARD Note Added: 0024972
2011-01-20 16:32 Eric NOULARD Note Edited: 0024972
2011-01-20 16:35 Eric NOULARD Relationship added related to 0011452
2011-01-20 16:36 Eric NOULARD Priority high => normal
2011-01-20 16:36 Eric NOULARD Resolution open => fixed
2011-01-20 16:36 Eric NOULARD Fixed in Version => CMake 2.8.4
2011-01-20 16:36 Eric NOULARD Target Version => CMake 2.8.4
2011-01-20 16:41 Eric NOULARD Note Added: 0024975
2011-01-20 16:51 Eric NOULARD Note Added: 0024976
2011-01-20 18:37 Torsten Rohlfing Note Added: 0024977
2011-01-21 02:03 Eric NOULARD Note Added: 0024986
2011-01-21 02:03 Eric NOULARD Status assigned => closed


Copyright © 2000 - 2018 MantisBT Team