View Issue Details Jump to Notes ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0013004CMakeCPackpublic2012-02-29 08:012013-03-04 08:38
ReporterStanislaw Szymczyk 
Assigned ToEric NOULARD 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
Platformi386OSUbuntuOS Version10.04
Product VersionCMake 2.8.7 
Target VersionCMake 2.8.10Fixed in VersionCMake 2.8.10 
Summary0013004: Archive generator (TGZ, ZIP etc) doesn't work if component-based packaging is used with CPACK_SET_DESTDIR set to ON
DescriptionComponent-based packaging doesn't work in CPack archive generator (for example TGZ or ZIP) if CPACK_SET_DESTDIR is set to ON. The following error messages are displayed:

[sszymczy@RR19-19:~/Desktop/ComponentExampleStart/Source/build]$ LANG=C make package
[ 50%] Built target mylib
[100%] Built target mylibapp
Run CPack packaging tool...
CPack: Create package using ZIP
CPack: Install projects
CPack: - Run preinstall target for: MyLib
CPack: - Install project: MyLib
CPack: - Install component: applications
CPack: - Install component: libraries
CPack: - Install component: headers
CPack: Create package
CPack Error: ERROR while packaging files: archive_read_disk_entry_from_file: (Empty error message)
CPack Error: ERROR while packaging files: archive_read_disk_entry_from_file: (Empty error message)
CPack Error: ERROR while packaging files: archive_read_disk_entry_from_file: (Empty error message)
CPack Error: Problem compressing the directory
CPack Error: Error when generating package: MyLib
make: *** [package] Error 1
Steps To Reproduce1. unzip MyLib.zip (attached to the ticket)
2. cd MyLib
3. mkdir build
4. cd build
5. cmake ..
6. make package
TagsNo tags attached.
Attached Fileszip file icon MyLib.zip [^] (1,671 bytes) 2012-02-29 08:01
diff file icon cpack_component_packaging_destdir_fix.diff [^] (774 bytes) 2012-03-01 02:20 [Show Content]

 Relationships
related to 0012606closedEric NOULARD Archive and STGZ packages don't respect CPACK_PACKAGE_INSTALL_DIRECTORY (patch included) 
related to 0012129closedEric NOULARD Add top level directory to component install 
related to 0013019closedKitware Robot The ZIP package generator does not find the files when CPACK_PACKAGING_INSTALL_PREFIX is set 

  Notes
(0028751)
Eric NOULARD (developer)
2012-02-29 08:19

Setting DESTDIR for Archive generator is usually not a good idea?

In fact since CMake 2.8.3 I think setting CPACK_SET_DESTDIR is usually
not necessary at all.

What are the motivation for setting CPACK_SET_DESTDIR to ON?
(0028752)
Eric NOULARD (developer)
2012-02-29 10:15

I can reproduce the error so I'll investigate it.
However I'd really like to understand why you want to use DESTDIR
with archive generator.

Usually if you want to influence the destination directory of your archive
you use a combination of values of the following variables:

CPACK_PACKAGING_INSTALL_PREFIX
CPACK_PACKAGE_INSTALL_DIRECTORY
CPACK_INCLUDE_TOPLEVEL_DIRECTORY
CPACK_COMPONENT_INCLUDE_TOPLEVEL_DIRECTORY

usually the usage of CPACK_SET_DESTDIR is due to the fact you
are trying to use.

That said there are some pending bugs concerning Archive generators
and the usage of those vars in the component case.
(0028754)
Stanislaw Szymczyk (reporter)
2012-02-29 12:35

I simply didn't know about CPACK_PACKAGING_INSTALL_PREFIX. CPACK_SET_DESTDIR always worked for me so far, so I expected it to work with component-based packages too.

It would be nice to have all these variables properly documented. It looks like only CPACK_PACKAGE_INSTALL_DIRECTORY is described in the official cmake documentation now.
(0028755)
Eric NOULARD (developer)
2012-02-29 13:18

CPack documentation enhancement is on the road for 2.8.8 see 0010067.

If you have time you should try CMake git master and try:

cpack --help-variable-list

the list should now be rather comprehensive but user review
of this documentation would be good.

Any missing or erroneous documentation may be reported in the
0010067 as comment I'll try to handle them as they come.

