如何使用非默认标志在 ubuntu 中安装 R?
例如,为了进行调试,我想使用
-fsanitize=address
选项。如何做?
答案1
CFLAGS
在执行配置脚本之前设置适当的环境变量似乎就足够了,例如
CFLAGS="-fsanitize=address" ./configure --prefix=/usr/local
配置摘要确认
R is now configured for x86_64-pc-linux-gnu
Source directory: .
Installation directory: /usr/local
C compiler: gcc -std=gnu99 -fsanitize=address
Fortran 77 compiler: gfortran -g -O2
C++ compiler: g++ -g -O2
C++ 11 compiler: g++ -std=c++11 -g -O2
Fortran 90/95 compiler: gfortran -g -O2
Obj-C compiler: gcc -g -O2 -fobjc-exceptions
Interfaces supported: X11, tcltk
External libraries: readline, zlib, bzlib, lzma, PCRE
Additional capabilities: PNG, JPEG, TIFF, NLS, cairo, ICU
Options enabled: shared BLAS, R profiling
Capabilities skipped:
Options not enabled: memory profiling
Recommended packages: yes
configure: WARNING: neither inconsolata.sty nor zi4.sty found: PDF vignettes and package manuals will not be rendered optimally
gcc
并且附加标志在后续命令中可见make
,例如
gcc -std=gnu99 -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -fopenmp -fsanitize=address -c integrate.c -o integrate.o
如果你想将标志传递给其他编译器(例如 C++ 或 Fortran 编译器),那么你可能需要设置它们的等效标志CXXFLAGS
,以及FCFLAGS
:要获得完整列表,你可以执行
./configure --help | less
并查看标题为 的部分Some influential environment variables
。