MantisBT - CMake
View Issue Details
0007435CMakeCPackpublic2008-07-31 16:582008-10-01 09:51
Paul Hatfield 
Bill Hoffman 
normalminoralways
closedfixed 
CMake-2-6 
 
0007435: CPack allows RPM to strip debug symbols from binary
When using CPack to create a RPM that includes a binary with debug symbols, the debug symbols are stripped.
The following stores a binary that does have debug symbols in the RPM
INSTALL(FILES
        binary
        PERMISSIONS OWNER_READ OWNER_WRITE)

While this does not:
INSTALL(FILES
        binary
        PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
No tags attached.
patch cpack-rpm-postintall.patch (5,679) 2008-08-25 04:27
https://public.kitware.com/Bug/file/1678/cpack-rpm-postintall.patch
patch cpack-rpm-bugs-7435-7000-6980.patch (6,718) 2008-08-25 04:56
https://public.kitware.com/Bug/file/1679/cpack-rpm-bugs-7435-7000-6980.patch
patch cpack-rpm-bugs-7435-6980.patch (4,164) 2008-09-09 16:08
https://public.kitware.com/Bug/file/1711/cpack-rpm-bugs-7435-6980.patch
Issue History
2008-07-31 16:58Paul HatfieldNew Issue
2008-07-31 21:52Paul HatfieldNote Added: 0012913
2008-07-31 22:35Bill HoffmanNote Added: 0012914
2008-08-02 05:59Eric NOULARDNote Added: 0012921
2008-08-02 06:18Eric NOULARDNote Added: 0012922
2008-08-02 06:22Eric NOULARDNote Added: 0012923
2008-08-19 14:13Bill HoffmanNote Added: 0013067
2008-08-19 14:13Bill HoffmanStatusnew => assigned
2008-08-19 14:13Bill HoffmanAssigned To => Bill Hoffman
2008-08-25 04:27Eric NOULARDFile Added: cpack-rpm-postintall.patch
2008-08-25 04:32Eric NOULARDNote Added: 0013165
2008-08-25 04:56Eric NOULARDFile Added: cpack-rpm-bugs-7435-7000-6980.patch
2008-08-25 04:57Eric NOULARDNote Added: 0013167
2008-09-09 14:20Bill HoffmanNote Added: 0013387
2008-09-09 16:08Eric NOULARDNote Added: 0013395
2008-09-09 16:08Eric NOULARDFile Added: cpack-rpm-bugs-7435-6980.patch
2008-09-11 11:15Bill HoffmanNote Added: 0013422
2008-09-11 12:01Eric NOULARDNote Added: 0013428
2008-09-18 04:34Eric NOULARDNote Added: 0013506
2008-09-19 17:46Bill HoffmanNote Added: 0013528
2008-09-21 05:56Eric NOULARDNote Added: 0013536
2008-09-22 09:56Bill HoffmanNote Added: 0013537
2008-10-01 09:51Bill HoffmanStatusassigned => closed
2008-10-01 09:51Bill HoffmanResolutionopen => fixed

Notes
(0012913)
Paul Hatfield   
2008-07-31 21:52   
I can correct my issue by adding the following line in the spec file:
%define __spec_install_post /bin/true

I sent an e-mail to Eric Noulard the author of CPackRPM.cmake.
If this is the correct solution perhaps he can make it official.
(0012914)
Bill Hoffman   
2008-07-31 22:35   
I think the RPM tools do this by default. So, your fix could not be the default in CMake, it would have to be controlled by some cpack variable.
(0012921)
Eric NOULARD   
2008-08-02 05:59   
Hi all,
As already told by private e-mail I'm on holiday
and cannot test this.
However bill is write the default behaviour for rpmbuild -bb
is to strip executables.
(0012922)
Eric NOULARD   
2008-08-02 06:18   
Sorry for my terrible english Bill is "right" :=)
at the end of a build
rpmbuild invoke some default "post install scripts"
(which may be varying for different distros)
on redhat/fedora one will found something like:

+ /usr/lib/rpm/redhat/brp-compress
+ /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/redhat/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-python-bytecompile
+ /usr/lib/rpm/redhat/brp-java-repack-jars

%define __spec_install_post /bin/true

will replace the default postinstall behavior.
I agree with Bill this is a "user-specific" choice to avoid
stripping or not.

We may add CPACK_RPM_SPEC_INSTALL_POST variable which
may be user set for this case.

