我想使用gdb
调试基于Rcpp的程序包,但是我的R配置丢失了-fdebug-prefix-map
,这似乎是调试器无法找到错误行的原因。如何配置此选项?
# etc/Makeconf. Generated from Makeconf.in by configure.
#
# ${R_HOME}/etc/Makeconf
#
# R was configured using the following call
# (not including env. vars and site configuration)
# configure '--prefix=/usr' '--with-cairo' '--with-jpeglib' '--with-readline' '--with-tcltk' '--with-system-bzlib' '--with-system-pcre' '--with-system-zlib' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share/R/share' '--includedir=/usr/share/R/include' '--with-blas' '--with-lapack' '--enable-R-profiling' '--enable-R-shlib' '--enable-memory-profiling' '--without-recommended-packages' '--build' 'x86_64-linux-gnu' 'build_alias=x86_64-linux-gnu' 'R_PRINTCMD=/usr/bin/lpr' 'R_PAPERSIZE=letter' 'TAR=/bin/tar' 'R_BROWSER=xdg-open' 'LIBnn=lib' 'JAVA_HOME=/usr/lib/jvm/default-java' 'R_SHELL=/bin/bash' 'CC=gcc -std=gnu99' 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g' 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro' 'CPPFLAGS=' 'FC=gfortran' 'FCFLAGS=-g -O2 -fstack-protector-strong' 'CXX=g++' 'CXXFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g'
这是我的程序包编译消息。
g++ -std=gnu++17 -I"/usr/share/R/include" -DNDEBUG -I"/home/sasa/R/x86_64-pc-linux-gnu-library/3.6/Rcpp/include" -ggdb3 -Og -march=native -flto -Wall -Werror -fpic -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -c train.cpp -o train.o
g++ -std=gnu++17 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o fast.beta.train.so RcppExports.o train.o -ggdb3 -Og -march=native -flto -Wall -Werror -L/usr/lib/R/lib -lR```
答案 0 :(得分:2)
您可以
~/.R/Makevars
(可能是首选)或Makeconf
(在etc/
下面)编辑文件$RHOME
或src/Makevars
进行设置。没有编程方式,Policy不鼓励您将其添加到每个程序包文件中,因此您不能在CRAN程序包中执行第三个选项。