centos6u3安装stringi时遇到的问题及解决

stringi是许多包的依赖包所以在安装其他报之前都要安装stringi,如果他安装有问题,像ggplot2这种包也无法安装使用。我就是因为安装ggplot2失败之后才不得已手工安装stringi的。

本文所安装的平台为centos 6u3, gcc版本为4.4.6 20120305 (Red Hat 4.4.6-4).
使用的stringi版本为:stringi_1.0-1
如果其他版本安装不上的同学可以下载该版本的包如法修改。

刚刚在R-3.4.1版本上测试安装成功。

首先在R的命令行中使用:

install.packages("stringi")

进行安装时报告:

……
configure: error: C compiler cannot create executables
See `config.log’ for more details
ERROR: configuration failed for package ‘stringi’
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/stringi’
……

但是没有找到安装stringi时的config.log,于是只能选择源码安装。

  1. CRAN上下载stringi的源码”stringi_xxx.tar.gz”,本文涉及的是stringi_1.0-1.tar.gz
  2. 然后解压tar -zxvf stringi_xxx.tar.gz
  3. 进入解压后的文件夹”stringi”
  4. 运行./configure --prefix=YOUR_PATH_TO_INSTALL

config.log 显示如下信息:

……
stringi checking whether the C compiler works… no
……
error trying to exec ‘cc1’: execvp: No such file or directory
……
error trying to exec ‘cc1obj’: execvp: No such file or directory
……
C compiler cannot create executables

发现是没有安装objectC的环境:

yum -y install gcc-objc gcc-objc++ libobjc

安装完成后再次运行./configure的时候报错就完全改变了,这里贴个完整的config.log

This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by stringi configure 0.5, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ./configure 

## --------- ##
## Platform. ##
## --------- ##

hostname = *******************************
uname -m = x86_64
uname -r = 2.6.32_1-17-0-0
uname -s = Linux
uname -v = #1 SMP Mon Aug 24 11:14:27 CST 2015

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = x86_64
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /usr/lib64/qt-3.3/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /sbin
PATH: /bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /opt/bin
PATH: /home/opt/bin
PATH: /opt/bin
PATH: /home/opt/bin
PATH: /opt/scala-2.11.7/bin
PATH: /root/bin


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2263: checking for local ICUDT_DIR
configure:2269: result: icu55/data
configure:2274: checking for R_HOME
configure:2285: result: /opt/R-3.2.4
configure:2291: checking for R
configure:2301: result: /opt/R-3.2.4/bin/R
configure:2304: checking for R >= 3.1.0
configure:2308: result: yes
configure:2324: checking for cat
configure:2342: found /bin/cat
configure:2354: result: /bin/cat
configure:2462: checking for gcc
configure:2489: result: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99
configure:2718: checking for C compiler version
configure:2727: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99 --version >&5
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
/usr/bin/make64: invalid option -- '='
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'u'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- '9'
Usage: make64 [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
... rest of stderr output deleted ...
configure:2738: $? = 2
configure:2727: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99 -v >&5
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
/usr/bin/make64: invalid option -- '='
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'u'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- '9'
Usage: make64 [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
... rest of stderr output deleted ...
configure:2738: $? = 2
configure:2727: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99 -V >&5
/usr/bin/make64: invalid option -- '='
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'u'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- 'V'
Usage: make64 [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
... rest of stderr output deleted ...
configure:2738: $? = 2
configure:2727: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99 -qversion >&5
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-redhat-linux-gnu
/usr/bin/make64: invalid option -- '='
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'u'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- '9'
Usage: make64 [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
... rest of stderr output deleted ...
configure:2738: $? = 2
configure:2758: checking whether the C compiler works
configure:2780: /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
gcc -std=gnu99 /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CFLAGS
-g -O2  /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CPPFLAGS
-I/usr/local/include  -UDEBUG -DNDEBUG   conftest.c   >&5
/usr/bin/make64: invalid option -- '='
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'u'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- '9'
/usr/bin/make64: invalid option -- 'g'
/usr/bin/make64: invalid option -- 'O'
/usr/bin/make64: invalid option -- '2'
/usr/bin/make64: invalid option -- 'U'
/usr/bin/make64: invalid option -- 'D'
/usr/bin/make64: invalid option -- 'E'
/usr/bin/make64: invalid option -- 'U'
/usr/bin/make64: invalid option -- 'G'
/usr/bin/make64: invalid option -- 'D'
/usr/bin/make64: invalid option -- 'N'
/usr/bin/make64: invalid option -- 'D'
/usr/bin/make64: invalid option -- 'E'
/usr/bin/make64: invalid option -- 'U'
/usr/bin/make64: invalid option -- 'G'
Usage: make64 [options] [target] ...
Options:
  -b, -m                      Ignored for compatibility.
  -B, --always-make           Unconditionally make all targets.
  -C DIRECTORY, --directory=DIRECTORY
                              Change to DIRECTORY before doing anything.
  -d                          Print lots of debugging information.
  --debug[=FLAGS]             Print various types of debugging information.
  -e, --environment-overrides
                              Environment variables override makefiles.
  -f FILE, --file=FILE, --makefile=FILE
                              Read FILE as a makefile.
  -h, --help                  Print this message and exit.
  -i, --ignore-errors         Ignore errors from commands.
  -I DIRECTORY, --include-dir=DIRECTORY
                              Search DIRECTORY for included makefiles.
  -j [N], --jobs[=N]          Allow N jobs at once; infinite jobs with no arg.
  -k, --keep-going            Keep going when some targets can't be made.
  -l [N], --load-average[=N], --max-load[=N]
                              Don't start multiple jobs unless load is below N.
  -L, --check-symlink-times   Use the latest mtime between symlinks and target.
  -n, --just-print, --dry-run, --recon
                              Don't actually run any commands; just print them.
  -o FILE, --old-file=FILE, --assume-old=FILE
                              Consider FILE to be very old and don't remake it.
  -p, --print-data-base       Print make's internal database.
  -q, --question              Run no commands; exit status says if up to date.
  -r, --no-builtin-rules      Disable the built-in implicit rules.
  -R, --no-builtin-variables  Disable the built-in variable settings.
  -s, --silent, --quiet       Don't echo commands.
  -S, --no-keep-going, --stop
                              Turns off -k.
  -t, --touch                 Touch targets instead of remaking them.
  -v, --version               Print the version number of make and exit.
  -w, --print-directory       Print the current directory.
  --no-print-directory        Turn off -w, even if it was turned on implicitly.
  -W FILE, --what-if=FILE, --new-file=FILE, --assume-new=FILE
                              Consider FILE to be infinitely new.
  --warn-undefined-variables  Warn when an undefined variable is referenced.

This program built for x86_64-redhat-linux-gnu
Report bugs to <bug-make@gnu.org>
configure:2784: $? = 2
configure:2822: result: no
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "stringi"
| #define PACKAGE_TARNAME "stringi"
| #define PACKAGE_VERSION "0.5"
| #define PACKAGE_STRING "stringi 0.5"
| #define PACKAGE_BUGREPORT "stringi@rexamine.com"
| #define PACKAGE_URL ""
| /* end confdefs.h.  */
| 
| int
| main ()
| {
| 
|   ;
|   return 0;
| }
configure:2827: error: in `/opt/R-3.2.4/library/stringi':
configure:2829: error: C compiler cannot create executables
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

