How to compile a soft same as the version realeased by fedora?
JD
jd1008 at gmail.com
Sun Mar 20 02:50:06 UTC 2011
On 03/19/2011 06:24 PM, stan wrote:
> On Sat, 19 Mar 2011 17:54:28 -0700
> Konstantin Svist<fry.kun at gmail.com> wrote:
>
>> By default, both production and debug versions are built using the
>> fedora method. At least that's the way the kernel .src package behaves
> Found the cause. And your observation above seems to be correct. There
> is a file in /usr/lib/rpm called rpmrc. That file has the compile flags
> that rpmbuild uses. There is a -g on every one. So anything that is
> built by rpmbuild with a default Fedora system will have debug
> information compiled into the binary. Maybe the packager does this and
> then strips the debugging information into a separate package, and uses
> the stripped binary as the official binary package?
>
> To change that, cp the file to ~/.rpmrc and then edit and remove all
> the architectures except the one you are interested in (yours!).
> Duplicate the line, and comment out one of them. On the other, remove
> the -g from the end of the line. rpmbuild -bb will then compile the
> package using optimization. If you ever want to compile a package for
> debugging, comment the optimization line and uncomment the debug
> line. In that case you might want to change -g to -ggdb if you are
> going to use gdb as a debugger.
>
> This seems to be compiling faster as well. I suppose that is a result
> of not needing to add debugging information.
>
I checked the rpmrc file.
It has -O2 -g flags enabled.
-O2 does quiet a bit of optimization,
making a debugged kernel not behave as the person doing the
debugging would expect. The man page for gcc says:
-O0 Reduce compilation time and make debugging produce the expected
results. This is the default.
In other words, -O2 will not provide the expected results if you
build the kernel (or any other program for that matter) with -O2 -g.
More information about the users
mailing list