如何从archive安装stringi库并安装本地icu52l.zip

时间:2014-12-18 18:38:25

标签: r ubuntu icu stringi

我们通过在生产环境中使一些R代码工作而感到笨拙,并且作为其中的一部分,我们按如下方式安装了一些R软件包:

# Default directories and mirrors
WORKING_DIR  <- "/srv/foo/bar/baz"

LIB_DIR      <- paste( WORKING_DIR, "libs", sep="/" )
setwd(WORKING_DIR)
stringi.loc <- paste( WORKING_DIR, "stringi_0.4-1.tar.gz", sep="/" )

这可能不是安装R软件包最优雅的方式,但它似乎对我们没用(R套餐管理的任何其他提示都会受欢迎,但在这个阶段有点迟了:)。

但是,stringi包似乎依赖于icu52l包,它通过网络安装:

checking for R... /usr/lib64/R/bin/R
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for cat... /bin/cat
checking for pkg-config... /usr/bin/pkg-config
checking with pkg-config for ICU4C installed... no
*** The pkg-config script did not detect ICU4C-devel libraries installed
*** We will build ICU4C from sources
checking how to run the C++ preprocessor... g++ -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking elf.h usability... yes
checking elf.h presence... yes
checking for elf.h... yes
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/icu52_found.txt
g++ -I/usr/share/R/include -DNDEBUG -I. -Iicu52 -Iicu52/unicode -Iicu52/common -Iicu52/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DNDEBUG     -DU_HAVE_ELF_H -fpic  -g  -c stri_brkiter.cpp -o stri_brkiter.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iicu52 -Iicu52/unicode -Iicu52/common -Iicu52/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DNDEBUG     -DU_HAVE_ELF_H -fpic  -g  -c icu52/i18n/utmscale.c -o icu52/i18n/utmscale.o
gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I. -Iicu52 -Iicu52/unicode -Iicu52/common -Iicu52/i18n -DU_STATIC_IMPLEMENTATION -DU_COMMON_IMPLEMENTATION -DU_I18N_IMPLEMENTATION -DUCONFIG_USE_LOCAL -DNDEBUG     -DU_HAVE_ELF_H -fpic  -g  -c icu52/stubdata/stubdata.c -o icu52/stubdata/stubdata.o
g++ -shared -o stringi.so stri_brkiter.o stri_collator.o stri_common.o stri_compare.o stri_container_base.o stri_container_bytesearch.o stri_container_listint.o stri_container_listraw.o stri_container_listutf8.o stri_container_regex.o stri_container_usearch.o stri_container_utf16.o stri_container_utf8.o stri_container_utf8_indexable.o stri_encoding_conversion.o stri_encoding_detection.o stri_encoding_management.o stri_escape.o stri_exception.o stri_ICU_settings.o stri_join.o stri_length.o stri_pad.o stri_prepare_arg.o stri_random.o stri_reverse.o stri_search_class_count.o stri_search_class_detect.o stri_search_class_extract.o stri_search_class_locate.o stri_search_class_replace.o stri_search_class_split.o stri_search_class_startsendswith.o stri_search_class_subset.o stri_search_class_trim.o stri_search_common.o stri_search_coll_count.o stri_search_coll_detect.o stri_search_coll_extract.o stri_search_coll_locate.o stri_search_coll_replace.o stri_search_coll_split.o stri_search_coll_startsendswith.o stri_search_coll_subset.o stri_search_boundaries_count.o stri_search_boundaries_locate.o stri_search_boundaries_split.o stri_search_fixed_count.o stri_search_fixed_detect.o stri_search_fixed_extract.o stri_search_fixed_locate.o stri_search_fixed_replace.o stri_search_fixed_split.o stri_search_fixed_subset.o stri_search_fixed_startsendswith.o stri_search_in.o stri_search_other_replace.o stri_search_other_split.o stri_search_regex_count.o stri_search_regex_detect.o stri_search_regex_extract.o stri_search_regex_locate.o stri_search_regex_match.o stri_search_regex_replace.o stri_search_regex_split.o stri_search_regex_subset.o stri_stats.o stri_stringi.o stri_sub.o stri_test.o stri_trans_casemap.o stri_trans_normalization.o stri_trans_transliterate.o stri_ucnv.o stri_uloc.o stri_utils.o stri_wrap.o icu52/common/appendable.o icu52/common/bmpset.o icu52/common/brkeng.o icu52/common/brkiter.o icu52/common/bytestream.o icu52/common/bytestrie.o icu52/common/bytestriebuilder.o icu52/common/bytestrieiterator.o icu52/common/caniter.o icu52/common/chariter.o icu52/common/charstr.o icu52/common/dictbe.o icu52/common/dictionarydata.o icu52/common/dtintrv.o icu52/common/errorcode.o icu52/common/filterednormalizer2.o icu52/common/listformatter.o icu52/common/locavailable.o icu52/common/locbased.o icu52/common/locdispnames.o icu52/common/locid.o icu52/common/loclikely.o icu52/common/locresdata.o icu52/common/locutil.o icu52/common/messagepattern.o icu52/common/normalizer2.o icu52/common/normalizer2impl.o icu52/common/normlzr.o icu52/common/parsepos.o icu52/common/patternprops.o icu52/common/propname.o icu52/common/punycode.o icu52/common/putil.o icu52/common/rbbi.o icu52/common/rbbidata.o icu52/common/rbbinode.o icu52/common/rbbirb.o icu52/common/rbbiscan.o icu52/common/rbbisetb.o icu52/common/rbbistbl.o icu52/common/rbbitblb.o icu52/common/resbund_cnv.o icu52/common/resbund.o icu52/common/ruleiter.o icu52/common/schriter.o icu52/common/serv.o icu52/common/servlk.o icu52/common/servlkf.o icu52/common/servls.o icu52/common/servnotf.o icu52/common/servrbf.o icu52/common/servslkf.o icu52/common/stringpiece.o icu52/common/stringtriebuilder.o icu52/common/ubrk.o icu52/common/ucase.o icu52/common/ucasemap_titlecase_brkiter.o icu52/common/ucasemap.o icu52/common/ucharstrie.o icu52/common/ucharstriebuilder.o icu52/common/ucharstrieiterator.o icu52/common/uchriter.o icu52/common/ucnv_bld.o icu52/common/ucnv_ext.o icu52/common/ucnv_io.o icu52/common/ucnv2022.o icu52/common/ucnvbocu.o icu52/common/ucnvsel.o icu52/common/ucol_swp.o icu52/common/udata.o icu52/common/uhash_us.o icu52/common/uidna.o icu52/common/uinit.o icu52/common/uiter.o icu52/common/uloc.o icu52/common/umutex.o icu52/common/unames.o icu52/common/unifilt.o icu52/common/unifunct.o icu52/common/uniset_closure.o icu52/common/uniset_props.o icu52/common/uniset.o icu52/common/unisetspan.o icu52/common/unistr_case_locale.o icu52/common/unistr_case.o icu52/common/unistr_cnv.o icu52/common/unistr_props.o icu52/common/unistr_titlecase_brkiter.o icu52/common/unistr.o icu52/common/unorm.o icu52/common/unormcmp.o icu52/common/uobject.o icu52/common/uprops.o icu52/common/uresbund.o icu52/common/uscript_props.o icu52/common/uset_props.o icu52/common/uset.o icu52/common/usetiter.o icu52/common/ushape.o icu52/common/usprep.o icu52/common/ustack.o icu52/common/ustr_titlecase_brkiter.o icu52/common/ustr_wcs.o icu52/common/ustrcase_locale.o icu52/common/ustrcase.o icu52/common/ustrenum.o icu52/common/ustring.o icu52/common/ustrtrns.o icu52/common/utext.o icu52/common/util_props.o icu52/common/util.o icu52/common/utrie.o icu52/common/utrie2_builder.o icu52/common/utrie2.o icu52/common/uts46.o icu52/common/uvector.o icu52/common/uvectr32.o icu52/common/uvectr64.o icu52/common/cmemory.o icu52/common/cstring.o icu52/common/cwchar.o icu52/common/icudataver.o icu52/common/icuplug.o icu52/common/locmap.o icu52/common/propsvec.o icu52/common/uarrsort.o icu52/common/ubidi_props.o icu52/common/ubidi.o icu52/common/ubidiln.o icu52/common/ubidiwrt.o icu52/common/ucat.o icu52/common/uchar.o icu52/common/ucln_cmn.o icu52/common/ucmndata.o icu52/common/ucnv_cb.o icu52/common/ucnv_cnv.o icu52/common/ucnv_ct.o icu52/common/ucnv_err.o icu52/common/ucnv_lmb.o icu52/common/ucnv_set.o icu52/common/ucnv_u16.o icu52/common/ucnv_u32.o icu52/common/ucnv_u7.o icu52/common/ucnv_u8.o icu52/common/ucnv.o icu52/common/ucnvdisp.o icu52/common/ucnvhz.o icu52/common/ucnvisci.o icu52/common/ucnvlat1.o icu52/common/ucnvmbcs.o icu52/common/ucnvscsu.o icu52/common/udatamem.o icu52/common/udataswp.o icu52/common/uenum.o icu52/common/uhash.o icu52/common/uinvchar.o icu52/common/ulist.o icu52/common/uloc_tag.o icu52/common/umapfile.o icu52/common/umath.o icu52/common/unorm_it.o icu52/common/ures_cnv.o icu52/common/uresdata.o icu52/common/usc_impl.o icu52/common/uscript.o icu52/common/ustr_cnv.o icu52/common/ustrfmt.o icu52/common/utf_impl.o icu52/common/utrace.o icu52/common/utypes.o icu52/common/wintz.o icu52/i18n/alphaindex.o icu52/i18n/anytrans.o icu52/i18n/astro.o icu52/i18n/basictz.o icu52/i18n/bocsu.o icu52/i18n/brktrans.o icu52/i18n/buddhcal.o icu52/i18n/calendar.o icu52/i18n/casetrn.o icu52/i18n/cecal.o icu52/i18n/chnsecal.o icu52/i18n/choicfmt.o icu52/i18n/coleitr.o icu52/i18n/coll.o icu52/i18n/compactdecimalformat.o icu52/i18n/coptccal.o icu52/i18n/cpdtrans.o icu52/i18n/csdetect.o icu52/i18n/csmatch.o icu52/i18n/csr2022.o icu52/i18n/csrecog.o icu52/i18n/csrmbcs.o icu52/i18n/csrsbcs.o icu52/i18n/csrucode.o icu52/i18n/csrutf8.o icu52/i18n/curramt.o icu52/i18n/currfmt.o icu52/i18n/currpinf.o icu52/i18n/currunit.o icu52/i18n/dangical.o icu52/i18n/datefmt.o icu52/i18n/dcfmtsym.o icu52/i18n/decfmtst.o icu52/i18n/decimfmt.o icu52/i18n/digitlst.o icu52/i18n/dtfmtsym.o icu52/i18n/dtitvfmt.o icu52/i18n/dtitvinf.o icu52/i18n/dtptngen.o icu52/i18n/dtrule.o icu52/i18n/esctrn.o icu52/i18n/ethpccal.o icu52/i18n/fmtable_cnv.o icu52/i18n/fmtable.o icu52/i18n/format.o icu52/i18n/fphdlimp.o icu52/i18n/fpositer.o icu52/i18n/funcrepl.o icu52/i18n/gender.o icu52/i18n/gregocal.o icu52/i18n/gregoimp.o icu52/i18n/hebrwcal.o icu52/i18n/identifier_info.o icu52/i18n/indiancal.o icu52/i18n/inputext.o icu52/i18n/islamcal.o icu52/i18n/japancal.o icu52/i18n/locdspnm.o icu52/i18n/measfmt.o icu52/i18n/measure.o icu52/i18n/msgfmt.o icu52/i18n/name2uni.o icu52/i18n/nfrs.o icu52/i18n/nfrule.o icu52/i18n/nfsubs.o icu52/i18n/nortrans.o icu52/i18n/nultrans.o icu52/i18n/numfmt.o icu52/i18n/numsys.o icu52/i18n/olsontz.o icu52/i18n/persncal.o icu52/i18n/plurfmt.o icu52/i18n/plurrule.o icu52/i18n/quant.o icu52/i18n/rbnf.o icu52/i18n/rbt_data.o icu52/i18n/rbt_pars.o icu52/i18n/rbt_rule.o icu52/i18n/rbt_set.o icu52/i18n/rbt.o icu52/i18n/rbtz.o icu52/i18n/regexcmp.o icu52/i18n/regeximp.o icu52/i18n/regexst.o icu52/i18n/regextxt.o icu52/i18n/region.o icu52/i18n/reldtfmt.o icu52/i18n/rematch.o icu52/i18n/remtrans.o icu52/i18n/repattrn.o icu52/i18n/scriptset.o icu52/i18n/search.o icu52/i18n/selfmt.o icu52/i18n/simpletz.o icu52/i18n/smpdtfmt.o icu52/i18n/smpdtfst.o icu52/i18n/sortkey.o icu52/i18n/strmatch.o icu52/i18n/strrepl.o icu52/i18n/stsearch.o icu52/i18n/taiwncal.o icu52/i18n/tblcoll.o icu52/i18n/timezone.o icu52/i18n/titletrn.o icu52/i18n/tmunit.o icu52/i18n/tmutamt.o icu52/i18n/tmutfmt.o icu52/i18n/tolowtrn.o icu52/i18n/toupptrn.o icu52/i18n/translit.o icu52/i18n/transreg.o icu52/i18n/tridpars.o icu52/i18n/tzfmt.o icu52/i18n/tzgnames.o icu52/i18n/tznames_impl.o icu52/i18n/tznames.o icu52/i18n/tzrule.o icu52/i18n/tztrans.o icu52/i18n/ucal.o icu52/i18n/ucol_bld.o icu52/i18n/ucol_cnt.o icu52/i18n/ucol_elm.o icu52/i18n/ucol_res.o icu52/i18n/ucol_sit.o icu52/i18n/ucol_tok.o icu52/i18n/ucol_wgt.o icu52/i18n/ucol.o icu52/i18n/ucoleitr.o icu52/i18n/ucsdet.o icu52/i18n/ucurr.o icu52/i18n/udat.o icu52/i18n/udateintervalformat.o icu52/i18n/udatpg.o icu52/i18n/umsg.o icu52/i18n/unesctrn.o icu52/i18n/uni2name.o icu52/i18n/unum.o icu52/i18n/unumsys.o icu52/i18n/upluralrules.o icu52/i18n/uregex.o icu52/i18n/uregexc.o icu52/i18n/uregion.o icu52/i18n/usearch.o icu52/i18n/uspoof_build.o icu52/i18n/uspoof_conf.o icu52/i18n/uspoof_impl.o icu52/i18n/uspoof_wsconf.o icu52/i18n/uspoof.o icu52/i18n/utrans.o icu52/i18n/vtzone.o icu52/i18n/vzone.o icu52/i18n/windtfmt.o icu52/i18n/winnmfmt.o icu52/i18n/wintzimpl.o icu52/i18n/zonemeta.o icu52/i18n/zrule.o icu52/i18n/ztrans.o icu52/i18n/decContext.o icu52/i18n/decNumber.o icu52/i18n/ucln_in.o icu52/i18n/ulocdata.o icu52/i18n/utmscale.o icu52/stubdata/stubdata.o -L/usr/lib64/R/lib -lR'
DBG: Stderr is '* installing *source* package ‘stringi’ ...
** package ‘stringi’ successfully unpacked and MD5 sums checked
** libs
icu52/i18n/ucol_sit.cpp: In function ‘int32_t ucol_getUnsafeSet_52(const UCollator*, USet*, UErrorCode*)’:
icu52/i18n/ucol_sit.cpp:933: warning: ‘int32_t ucol_getContractions_52(const UCollator*, USet*, UErrorCode*)’ is deprecated (declared at icu52/i18n/ucol_sit.cpp:849)
icu52/i18n/ucol_sit.cpp:933: warning: ‘int32_t ucol_getContractions_52(const UCollator*, USet*, UErrorCode*)’ is deprecated (declared at icu52/i18n/ucol_sit.cpp:849)
installing via 'install.libs.R' to /srv/adzuna/value-my-cv/career_explorer/libs/stringi
downloading ICU data library (icudt)
the files will be extracted to: /srv/adzuna/value-my-cv/career_explorer/libs/stringi/libs
no icudt in a local repo
trying URL 'http://static.rexamine.com/packages/icudt52l.zip'
Content type 'application/zip' length 10154575 bytes (9.7 Mb)
opened URL
==================================================
downloaded 9.7 Mb

