How to install stringi library from archive and install the local icu52l.zip

帅比萌擦擦* 提交于 2019-12-01 03:09:47
zero323

Note: for Stringi >= 0.5-1 please check the answer by @gagolews


From INSTALL file:

The stringi package depends on the ICU4C >= 50 library.

So libicu42 is far to old.

If you check install.R file you'll find following lines:

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

A couple of lines later you'll find something like this:

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

If you add local path at the beginning of the mirrors and put downloaded libraries it seems to work as expected. Here you can a patch I've used: https://gist.github.com/zero323/338c8fb0faf46e5ac06d

So my solution would be to:

  • clone the repostiory
  • checkout version you want
  • apply patch with a path to the local version of the ICU
  • install package from source

There is probably a better way, but that is what I came up so far.

This will be fixed in the upcoming 0.5-1 version of stringi, see this feature request.

An appropriate environmental variable (ICUDT_DIR) is now used by the ./configure script to indicate the directory from which a local copy of icudt should be fetched. It can be provided for example via a call to:

install.packages("stringi_0.5-1.zip", # assuming that we install from a downloaded archive
    configure.vars="ICUDT_DIR=<dir_to_copy_icudt_from>")

I had the same problem. What I did is similar to the solution proposed by gagolews. Gagolews' solution didn't exactly work for me because I couldn't find a zip copy of stringi to download. I downloaded icudt from http://static.rexamine.com/packages/icudt52l.zip to a folder, say /home/tmp/ then I installed from the net, but providing the local copy of icudt, by typing the following in R:

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

This worked for me.

  1. Clone the git clone https://github.com/gagolews/stringi.git.
  2. Edit the .Rbuildignore file and get rid of the ^src/icu55/data line.
  3. Run R CMD build stringi_dir_name to build tar.gz file.
  4. Install the obtained .tar.gz file on your machine(s), e.g., via install.packages("stringi_xxx.tar.gz")

This work with R-3.2.3 in Linux Mint 17.2. 1. Install 'libicu-dev' from Software Manager. 2. in R : install.packages('stringi')

For further information, try to read this instruction: https://cran.r-project.org/web/packages/stringi/INSTALL

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!