Is there any way to disable compiler optimization and enable debug?

Поиск
Список
Период
Сортировка
Искать

Is there any way to disable compiler optimization and enable debug?

От:
clover white <mywhiteclover@gmail.com>
Дата:
HI,
  I would like to debug PG because I have a problem when I run initdb, and I have question about the configure file.

when I used the command below to config PG, it was only built with debugging symbols (-g) and O2 compiler optimization which would lead to execute order not match the source code order.
./configure --enable-debug --enable-depend --enable-cassert --prefix=/home/pgsql/pgsql

then I export CFLAGS=O0, but it still couldn't work.
I read  a little about confiqure file and find out that CFLAGS is unset in confiqure.
and CFLAGS is also control by global variable: ac_env_CFLAGS_set and ac_env_CFLAGS_value.

but i do not know how i could pass ac_env_CFLAGS_set and ac_env_CFLAGS_value to the configure file.

by now, I replace all the O2 flag to O0 in  configure file to resolve the debug source code order problem temporary.

Is there any other way to disable compiler optimization and enable debug?

Thank you for help.

Re: Is there any way to disable compiler optimization and enable debug?

От:
Andrew Dunstan <andrew@dunslane.net>
Дата:


On 04/08/2012 01:42 PM, clover white wrote:
> HI,
>   I would like to debug PG because I have a problem when I run initdb, 
> and I have question about the configure file.
>
> when I used the command below to config PG, it was only built with 
> debugging symbols (-g) and O2 compiler optimization which would lead 
> to execute order not match the source code order.
> ./configure --enable-debug --enable-depend --enable-cassert 
> --prefix=/home/pgsql/pgsql
>
> then I export CFLAGS=O0, but it still couldn't work.
> I read  a little about confiqure file and find out that CFLAGS is 
> unset in confiqure.
> and CFLAGS is also control by global variable: ac_env_CFLAGS_set and 
> ac_env_CFLAGS_value.
>
> but i do not know how i could pass ac_env_CFLAGS_set and 
> ac_env_CFLAGS_value to the configure file.
>
> by now, I replace all the O2 flag to O0 in  configure file to resolve 
> the debug source code order problem temporary.
>
> Is there any other way to disable compiler optimization and enable debug?
>
> Thank you for help.

Try:
   CFLAGS=-O0 ./configure --enable-debug ....


cheers

andrew

Re: Is there any way to disable compiler optimization and enable debug?

От:
Peter Eisentraut <peter_e@gmx.net>
Дата:
On sön, 2012-04-08 at 14:47 -0400, Andrew Dunstan wrote:
> Try:
> 
>     CFLAGS=-O0 ./configure --enable-debug ....

Better yet:

./configure CFLAGS=-O0 --enable-debug ....



FAQ