Thread: How is the PostgreSQL debuginfo file generated
Hello hackers,
I’m wondering how to build the debuginfo package from the PostgreSQL source.
For example to generate something like this one : postgresql91-debuginfo.x86_64.
Is there existing support in the current PostgreSQL Makefiles to generate such debuginfo? I have searched in the source code and could find anything. How were the existing debuginfo packages created?
Thank you!
Ruihai
Rui Hai Jiang <ruihaijiang@msn.com> writes: > Im wondering how to build the debuginfo package from the PostgreSQL source. > For example to generate something like this one : postgresql91-debuginfo.x86_64. On platforms where such things exist, that's handled by the packaging system, not by PG proper. You should proceed by making a new SRPM and building RPMs from that. regards, tom lane
On 23 November 2017 at 18:38, Rui Hai Jiang wrote:
> Hello hackers,
>
>
>
> I’m wondering how to build the debuginfo package from the PostgreSQL
> source.
>
>
>
> For example to generate something like this one :
> postgresql91-debuginfo.x86_64.
>
>
>
> Is there existing support in the current PostgreSQL Makefiles to generate
> such debuginfo? I have searched in the source code and could find anything.
> How were the existing debuginfo packages created?
>
>
>
When you're building from source, no separate debuginfo is produced. If you
build with --enable-debug, the debuginfo is embedded in the binaries. The
resulting binaries are very large but not generally any slower.
Packaging systems have helper programs that invoke 'strip' (or sometimes
objcopy) to split out the debuginfo into a separate file and remove it from
the original executable. See
https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html and
https://fedoraproject.org/wiki/Packaging:Debuginfo?rd=Packaging/Debuginfo .
You cannot generally re-create debuginfo to match a given binary package.
You'd have to rebuild in an absolutely identical environment: exact same
library versions, compiler version, configure flags, etc etc etc. Otherwise
you'll get broken/misleading debuginfo.
-- Craig Ringer http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services
A little trick:
1. configure with —enable-debug, run “make install”, use this build result
as debuginfo
2. then run “make install-strip”, use this result as release
However the it is not the regular debuginfo, you still can call gdb with
it. Additionally, you can dump the real debuginfo from it later.
Craig Ringer 于2017年11月24日 周五10:04写道:
> On 23 November 2017 at 18:38, Rui Hai Jiang wrote:
>
>> Hello hackers,
>>
>>
>>
>> I’m wondering how to build the debuginfo package from the PostgreSQL
>> source.
>>
>>
>>
>> For example to generate something like this one :
>> postgresql91-debuginfo.x86_64.
>>
>>
>>
>> Is there existing support in the current PostgreSQL Makefiles to generate
>> such debuginfo? I have searched in the source code and could find anything.
>> How were the existing debuginfo packages created?
>>
>>
>>
> When you're building from source, no separate debuginfo is produced. If
> you build with --enable-debug, the debuginfo is embedded in the binaries.
> The resulting binaries are very large but not generally any slower.
>
> Packaging systems have helper programs that invoke 'strip' (or sometimes
> objcopy) to split out the debuginfo into a separate file and remove it from
> the original executable. See
> https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html and
> https://fedoraproject.org/wiki/Packaging:Debuginfo?rd=Packaging/Debuginfo
> .
>
> You cannot generally re-create debuginfo to match a given binary package.
> You'd have to rebuild in an absolutely identical environment: exact same
> library versions, compiler version, configure flags, etc etc etc. Otherwise
> you'll get broken/misleading debuginfo.
>
>
> --
> Craig Ringer http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Training & Services
>
--
GaoZengqi
pgf00a@gmail.com
zengqigao@gmail.com
Thank you for your help.
I have tried many ways you suggested. I was not familiar with this area, so I did spend lots of time trying.
At last, I found the easiest way to do this is to build a new SRPM package, then build other RPMs from the new SRPM.
Thanks a lot,
Ruihai
________________________________
From: Tom Lane
Sent: Friday, November 24, 2017 12:50:37 AM
To: Rui Hai Jiang
Cc: pgsql-hackers@postgresql.org
Subject: Re: How is the PostgreSQL debuginfo file generated
Rui Hai Jiang writes:
> I’m wondering how to build the debuginfo package from the PostgreSQL source.
> For example to generate something like this one : postgresql91-debuginfo.x86_64.
On platforms where such things exist, that's handled by the packaging
system, not by PG proper. You should proceed by making a new SRPM
and building RPMs from that.
regards, tom lane