configure:2829: WARNING: cache variable ac_cv_prog_ac_ct_CC contains a newline
ac_cv_env_CAT_set=
ac_cv_env_CAT_value=
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_ICUDT_DIR_set=
ac_cv_env_ICUDT_DIR_value=
ac_cv_env_LDFLAGS_set=
ac_cv_env_LDFLAGS_value=
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_PKG_CONFIG_PATH_set=
ac_cv_env_PKG_CONFIG_PATH_value=
ac_cv_env_R_HOME_set=
ac_cv_env_R_HOME_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_path_CAT=/bin/cat

## ----------------- ##
## Output variables. ##
## ----------------- ##

-I/usr/local/include  -UDEBUG -DNDEBUG'
-g -O2 '
-g -O2 '
-std=c++0x'
CAT='/bin/cat'
CC='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
CFLAGS='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CFLAGS
CPP='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CXXCPP
CPPFLAGS='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CPPFLAGS
CXX='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CXX1X
CXXCPP=''
CXXFLAGS='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CXX1XFLAGS
DEFS=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
EXEEXT=''
GREP=''
ICUDT_DIR='icu55/data'
ICU_FOUND=''
LDFLAGS=' '
LIBOBJS=''
LIBS=' '
LTLIBOBJS=''
OBJEXT=''
PACKAGE_BUGREPORT='stringi@rexamine.com'
PACKAGE_NAME='stringi'
PACKAGE_STRING='stringi 0.5'
PACKAGE_TARNAME='stringi'
PACKAGE_URL=''
PACKAGE_VERSION='0.5'
PATH_SEPARATOR=':'
PKG_CONFIG=''
PKG_CONFIG_PATH=''
R_HOME='/opt/R-3.2.4'
SHELL='/bin/sh'
STRINGI_CFLAGS=''
STRINGI_CPPFLAGS=''
STRINGI_CXXFLAGS=''
STRINGI_CXXSTD='CXX_STD=CXX11'
STRINGI_ICU_COMMON_SOURCES_C=''
STRINGI_ICU_COMMON_SOURCES_CPP=''
STRINGI_ICU_I18N_SOURCES_C=''
STRINGI_ICU_I18N_SOURCES_CPP=''
STRINGI_ICU_STUBDATA_SOURCES_C=''
STRINGI_ICU_STUBDATA_SOURCES_CPP=''
STRINGI_LDFLAGS=''
STRINGI_LIBS=''
STRINGI_OBJECTS=''
STRINGI_SOURCES_CPP=''
ac_ct_CC='/usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CC
ac_ct_CXX=''
bindir='${exec_prefix}/bin'
build_alias=''
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
g++ -E'
g++ /usr/bin/make64 MAC=64 -s -f /opt/R-3.2.4/etc/Makeconf -f /opt/R-3.2.4/share/make/config.mk print R_HOME=/opt/R-3.2.4 VAR=CXX1XSTD
gcc -std=gnu99'
gcc -std=gnu99'
host_alias=''
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='${exec_prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='NONE'
program_transform_name='s,x,x,'
psdir='${docdir}'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "stringi"
#define PACKAGE_TARNAME "stringi"
#define PACKAGE_VERSION "0.5"
#define PACKAGE_STRING "stringi 0.5"
#define PACKAGE_BUGREPORT "stringi@rexamine.com"
#define PACKAGE_URL ""