icudt fetch OK
decompressing downloaded archive
icudt has been installed successfully
restart R to apply changes
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
*

我们如何告诉它寻找本地副本?输出方便地包括远程位置(http://static.rexamine.com/packages/icudt52l.zip)所以我们可以把它放在某个地方,但不确定在哪里。

也许我们完全以错误的方式解决这个问题,但欢迎任何帮助或指示。

我们在ubuntu机器上也尝试过安装libicu42和libicu-dev,但这些都没有帮助。

6 个答案:

答案 0 :(得分:10)

这将在即将推出的{1}}的0.5-1版本中修复,请参阅this feature request

stringi脚本现在使用适当的环境变量(ICUDT_DIR)来指示应从中提取./configure的本地副本的目录。例如,可以通过致电:

来提供
icudt

答案 1 :(得分:8)


注意:对于Stringi&gt; = 0.5-1,请the answer检查@gagolews


来自INSTALL file

  

stringi包依赖于ICU4C&gt; = 50库。

所以libicu42已经很久了。

如果您选中install.R file,您会找到以下行:

mirrors <- c("http://static.rexamine.com/packages/",
    "http://www.mini.pw.edu.pl/~gagolews/stringi/",
    "http://www.ibspan.waw.pl/~gagolews/stringi/")

couple of lines later你会发现这样的事情:

