As I know, a solution is customizing Makefile target by yourself in src/Makevars of your package, and removing the -g option.

As an example, you can see https://github.com/SimonYansenZhao/wsrf/blob/09b197ed79b1c55a95d52b14aa5db3437f75f930/src/Makevars

I paste that here.  See "$(CXX1XFLAGS:-g=)" below.

    CXX_STD = "CXX11"
    PKG_LIBS = `"$(R_HOME)/bin/Rscript" -e "Rcpp:::LdFlags()"` -pthread

    all: $(SHLIB)

    %.o: %.cpp
        $(SHLIB_CXX1XLD) $(wsrf_FLAGS) -c $< -o $@

However, I am not sure if it is allowed on CRAN, and I think it must have a reason for that, though I don't know.

So I didn't do that in my package.

Best regards,

On 2016年10月16日 21:46, Da Zheng wrote:

I'm writing an R package that is mainly written in C++. By default, R
CMD INSTALL creates C/C++ flags as follows:
-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat
-Werror=format-security -D_FORTIFY_SOURCE=2 -g

However, my package is fairly large. With debug info compiled into the
library, the generated .so file is over 200MB. Without debug info,
it's about 30MB. I hope by default debug info is disabled. However, I
don't see any option in R CMD INSTALL that can disable "-g". Could
anyone tell me how to disable it?

Many thanks,

R-devel@r-project.org mailing list

R-devel@r-project.org mailing list

Reply via email to