And in fact I just discover that CPACK_SET_DESTDIR is not documented [yet].
This one will be the first on my next CPack doc enhancement list.
(0028768)
Stanislaw Szymczyk (reporter)
2012-03-01 01:38

I investigated the problem a bit and found the following:

1. The problem is caused by a loop populating the File field of each component (cmCPackGenerator.cxx, around line 851)

2. When CPACK_SET_DESTDIR is unset, paths processed in this loop look like this:

/home/sszymczy/Desktop/ComponentExampleStart/Source/build/_CPack_Packages/Linux/ZIP/MyLib-1.0.0-Linux/applications//bin/mylibapp

First the install prefix is removed from the path, which leaves /bin/mylibapp, then everything up to first '/' is removed, which results in bin/mylibapp - correct relative file path.

3. When CPACK_SET_DESTDIR is set, paths processed in this loop look like this:

/home/sszymczy/Desktop/ComponentExampleStart/Source/build/_CPack_Packages/Linux/ZIP/MyLib-1.0.0-Linux/libraries/usr/local/lib/libmylib.a

There is no extra '/' character, so removing the prefix and then everything up to first '/' leaves just local/lib/libmylib.a - uncorrect because usr directory is now missing.

I guess that either extra '/' shall be added if CPACK_SET_DESTDIR is set to allow this logic to work, or alternatively '/' shall be removed only if it's the first character of the path resulting from removing the install prefix.

Hope this helps.
(0028769)
Stanislaw Szymczyk (reporter)
2012-03-01 02:21

I attached a patch fixing the problem for me.
(0028770)
Eric NOULARD (developer)
2012-03-01 02:34

Hi Stanislaw,

Thank you very much for the analysis,
and the patch I'll try to review it over the week-end.
(0029764)
Stanislaw Szymczyk (reporter)
2012-06-20 08:59

Any news about this problem? Are there any changes needed in the patch?
(0030659)
Eric NOULARD (developer)
2012-08-14 17:28

I'll be working on this for 2.8.10
(0031229)
Eric NOULARD (developer)
2012-10-14 12:54

Merge topic 'CPack-ArchiveGen-andDESTIR_ON' into next

ddec053 Make CPACK_SET_DESTDIR work with archive generator + component-based packaging
(0032471)
Robert Maynard (manager)
2013-03-04 08:38

Closing resolved issues that have not been updated in more than 4 months.

 Issue History
Date Modified Username Field Change
2012-02-29 08:01 Stanislaw Szymczyk New Issue
2012-02-29 08:01 Stanislaw Szymczyk File Added: MyLib.zip
2012-02-29 08:14 Eric NOULARD Assigned To => Eric NOULARD
2012-02-29 08:14 Eric NOULARD Status new => assigned
2012-02-29 08:19 Eric NOULARD Note Added: 0028751
2012-02-29 10:15 Eric NOULARD Note Added: 0028752
2012-02-29 10:15 Eric NOULARD Relationship added related to 0012606
2012-02-29 10:17 Eric NOULARD Relationship added related to 0012129
2012-02-29 12:35 Stanislaw Szymczyk Note Added: 0028754
2012-02-29 13:18 Eric NOULARD Note Added: 0028755
2012-03-01 01:38 Stanislaw Szymczyk Note Added: 0028768
2012-03-01 02:20 Stanislaw Szymczyk File Added: cpack_component_packaging_destdir_fix.diff
2012-03-01 02:21 Stanislaw Szymczyk Note Added: 0028769
2012-03-01 02:34 Eric NOULARD Note Added: 0028770
2012-03-06 16:44 Eric NOULARD Relationship added related to 0013019
2012-06-20 08:59 Stanislaw Szymczyk Note Added: 0029764
2012-08-14 17:27 Eric NOULARD Target Version => CMake 2.8.10
2012-08-14 17:28 Eric NOULARD Note Added: 0030659
2012-10-14 12:54 Eric NOULARD Note Added: 0031229
2012-10-14 12:54 Eric NOULARD Status assigned => resolved
2012-10-14 12:54 Eric NOULARD Fixed in Version => CMake 2.8.10
2012-10-14 12:54 Eric NOULARD Resolution open => fixed
2013-03-04 08:38 Robert Maynard Note Added: 0032471
2013-03-04 08:38 Robert Maynard Status resolved => closed


Copyright © 2000 - 2018 MantisBT Team