3

Linux version 2.6.18-131.el5 gcc version 4.1.2 RPM version 4.4.2.3

I use the following command to build packages: $ sudo rpmbuild -ba xxx.spec

I thought that the debuginfo package should be built by default, but only get the xxx.src.rpm and xxx.x86_64.rpm, with no debuginfo package.

Then I add a line in my xxx.spec, "#%debug_package":

enter image description here

Then the debug package is built! But I thought that a line with a '#' in the front is considered as comment! How does this work?

I'm totally confused.

  • I've solved the problem.I install the package redhat-rpm-config and then get the debuginfo package by default. But can anyone tell me how does the package effect the building of debuginfo? –  Aug 27 '13 at 09:10

1 Answers1

8

This is one of the most annoying "features" in rpm and it gets people all the time. The # is only commenting out the first line of a multi-line macro. The proper way to comment it out would be

#%%debug_package

The first % escapes the second; the result after macro becomes what you wanted.

Aaron D. Marasco
  • 6,506
  • 3
  • 26
  • 39
  • Thanks for your answer.But why the debug_package is not built by default? –  Aug 26 '13 at 13:49
  • You should be able to completely remove that line, as debuginfo packages should be built automatically (if not, you probably need to install redhat-rpm-config). I've put some brief info about it at http://distracted-it.blogspot.com/2014/08/building-rpm-debuginfo-package-not.html – Cameron Kerr Aug 27 '14 at 03:56
  • this also suggests same with more explanation: https://trac.netlabs.org/rpm/wiki/RpmHowToPackagers#Generatingdebuginfopackages – explorer Sep 20 '20 at 19:11