if (!grepl("^https?://", href)) {
    # try to copy icudt from a local repo
    if (!file.exists(href)) return("no icudt in a local repo")

如果您在mirrors的开头添加本地路径并放置下载的库,它似乎按预期工作。在这里你可以使用我使用过的补丁: https://gist.github.com/zero323/338c8fb0faf46e5ac06d

所以我的解决方案是:

  • 克隆repostiory
  • 您想要的结帐版本
  • 应用具有本地版本ICU路径的补丁
  • 从源代码安装包

可能有更好的方法,但这就是我到目前为止所做的。

答案 2 :(得分:3)

我遇到了同样的问题。我所做的与gagolews提出的解决方案类似。 Gagolews的解决方案并不适合我,因为我找不到要下载的stringi的zip副本。我将icudt从http://static.rexamine.com/packages/icudt52l.zip下载到一个文件夹,比如说/ home / tmp /然后我从网上安装,但提供了icudt的本地副本,在R中键入以下内容:

install.packages("stringi", # this will install from online
configure.vars="ICUDT_DIR=/home/tmp/") #but use the downloaded version of icudt

这对我有用。

答案 3 :(得分:2)

  1. 克隆git clone https://github.com/gagolews/stringi.git
  2. 修改.Rbuildignore文件并删除^src/icu55/data行。
  3. 运行R CMD build stringi_dir_name以构建tar.gz文件。
  4. 在您的计算机上安装获得的.tar.gz文件,例如 通过install.packages("stringi_xxx.tar.gz")

答案 4 :(得分:0)

这与Linux Mint 17.2中的R-3.2.3一起工作。 1.安装&#39; libicu-dev&#39;来自Software Manager。 2.在R:install.packages(&#39; stringi&#39;)

有关详细信息,请尝试阅读此说明:https://cran.r-project.org/web/packages/stringi/INSTALL

答案 5 :(得分:0)

@gagolews 的建议几乎对我有用。下面是 RStudio 的实际作用。

  1. 下载the master.zip file that will save as stringi-master.zip
  2. 将文件解压缩到桌面上。解压后的文件夹应该是 stringi-master
  3. 通过删除 .Rbuildignore^src/icu55/data 或类似的行来编辑 ^src/icu61/data 文件。
  4. 将文件夹从桌面移动到服务器的主目录。
  5. 在 RStudio 中创建一个新项目,将 ~/stringi-master 作为现有目录
  6. 从 RStudio 的菜单中,选择构建构建源包。 (您可能需要先选择配置构建工具。对于项目构建工具,选择,然后选择确定。)
  7. 它应该创建一个 tar.gz 文件,格式如下:stringi_x.x.(x+1).tar.gz。例如,如果 stringi 的当前版本是 1.5.3,它将创建版本 1.5.4。 (我收到了一些似乎不会影响结果的警告。)
  8. 将新创建的包移动到本地存储库。更新存储库索引。并安装软件包。