I'll propose a patch on my return from holiday (mid-august)
(0012923)
Eric NOULARD   
2008-08-02 06:22   
I may be wrong, check this too
http://www.cmake.org/pipermail/cmake/2008-August/023176.html [^]
(0013067)
Bill Hoffman   
2008-08-19 14:13   
CPACK_RPM_SPEC_INSTALL_POST sounds like the best thing to do. As other things maybe could go into the spec file.
(0013165)
Eric NOULARD   
2008-08-25 04:32   
I did upload a patch against current CMake-2-6 branch.
With the patch CPackRPM now handles
  CPACK_RPM_SPEC_INSTALL_POST
which can be set ot whatever post-install command is needed to be inserted
in the spec file. In particular setting it to "/bin/true" will prevent
rpmbuild from stripping binaries.

I did add a more generic:
  CPACK_RPM_SPEC_MORE_DEFINE
which may contains any "%define" lines to be inserted in the generated spec file.

The patch contains a warning
(as suggested in http://public.kitware.com/Bug/view.php?id=7000 [^])
if ever CPackRPM is used with CPACK_USE_DESTDIR unset.
(0013167)
Eric NOULARD   
2008-08-25 04:57   
The freshly attached patch is better it fixes 3 bugs:

http://public.kitware.com/Bug/view.php?id=7435 [^]
http://public.kitware.com/Bug/view.php?id=7000 [^]
http://public.kitware.com/Bug/view.php?id=6980 [^]
(0013387)
Bill Hoffman   
2008-09-09 14:20   
So, in the patch i386 will no longer be the default arch. Is that ok, or will it break old projects?
(0013395)
Eric NOULARD   
2008-09-09 16:08   
Yes it's not a problem since when you don't specify arch in the spec file
the RPM get the host spec file, which is the better default way to go.
Unless you know you build an RPM with non-host arch (main 'noarch' case).

You may check the now default arch of the RPM with:
rpm -qp --queryformat '%{ARCH}\n' <generated-rpm-file>

for example for CMake rpm on my Debian Etch x64 I now get:
rpm -qp --queryformat '%{ARCH}\n' /home/eric/CMake/CMake-2.6_build/cmake-2.6.2-RC-3-Linux-x86_64.rpm
x86_64

on i386 you should get i386 just as before.

I couldn't imagine in which way it could break older project,
but I have no testbox at hand to test this now.

However concerning this patch I'll upload a new one for which
http://public.kitware.com/Bug/view.php?id=7000 [^]
is not fixed because I propose another (should be better) way to fix
it.
(0013422)
Bill Hoffman   
2008-09-11 11:15   
So, which patch should I apply?
(0013428)
Eric NOULARD   
2008-09-11 12:01   
You should apply the last one:
  cpack-rpm-bugs-7435-6980.patch
which fixes bugs 7435 and 6980.

I think bug 7000 should be handled in another way.
(0013506)
Eric NOULARD   
2008-09-18 04:34   
Hi Bill,

Did something prevent you from applying the
cpack-rpm-bugs-7435-6980.patch:
https://public.kitware.com/Bug/file/1711/cpack-rpm-bugs-7435-6980.patch [^]
for current CMake 2.6 RC?
(0013528)
Bill Hoffman   
2008-09-19 17:46   
Just moved it to CVS:
cvs commit -m "BUG: 7435 fixes to add optional post-install" CPackRPM.cmake
Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v <-- CPackRPM.cmake
new revision: 1.8; previous revision: 1.7

Please let me know if this is correct, and I will move it to the next 2.6 RC.
(0013536)
Eric NOULARD   
2008-09-21 05:56   
Bill,

I think you applied the wrong patch, I should have removed the wrong one
from the tracker but I did not find a way to do that.

The patch you applied does contain
an unconditional warning if DESTDIR is not set.

There is another solution to this DESTDIR problem (not only for RPMs)
which is currently discussed:
http://public.kitware.com/Bug/view.php?id=7000 [^]

Thus if you suppress the 4 following lines from CPackRPM.cmake file
then this may go to next 2.6 RC:

IF(NOT CPACK_SET_DESTDIR)
  MESSAGE("CPackRPM:Warning: You did not set CPACK_SET_DESTDIR to ON")
  MESSAGE("CPackRPM:Warning: this will make CPackRPM fail if you have installed files with absolute path")
ENDIF(NOT CPACK_SET_DESTDIR)

Keeping this warning is not that bad, but this does not seem to be
the solution currently discussed for the DESTDIT issue.
(0013537)
Bill Hoffman   
2008-09-22 09:56   
$ cvs commit -m "BUG: 7435, remove warning for not setting DESTDIR" CPackRPM.cmake
Committer: Bill Hoffman <bill.hoffman@kitware.com>
/cvsroot/CMake/CMake/Modules/CPackRPM.cmake,v <-- CPackRPM.cmake
new revision: 1.9; previous revision: 1.8