美文网首页
R包安装报错:nzchar(SHLIB_LIBADD)

R包安装报错:nzchar(SHLIB_LIBADD)

作者: 周运来就是我 | 来源:发表于2020-10-14 18:16 被阅读0次

    Error in if (nzchar(SHLIB_LIBADD)) SHLIB_LIBADD else character() : argument is of length zero

    可能原因:多数出现在anaconda下安装R,R目录下的R/etc/Makeconf为空

    • 解决办法:

    复制一份非空的Makeconf 文件过来

    • Makeconf 是什么

    默认情况下,configure在C、Fortran和CXX源的编译标志中添加一个标志(通常是-g)。这会降低R和包的编译速度,增加对象的大小,所以改变这些标志(在config中设置' CFLAGS '等)可能是个好主意。网站之前配置,或编辑文件Makeconf和etc/Makeconf之间运行配置和make)。

    $ miniconda3/envs/scrna/lib/R/etc
    
    $ls 
    javaconf  ldpaths  Makeconf  Renviron  repositories
    
    
    $ cat Makeconf
    # 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=/miniconda3/envs/tcga' '--host=x86_64-conda_cos6-linux-gnu' '--build=x86_64-conda_cos6-linux-gnu' '--enable-shared' '--enable-R-shlib' '--with-blas=-lblas' '--with-lapack=-llapack' '--disable-prebuilt-html' '--enable-memory-profiling' '--with-tk-config=/miniconda3/envs/tcga/lib/tkConfig.sh' '--with-tcl-config=/miniconda3/envs/tcga/lib/tclConfig.sh' '--with-x' '--with-pic' '--with-cairo' '--with-readline' '--with-recommended-packages=no' '--without-libintl-prefix' 'LIBnn=lib' 'build_alias=x86_64-conda_cos6-linux-gnu' 'host_alias=x86_64-conda_cos6-linux-gnu' 'PKG_CONFIG_PATH=/miniconda3/envs/tcga/lib/pkgconfig' 'CC=x86_64-conda_cos6-linux-gnu-cc' 'CFLAGS=-march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix' 'LDFLAGS=-Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/miniconda3/envs/tcga/lib -Wl,-rpath-link,/miniconda3/envs/tcga/lib -L/miniconda3/envs/tcga/lib -Wl,-rpath-link,/miniconda3/envs/tcga/lib' 'CPPFLAGS=-DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /miniconda3/envs/tcga/include -I/miniconda3/envs/tcga/include -Wl,-rpath-link,/miniconda3/envs/tcga/lib' 'CPP=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/_build_env/bin/x86_64-conda_cos6-linux-gnu-cpp' 'FC=x86_64-conda_cos6-linux-gnu-gfortran' 'CXX=x86_64-conda_cos6-linux-gnu-c++' 'CXXFLAGS=-fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix' 'OBJC=x86_64-conda_cos6-linux-gnu-cc'
    
    ## This fails if it contains spaces, or if it is quoted
    include $(R_SHARE_DIR)/make/vars.mk
    
    AR = x86_64-conda_cos6-linux-gnu-ar
    BLAS_LIBS = -lblas
    C_VISIBILITY = -fvisibility=hidden
    CC = x86_64-conda_cos6-linux-gnu-cc
    CFLAGS = -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    CPICFLAGS = -fpic
    CPPFLAGS = -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /miniconda3/envs/tcga/include -I/miniconda3/envs/tcga/include -Wl,-rpath-link,/miniconda3/envs/tcga/lib
    CXX = x86_64-conda_cos6-linux-gnu-c++ -std=gnu++11
    ## Not used by anything in R, in particular not for the .cc.d rule
    ## but used via R CMD config by several packages
    CXXCPP = $(CXX) -E
    CXXFLAGS = -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    CXXPICFLAGS = -fpic
    CXX11 = x86_64-conda_cos6-linux-gnu-c++
    CXX11FLAGS = -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    CXX11PICFLAGS = -fpic
    CXX11STD = -std=gnu++11
    CXX14 = x86_64-conda_cos6-linux-gnu-c++
    CXX14FLAGS = -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    CXX14PICFLAGS = -fpic
    CXX14STD = -std=gnu++14
    CXX17 = x86_64-conda_cos6-linux-gnu-c++
    CXX17FLAGS = -fvisibility-inlines-hidden  -fmessage-length=0 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    CXX17PICFLAGS = -fpic
    CXX17STD = -std=gnu++17
    CXX20 =
    CXX20FLAGS =  $(LTO)
    CXX20PICFLAGS =
    CXX20STD =
    CXX_VISIBILITY = -fvisibility=hidden
    DYLIB_EXT = .so
    DYLIB_LD = $(CC)
    DYLIB_LDFLAGS = -shared -fopenmp# $(CFLAGS) $(CPICFLAGS)
    DYLIB_LINK = $(DYLIB_LD) $(DYLIB_LDFLAGS) $(LDFLAGS)
    ECHO = echo
    ECHO_C =
    ECHO_N = -n
    ECHO_T =
    F_VISIBILITY = -fvisibility=hidden
    ## FC is the compiler used for all Fortran as from R 3.6.0
    FC = x86_64-conda_cos6-linux-gnu-gfortran
    FCFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    ## additional libs needed when linking with $(FC), e.g. on some Oracle compilers
    FCLIBS_XTRA =
    FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix $(LTO)
    FLIBS =  -lgfortran -lm -lgomp -lquadmath -lpthread
    FPICFLAGS = -fpic
    FOUNDATION_CPPFLAGS =
    FOUNDATION_LIBS =
    JAR = /usr/bin/jar
    JAVA = /usr/bin/java
    JAVAC = /usr/bin/javac
    JAVAH = /usr/bin/javah
    ## JAVA_HOME might be used in the next three.
    ## They are for packages 'JavaGD' and 'rJava'
    JAVA_HOME = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-7.b13.el7.x86_64/jre
    JAVA_CPPFLAGS = -I$(JAVA_HOME)/../include -I$(JAVA_HOME)/../include/linux
    JAVA_LIBS = -L$(JAVA_HOME)/lib/amd64/server -ljvm
    JAVA_LD_LIBRARY_PATH = $(JAVA_HOME)/lib/amd64/server
    LAPACK_LIBS = -llapack
    LDFLAGS = -Wl,-O2 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,--disable-new-dtags -Wl,--gc-sections -Wl,-rpath,/miniconda3/envs/tcga/lib -Wl,-rpath-link,/miniconda3/envs/tcga/lib -L/miniconda3/envs/tcga/lib -Wl,-rpath-link,/miniconda3/envs/tcga/lib
    ## we only need this is if it is external, as otherwise link to R
    LIBINTL=
    LIBM = -lm
    LIBR0 = -L"$(R_HOME)/lib$(R_ARCH)"
    LIBR1 = -lR
    LIBR = -L"$(R_HOME)/lib$(R_ARCH)" -lR
    LIBS = -L/miniconda3/envs/tcga/lib -lpcre2-8 -llzma -lbz2 -lz -lrt -ldl -lm -liconv -licuuc -licui18n
    ## needed by R CMD config
    LIBnn = lib
    LIBTOOL = $(SHELL) "$(R_HOME)/bin/libtool"
    LTO =
    ## needed to build applications linking to static libR
    MAIN_LD = $(CC)
    MAIN_LDFLAGS = -Wl,--export-dynamic -fopenmp
    RPATH_LDFLAGS = -Wl,-rpath,$(abs_top_builddir)/lib -Wl,-rpath,/miniconda3/envs/tcga/lib
    MAIN_LINK = $(MAIN_LD) $(MAIN_LDFLAGS) $(LDFLAGS) $(RPATH_LDFLAGS)
    MKINSTALLDIRS = "$(R_HOME)/bin/mkinstalldirs"
    OBJC = x86_64-conda_cos6-linux-gnu-cc
    OBJCFLAGS = -g -O2 -fobjc-exceptions $(LTO)
    OBJC_LIBS =
    OBJCXX =
    R_ARCH =
    RANLIB = x86_64-conda_cos6-linux-gnu-ranlib
    SAFE_FFLAGS = -fopenmp -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /miniconda3/envs/tcga/include -fdebug-prefix-map=/home/conda/feedstock_root/build_artifacts/r-base_1595316670215/work=/usr/local/src/conda/r-base-4.0.2 -fdebug-prefix-map=/miniconda3/envs/tcga=/usr/local/src/conda-prefix -msse2 -mfpmath=sse
    SED = /miniconda3/envs/tcga/bin/sed
    SHELL = /bin/sh
    SHLIB_CFLAGS =
    SHLIB_CXXFLAGS =
    SHLIB_CXXLD = $(CXX)
    SHLIB_CXXLDFLAGS = -shared
    SHLIB_CXX11LD = $(CXX11) $(CXX11STD)
    SHLIB_CXX11LDFLAGS = -shared
    SHLIB_CXX14LD = $(CXX14) $(CXX14STD)
    SHLIB_CXX14LDFLAGS = -shared
    SHLIB_CXX17LD = $(CXX17) $(CXX17STD)
    SHLIB_CXX17LDFLAGS = -shared
    SHLIB_CXX20LD = $(CXX20) $(CXX20STD)
    SHLIB_CXX20LDFLAGS = -shared
    SHLIB_EXT = .so
    SHLIB_FFLAGS =
    SHLIB_LD = $(CC)
    SHLIB_LDFLAGS = -shared# $(CFLAGS) $(CPICFLAGS)
    SHLIB_LIBADD =
    ## We want to ensure libR is picked up from $(R_HOME)/lib
    ## before e.g. /usr/local/lib if a version is already installed.
    SHLIB_LINK = $(SHLIB_LD) $(SHLIB_LDFLAGS) $(LIBR0) $(LDFLAGS)
    SHLIB_OPENMP_CFLAGS = -fopenmp
    SHLIB_OPENMP_CXXFLAGS = -fopenmp
    SHLIB_OPENMP_FFLAGS =
    STRIP_STATIC_LIB = x86_64-conda_cos6-linux-gnu-strip --strip-debug
    STRIP_SHARED_LIB = x86_64-conda_cos6-linux-gnu-strip --strip-unneeded
    TCLTK_CPPFLAGS = -I/miniconda3/envs/tcga/include -I/miniconda3/envs/tcga/include
    TCLTK_LIBS = -L/miniconda3/envs/tcga/lib -ltcl8.6 -L/miniconda3/envs/tcga/lib -ltk8.6 -lX11
    YACC = yacc
    
    ## Legacy settings: these might be used in a src/Makefile
    SHLIB_FCLD = $(FC)
    SHLIB_FCLDFLAGS = -shared
    
    
    ## for linking to libR.a
    STATIC_LIBR = # -Wl,--whole-archive "$(R_HOME)/lib$(R_ARCH)/libR.a" -Wl,--no-whole-archive $(BLAS_LIBS) $(FLIBS)  $(LIBINTL) -lreadline  $(LIBS)
    
    ## These are recorded as macros for legacy use in packages
    ## set on AIX, formerly for old glibc (-D__NO_MATH_INLINES)
    R_XTRA_CFLAGS =
    ##  was formerly set on HP-UX
    R_XTRA_CPPFLAGS =  -I"$(R_INCLUDE_DIR)" -DNDEBUG
    ## currently unset
    R_XTRA_CXXFLAGS =
    ## used for gfortran in R > 3.6.0
    R_XTRA_FFLAGS = -fno-optimize-sibling-calls
    
    ## CXX98 is no longer supported, but packages may use it.
    SHLIB_CXX98LD = @SHLIB_CXX98LD@
    SHLIB_CXX98LDFLAGS = @SHLIB_CXX98LDFLAGS@
    
    ## SHLIB_CFLAGS SHLIB_CXXFLAGS SHLIB_FFLAGS are apparently currently unused
    ## SHLIB_CXXFLAGS is undocumented, there is no SHLIB_FCFLAGS
    ALL_CFLAGS =  $(PKG_CFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(CFLAGS)
    ALL_CPPFLAGS =  -I"$(R_INCLUDE_DIR)" -DNDEBUG $(PKG_CPPFLAGS) $(CLINK_CPPFLAGS) $(CPPFLAGS)
    ALL_CXXFLAGS =  $(PKG_CXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(CXXFLAGS)
    ALL_OBJCFLAGS = $(PKG_OBJCFLAGS) $(CPICFLAGS) $(SHLIB_CFLAGS) $(OBJCFLAGS)
    ALL_OBJCXXFLAGS = $(PKG_OBJCXXFLAGS) $(CXXPICFLAGS) $(SHLIB_CXXFLAGS) $(OBJCXXFLAGS)
    ALL_FFLAGS = -fno-optimize-sibling-calls $(PKG_FFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FFLAGS)
    ## can be overridden by R CMD SHLIB
    P_FCFLAGS = $(PKG_FFLAGS)
    ALL_FCFLAGS = -fno-optimize-sibling-calls $(P_FCFLAGS) $(FPICFLAGS) $(SHLIB_FFLAGS) $(FCFLAGS)
    ## LIBR here as a couple of packages use this without SHLIB_LINK
    ALL_LIBS = $(PKG_LIBS) $(SHLIB_LIBADD) $(LIBR)# $(LIBINTL)
    
    .SUFFIXES:
    .SUFFIXES: .c .cc .cpp .d .f .f90 .f95 .m .mm .M .o
    
    .c.o:
            $(CC) $(ALL_CPPFLAGS) $(ALL_CFLAGS) -c $< -o $@
    .c.d:
            @echo "making $@ from $<"
            @$(CC) -MM $(ALL_CPPFLAGS) $< > $@
    .cc.o:
            $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
    .cpp.o:
            $(CXX) $(ALL_CPPFLAGS) $(ALL_CXXFLAGS) -c $< -o $@
    .cc.d:
            @echo "making $@ from $<"
            @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
    .cpp.d:
            @echo "making $@ from $<"
            @$(CXX) -M $(ALL_CPPFLAGS) $< > $@
    .m.o:
            $(OBJC) $(ALL_CPPFLAGS) $(ALL_OBJCFLAGS) -c $< -o $@
    .m.d:
            @echo "making $@ from $<"
            @$(OBJC) -MM $(ALL_CPPFLAGS) $< > $@
    .mm.o:
            $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
    .M.o:
            $(OBJCXX) $(ALL_CPPFLAGS) $(ALL_OBJCXXFLAGS) -c $< -o $@
    .f.o:
            $(FC) $(ALL_FFLAGS) -c $< -o $@
    ## @FCFLAGS_f9x@ are flags needed to recognise the extensions
    .f95.o:
            $(FC) $(ALL_FCFLAGS) -c  $< -o $@
    .f90.o:
            $(FC) $(ALL_FCFLAGS) -c  $< -o $@
    
    
    
    • Makeconf 为什么会变成空的
     R CMD javareconf --help
    
    Usage: R CMD javareconf [options]
    
    Detect current Java setup and update the corresponding configuration in R.
    
    Options:
      -h, --help     print this help message and exit
      -v, --version  print version info and exit
      -n, --dry-run  perform Java detection, but don't touch any
                     configuration files
      -e <prog>      same as -n but exports all detected variables
                     and runs <prog>. If -e is the last argument
                     or <prog> is '' then a shell is used instead
      xxx=yyy        evaluate the corresponding expression
                     (e.g. JAVA_HOME=/usr/lib/java)
    
    Environment variables that can be used to influence the detection:
      JAVA           path to a Java interpreter executable
                     By default first 'java' command found on the PATH
                     is taken (unless JAVA_HOME is also specified).
      JAVA_HOME      home of the Java environment. If not specified,
                     it will be detected automatically from the Java
                     interpreter.
      JAVAC          path to a Java compiler
      JAVAH          path to a Java header/stub generator
      JAR            path to a Java archive tool
    Values specified when R was configured will be used unless overridden.
    
    The following variables should be used with extreme caution. They
    must all match, so use only if you have a very special setup that
    javareconf cannot detect automatically:
      JAVA_LD_LIBRARY_PATH library path necessary at run-time
      JAVA_CPPFLAGS  C preprocessor flags necessary to compile JNI programs
      JAVA_LIBS      libraries (as linker flags) necessary to compile
                     JNI programs
    
    Report bugs at <https://bugs.R-project.org>.
    
    

    https://www.yuque.com/dream-north/r_statistics/is4tsa?language=en-us
    https://stackoverflow.com/questions/53813323/installing-r-packages-in-macos-mojave-error-in-if-nzcharshlib-libadd
    https://rdrr.io/cran/rstan/man/makeconf_path.html
    https://cran.r-project.org/doc/manuals/r-patched/R-admin.html
    https://stackoverflow.com/questions/22452826/customize-package-compilation-option-r

    相关文章

      网友评论

          本文标题:R包安装报错:nzchar(SHLIB_LIBADD)

          本文链接:https://www.haomeiwen.com/subject/ocoipktx.html