Re: [R-SIG-Mac] Debug Rcpp with lldb: variables not available
Hi inf0phile, you can just run the command generated by devtools (including the step that generates the package.so file) manually on the command line in the src folder. Just remember to replace -g O2 with -g O0, then you get the unoptimized shared object that shouldn't make any problems in debugger. Best Regards, Constantin Am Fr., 12. Juni 2020 um 14:57 Uhr schrieb inf0phile via R-SIG-Mac < r-sig-mac@r-project.org>: > * I made a minimal example in order to be reproduced: > > library(Rcpp) > library(RcppArmadillo) > RcppArmadillo.package.skeleton() > > which create the package anRpackage. > Setting the working directory in this package, I load it by: > > library(devtools) > devtools::load_all() > > * Then the basic function rcpparma_hello_world() can be executed: > > rcpparma_hello_world() > > [,1] [,2] [,3] > [1,]700 > [2,]070 > [3,]007 > > * I want now to debug the code with lldb via the Terminal command R -d > lldb in order to check the variable values during the execution via the > command frame variable. > > R -d lldb > (lldb) breakpoint set --name rcpparma_hello_world() > (lldb) run > > library(devtools) > > devtools::load_all() > > rcpparma_hello_world() > > anRpackage.so was compiled with optimization - stepping may behave oddly; > variables may not be available. > > Indeed, the problem is that most of variables are not available: > > > next > > frame variable > > (arma::mat) m1 = > (arma::mat) m2 = > > * I read in the previous link the following recommandations: > > you may consider producing so-called ‘debug’ builds, with optimization > toned down, when attempting to debug these kinds of issues as well. For > building R packages, this effectively amounts to something like CXXFLAGS=-g > -O0 in your ~/.R/Makevars file) > > * I have tried it but it seems to have no effect under the compilation > flags used since I have a local file Makevars in my package to specify the > way of compiling with RcppArdimillo, whose flags are: > > CXX_STD = CXX11 > PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) > PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) > > * Then, the command devtools::load_all() produces the line-command > compilation given below, in which there is indeed -g -O2 making some code > optimization: > > clang++ -mmacosx-version-min=10.13 -std=gnu++11 > -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG > -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' > -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' > -I/usr/local/include-fPIC -Wall -g -O2 -c rcpparma_hello_world.cpp -o > rcpparma_hello_world.o > > Question: how can I have access to the variables in debugging mode? > > Thanks > > ‐‐‐ Original Message ‐‐‐ > Le jeudi 11 juin 2020 18:48, inf0phile via R-SIG-Mac < > r-sig-mac@r-project.org> a écrit : > > > Hello, > > > > I'm making a package with Rcpp (and RcppArmadillo) under the latest > version of Rstudio (1.3.959) and R (4.0.0). > > > > - The compilation of the cpp files (with clang) is working well > > > > clang++ -mmacosx-version-min=10.13 -std=gnu++11 > -I"/Library/Frameworks/ > > R.framework/Resources/include > > " -DNDEBUG -I'/Library/Frameworks/ > > R.framework/Versions/4.0/Resources/library/Rcpp/include > > ' -I'/Library/Frameworks/ > > R.framework/Versions/4.0/Resources/library/RcppArmadillo/include > > ' -I/usr/local/include -fPIC -Wall -g -O2 -c compensator_Rcpp.cpp -o > compensator_Rcpp.o > > > > This command is automatically generated by pushing the Rstudio > package dev button "Install and restart" > > > > - I want now to debug the code with lldb ( > https://kevinushey.github.io/blog/2015/04/13/debugging-with-lldb/) via > the Terminal command R -d lldb in order to check the variable values during > the execution via the command frame variable. The problem is most of them > are not available: > > > > (SEXP) lambda = > > > > > > (Rcpp::NumericVector) beta = out> > > (int) index = > > > > - I read in the previous link the following recommandations: > > > > > you may consider producing so-called ‘debug’ builds, with optimization > toned down, when attempting to debug these kinds of issues as well. For > building R packages, this effectively amounts to something like CXXFLAGS=-g > -O0 in your ~/.R/Makevars file) > > > > - I have tried it but it seems to have no effect under the compilation > flags used since I have a local file Makevars in my package to specify the > way of compiling with RcppArdimillo ( > http://dirk.eddelbuettel.com/blog/2017/06/04/), whose flags are: > > > > CXX_STD = CXX11 > > PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) > > PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) > $(FLIBS) > > > > producing the line-command compilation given above, in which there > is indeed -g -O2 making some code optimization. > > > > Question: how
Re: [R-SIG-Mac] Packages with updated spatial libraries.
On Fri, 12 Jun 2020, rmendelss gmail wrote: Thank you for these efforts. I imagine it will also make it easier to eventually have these on CRAN. Do you have the possibility to try out the affected packages in your workflows to provide feedback? At the moment, user feedback can help guide the deployment of CRAN macOS R-spatial binaries. Roger -Roy On Jun 12, 2020, at 7:11 AM, Prof Brian Ripley wrote: I have put binary packages on CRANextras for lwgeom rgdal rgeos sf built with GEOS 3.8.1, GDAL 3.1.0, PROJ 6.3.2. Install with (e.g.) options(repos="https://www.stats.ox.ac.uk/pub/RWin;) install.packages('rgdal', type = 'binary') (This needed a development version of the rgdal sources.) This is just to allow early access: it is planned to use these versions of the libs on the CRAN builders soon (but they do need package updates, e.g. for rgdal and proj4). These are all using static libraries to make these self-contained. (In case anyone is wondering why not PROJ 7 -- that would need unreleased changes to the PROJ and GDAL sources and changes to many CRAN packages.) -- Brian D. Ripley, rip...@stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac -- Roger Bivand Department of Economics, Norwegian School of Economics, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no https://orcid.org/-0003-2392-6140 https://scholar.google.no/citations?user=AWeghB0J=en ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Re: [R-SIG-Mac] Packages with updated spatial libraries.
I will do the install sometime over the weekend, and test what I have (mainly the packages I have that use these). Today is kind of tis up (I mean I can do the install easily enough, just no time to do any testing). Thanks, -Roy > On Jun 12, 2020, at 7:17 AM, Roger Bivand wrote: > > On Fri, 12 Jun 2020, rmendelss gmail wrote: > >> Thank you for these efforts. I imagine it will also make it easier to >> eventually have these on CRAN. >> > > Do you have the possibility to try out the affected packages in your > workflows to provide feedback? At the moment, user feedback can help guide > the deployment of CRAN macOS R-spatial binaries. > > Roger > >> -Roy >> >> >>> On Jun 12, 2020, at 7:11 AM, Prof Brian Ripley >>> wrote: >>> >>> I have put binary packages on CRANextras for lwgeom rgdal rgeos sf built >>> with GEOS 3.8.1, GDAL 3.1.0, PROJ 6.3.2. >>> >>> Install with (e.g.) >>> >>> options(repos="https://www.stats.ox.ac.uk/pub/RWin;) >>> install.packages('rgdal', type = 'binary') >>> >>> (This needed a development version of the rgdal sources.) >>> >>> This is just to allow early access: it is planned to use these versions of >>> the libs on the CRAN builders soon (but they do need package updates, e.g. >>> for rgdal and proj4). >>> >>> These are all using static libraries to make these self-contained. >>> >>> (In case anyone is wondering why not PROJ 7 -- that would need unreleased >>> changes to the PROJ and GDAL sources and changes to many CRAN packages.) >>> >>> -- >>> Brian D. Ripley, rip...@stats.ox.ac.uk >>> Emeritus Professor of Applied Statistics, University of Oxford >>> >>> ___ >>> R-SIG-Mac mailing list >>> R-SIG-Mac@r-project.org >>> https://stat.ethz.ch/mailman/listinfo/r-sig-mac >> >> > > -- > Roger Bivand > Department of Economics, Norwegian School of Economics, > Helleveien 30, N-5045 Bergen, Norway. > voice: +47 55 95 93 55; e-mail: roger.biv...@nhh.no > https://orcid.org/-0003-2392-6140 > https://scholar.google.no/citations?user=AWeghB0J=en ** "The contents of this message do not reflect any position of the U.S. Government or NOAA." ** Roy Mendelssohn Supervisory Operations Research Analyst NOAA/NMFS Environmental Research Division Southwest Fisheries Science Center ***Note new street address*** 110 McAllister Way Santa Cruz, CA 95060 Phone: (831)-420-3666 Fax: (831) 420-3980 e-mail: roy.mendelss...@noaa.gov www: https://www.pfeg.noaa.gov/ "Old age and treachery will overcome youth and skill." "From those who have been given much, much will be expected" "the arc of the moral universe is long, but it bends toward justice" -MLK Jr. ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Re: [R-SIG-Mac] Packages with updated spatial libraries.
Thank you for these efforts. I imagine it will also make it easier to eventually have these on CRAN. -Roy > On Jun 12, 2020, at 7:11 AM, Prof Brian Ripley wrote: > > I have put binary packages on CRANextras for lwgeom rgdal rgeos sf built with > GEOS 3.8.1, GDAL 3.1.0, PROJ 6.3.2. > > Install with (e.g.) > > options(repos="https://www.stats.ox.ac.uk/pub/RWin;) > install.packages('rgdal', type = 'binary') > > (This needed a development version of the rgdal sources.) > > This is just to allow early access: it is planned to use these versions of > the libs on the CRAN builders soon (but they do need package updates, e.g. > for rgdal and proj4). > > These are all using static libraries to make these self-contained. > > (In case anyone is wondering why not PROJ 7 -- that would need unreleased > changes to the PROJ and GDAL sources and changes to many CRAN packages.) > > -- > Brian D. Ripley, rip...@stats.ox.ac.uk > Emeritus Professor of Applied Statistics, University of Oxford > > ___ > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
[R-SIG-Mac] Packages with updated spatial libraries.
I have put binary packages on CRANextras for lwgeom rgdal rgeos sf built with GEOS 3.8.1, GDAL 3.1.0, PROJ 6.3.2. Install with (e.g.) options(repos="https://www.stats.ox.ac.uk/pub/RWin;) install.packages('rgdal', type = 'binary') (This needed a development version of the rgdal sources.) This is just to allow early access: it is planned to use these versions of the libs on the CRAN builders soon (but they do need package updates, e.g. for rgdal and proj4). These are all using static libraries to make these self-contained. (In case anyone is wondering why not PROJ 7 -- that would need unreleased changes to the PROJ and GDAL sources and changes to many CRAN packages.) -- Brian D. Ripley, rip...@stats.ox.ac.uk Emeritus Professor of Applied Statistics, University of Oxford ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac
Re: [R-SIG-Mac] Debug Rcpp with lldb: variables not available
* I made a minimal example in order to be reproduced: library(Rcpp) library(RcppArmadillo) RcppArmadillo.package.skeleton() which create the package anRpackage. Setting the working directory in this package, I load it by: library(devtools) devtools::load_all() * Then the basic function rcpparma_hello_world() can be executed: rcpparma_hello_world() [,1] [,2] [,3] [1,]700 [2,]070 [3,]007 * I want now to debug the code with lldb via the Terminal command R -d lldb in order to check the variable values during the execution via the command frame variable. R -d lldb (lldb) breakpoint set --name rcpparma_hello_world() (lldb) run > library(devtools) > devtools::load_all() > rcpparma_hello_world() anRpackage.so was compiled with optimization - stepping may behave oddly; variables may not be available. Indeed, the problem is that most of variables are not available: > next > frame variable (arma::mat) m1 = (arma::mat) m2 = * I read in the previous link the following recommandations: you may consider producing so-called ‘debug’ builds, with optimization toned down, when attempting to debug these kinds of issues as well. For building R packages, this effectively amounts to something like CXXFLAGS=-g -O0 in your ~/.R/Makevars file) * I have tried it but it seems to have no effect under the compilation flags used since I have a local file Makevars in my package to specify the way of compiling with RcppArdimillo, whose flags are: CXX_STD = CXX11 PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) * Then, the command devtools::load_all() produces the line-command compilation given below, in which there is indeed -g -O2 making some code optimization: clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I/usr/local/include-fPIC -Wall -g -O2 -c rcpparma_hello_world.cpp -o rcpparma_hello_world.o Question: how can I have access to the variables in debugging mode? Thanks ‐‐‐ Original Message ‐‐‐ Le jeudi 11 juin 2020 18:48, inf0phile via R-SIG-Mac a écrit : > Hello, > > I'm making a package with Rcpp (and RcppArmadillo) under the latest version > of Rstudio (1.3.959) and R (4.0.0). > > - The compilation of the cpp files (with clang) is working well > > clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/ > R.framework/Resources/include > " -DNDEBUG -I'/Library/Frameworks/ > R.framework/Versions/4.0/Resources/library/Rcpp/include > ' -I'/Library/Frameworks/ > R.framework/Versions/4.0/Resources/library/RcppArmadillo/include > ' -I/usr/local/include -fPIC -Wall -g -O2 -c compensator_Rcpp.cpp -o > compensator_Rcpp.o > > This command is automatically generated by pushing the Rstudio package > dev button "Install and restart" > > - I want now to debug the code with lldb > (https://kevinushey.github.io/blog/2015/04/13/debugging-with-lldb/) via the > Terminal command R -d lldb in order to check the variable values during the > execution via the command frame variable. The problem is most of them are not > available: > > (SEXP) lambda = > > > (Rcpp::NumericVector) beta = > (int) index = > > - I read in the previous link the following recommandations: > > > you may consider producing so-called ‘debug’ builds, with optimization > > toned down, when attempting to debug these kinds of issues as well. For > > building R packages, this effectively amounts to something like CXXFLAGS=-g > > -O0 in your ~/.R/Makevars file) > > - I have tried it but it seems to have no effect under the compilation > flags used since I have a local file Makevars in my package to specify the > way of compiling with RcppArdimillo > (http://dirk.eddelbuettel.com/blog/2017/06/04/), whose flags are: > > CXX_STD = CXX11 > PKG_CXXFLAGS = $(SHLIB_OPENMP_CXXFLAGS) > PKG_LIBS = $(SHLIB_OPENMP_CXXFLAGS) $(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) > > producing the line-command compilation given above, in which there is > indeed -g -O2 making some code optimization. > > Question: how can I have access to the variables in debugging mode? > > Thanks > [[alternative HTML version deleted]] > > > R-SIG-Mac mailing list > R-SIG-Mac@r-project.org > https://stat.ethz.ch/mailman/listinfo/r-sig-mac ___ R-SIG-Mac mailing list R-SIG-Mac@r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-mac