[R-pkg-devel] Compiler optimization flags with R package
Guillaume Chapron
carnivorescience at gmail.com
Sun Jun 18 09:22:00 CEST 2017
Thanks!
In that file, I see:
CC = clang
CFLAGS = -Wall -mtune=core2 -g -O2 $(LTO)
will having -O0 instead give me all the variables or is there a flag for better debugging (I guess -g does it a little already)?
Thanks again
> On 17 Jun 2017, at 21:57, Dirk Eddelbuettel <edd at debian.org> wrote:
>
>
> On 17 June 2017 at 21:32, Guillaume Chapron wrote:
> | I am trying to debug some C code that is run only through a R package. I debug with lldb but I always get a message telling that the package "was compiled with optimization - stepping may behave oddly; variables may not be available.” And in fact, I cannot evaluate all variables and understand what is wrong. I have created a Makevars file in ~/.R/ that contains C=clang -O0 -g but it does not seem to change much. What should I do to make sure I can evaluate all variables in lldb? I am on a Mac and I wrote C=clang because I read that it produced much better error messages but I am happy to use gcc as well if this can be a solution.
>
> Edit the file Makeconf in e.g.
>
> R> file.path(Sys.getenv("R_HOME"), "etc", "Makeconf")
> [1] "/usr/lib/R/etc/Makeconf"
> R>
>
> It has those settings hardwired from when R itself was compiled for you. You
> probably want to keep a copy of the original file to be able to revert.
>
> Dirk
>
> --
> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
More information about the R-package-devel
mailing list