[Rd] Trying to make DEBUG=T a debug version of R

Andre Mikulec andre_mikulec at hotmail.com
Sun Apr 14 04:14:45 CEST 2013


>>Duncan Murdoch murdoch.duncan at gmail.com 
>>Thu Apr 11 14:01:36 CEST 2013
>>Previous message: [Rd] Trying to make DEBUG=T a debug version of R
>>Next message: [Rd] Trying to make DEBUG=T a debug version of R
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>On 13-04-10 8:02 PM, Andre Mikulec wrote:
>>> Hi,
>>>
>>> I am trying to make a debug version of R ( for use with gdb later ) on windows.
>>>
>>> I am executing the following.
>>>
>>> src\gnuwin32>make clean
>>> src\gnuwin32>make DEBUG=T
>>>
>>> In the output, I see many
>>>
>>> -O3 flags
>>>
>>> I do not see any
>>>
>>>   -g -O0 flags
>>>
>>> which ( I believe/I think ) that is what I need to debug R in gdb.
>>>
>>> What is the proper way to 'make' a 'Debug version of R'?
>>
>>You don't need -O0 to debug in gdb, you just need the -g flag set 
>>properly, which DEBUG=T will do for you.  That's how I generally do it.
>>
>>Setting -O0 might make debugging easier (because it eliminates 
>>optimizations).  To do that, you'll need to change the CFLAGS setting in 
>>src/gnuwin32/Makefiles.  (You may also be able to do it with a CFLAGS 
>>environment variable, I haven't tried.)  I don't usually do this, since 
>>it changes the code:  if you need gdb, chances are the bug is subtle, 
>>and its behaviour may change with optimization level.  But you may have 
>>a different preference.
>>
>>Duncan Murdoch
>>
>>Previous message: [Rd] Trying to make DEBUG=T a debug version of R
>>Next message: [Rd] Trying to make DEBUG=T a debug version of R
>>Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>More information about the R-devel mailing list

I am still having trouble, ( on Windows )

> Setting -O0 might make debugging easier (because it eliminates
> optimizations). To do that, you'll need to change the CFLAGS setting in    
> src/gnuwin32/Makefiles. 
>
> Duncan Murdoch

I tried that. Changing the CFLAGS setting works early in the compile process.
But later in the compile process when trying to compile
the packages 'base' and 'stats' the optimization revert back to '-O3'

(You may also be able to do it with a CFLAGS
> environment variable, 
>
> Duncan Murdoch

I tried setting th environment variable

set CFLAGS=-O0

This did not work.
I tried both on the commandline followed by typing
 
  make all

and the "System Properties" dialog.
Followed by opening a new command line and typing

  make all

I tried several things

In the Windows compiling and linking with the gnu tools,

the following hacks seem to work ( early in the compiling process ) but not later.

Of the C99FLAGS lines,  at their  ends, I just added " -ggdb"

src\gnuwin32\MkRules.rules

  C99FLAG=-std=gnu99 -ggdb

src\gnuwin32\MkRules.local

  C99FLAG=-std=gnu99 -ggdb

In one place I just changed the optimization level.

src\gnuwin32\Makefile

  CFLAGS=-O0 -Wall -pedantic $(EOPTS)
  FFLAGS=-O0 $(EOPTS)

But again, these only work in the early stages of compiling.
Eventually, when I start compiling "base"

-ggdb disappers and -O0 optimization goes back to -O3

Does anyone have any ideas?

Thank you,
Andre Mikulec
Andre_Mikulec at Hotmail.com 		 	   		  


More information about the R-devel mailing list