configure: exit 77

看到很多命令像是没有识别。这个问题解决的过程不顺利,在偶然中发现下面这篇类似的文档,提到将C/C++相关的配置做一点点修改。参考cnblog的修改方式开始对configure文件做修改。
打开configure文件的2384-2402行,添加eval,修改如下:

CC=eval `"${R_HOME}/bin/R" CMD config CC`
CPP=eval `"${R_HOME}/bin/R" CMD config CPP`
LD=eval `"${R_HOME}/bin/R" CMD config SHLIB_CXXLD`
CFLAGS=eval `"${R_HOME}/bin/R" CMD config CFLAGS`
CPPFLAGS=eval `"${R_HOME}/bin/R" CMD config CPPFLAGS`
CXX=eval `"${R_HOME}/bin/R" CMD config CXX`
CXXFLAGS=eval `"${R_HOME}/bin/R" CMD config CXXFLAGS`
LIBS=
LDFLAGS=

if test "x$enable_cxx11" == "xyes"; then
   CXX=eval "`\"${R_PATH}\" CMD config CXX1X` `\"${R_PATH}\" CMD config CXX1XSTD`"
   CXXFLAGS=eval `"${R_PATH}" CMD config CXX1XFLAGS`
   STRINGI_CXXSTD="CXX_STD=CXX11"
else
   CXX=eval `"${R_PATH}" CMD config CXX`
   CXXFLAGS=eval `"${R_PATH}" CMD config CXXFLAGS`
   STRINGI_CXXSTD=""
fi

再次运行./configure的时候一切顺利通过。

之后,在R中使用instal.packages进行源码安装

install.packages("YOUR_PATH_TO_stringi/stringi", 
                 repos = NULL,
                 type = "source"
)

安装结束后,使用library或者require载入stringi, 没有错误, 表明安装成功.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值