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

6

11

We're bumbling through making some R code work in a production environment and as part of that we're installing some R packages as follows:

# 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="/" )

This might not be the most elegant way of installing R packages but it seems to work okay for us (any other tips on R package management would be welcome but a bit late at this stage :).

However, the stringi package seems to depend on the icu52l package, which it installs the over the network:

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
*

How can we tell it to look for the local copy? The output handily includes the remote location (http://static.rexamine.com/packages/icudt52l.zip) so we can just put it somewhere ourselves but are unsure where.

Maybe we're going about this completely the wrong way but any help or pointers would be welcome.

We're on ubuntu machines and have also tried install libicu42 and libicu-dev but neither of those seemed to help.

Hogen answered 18/12, 2014 at 18:38 Comment(1)
any other tips on R package management would be welcome but a bit late at this stage I have some experience deploying R code to production. To my knowledge there are a couple of tools that may help, the most promising being packrat. packrat will no doubt be very good eventually (everything RStudio does is gold), however, in the short-term I saw it necessary to create a package vepr. It makes some simplifications, but supports installing packages from CRAN, github and github enterprise. You might find it useful.Proceeds
T
8

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.

Tabriz answered 18/12, 2014 at 18:38 Comment(3)
Thanks for the insight. Unfortunately we're on a fairly old version of Ubuntu right now so I'll have to look into how feasible it is to upgrade to a newer version of that package.Hogen
Sorry, I missed the part where you've mentioned that. I've posted an update - I hope it helps.Tabriz
Thanks. This pretty much worked perfectly. I ended up removing the remote mirrors as they still seemed to be taking precedence for some reason but after that it installed the local copy. Thanks again.Hogen
Z
12

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>")
Zolazoldi answered 15/2, 2015 at 20:0 Comment(1)
Thanks! I'm not sure we will immediately upgrade but it's much appreciated all the same.Hogen
T
8

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.

Tabriz answered 18/12, 2014 at 18:38 Comment(3)
Thanks for the insight. Unfortunately we're on a fairly old version of Ubuntu right now so I'll have to look into how feasible it is to upgrade to a newer version of that package.Hogen
Sorry, I missed the part where you've mentioned that. I've posted an update - I hope it helps.Tabriz
Thanks. This pretty much worked perfectly. I ended up removing the remote mirrors as they still seemed to be taking precedence for some reason but after that it installed the local copy. Thanks again.Hogen
L
4

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.

Lysippus answered 22/5, 2015 at 0:30 Comment(0)
P
2
  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")
Plank answered 14/9, 2016 at 10:17 Comment(0)
M
0

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

Moslemism answered 29/1, 2016 at 2:59 Comment(0)
M
0

The suggestion from @gagolews almost worked for me. Here's what actually did the trick with RStudio.

  1. Download the master.zip file that will save as stringi-master.zip.
  2. Unzip the file onto your desktop. The unzipped folder should be stringi-master.
  3. Edit the .Rbuildignore file by removing ^src/icu55/data and ^src/icu61/data or similar lines.
  4. Move the folder from your desktop to the home directory of your server.
  5. Create a New Project in RStudio with ~/stringi-master as the Existing Directory
  6. From RStudio's menu, select Build and Build Source Package. (You may need to first select Configure Build Tools. For Project build tools choose Package then select OK.)
  7. It should create a tar.gz file, in the following format: stringi_x.x.(x+1).tar.gz. For example, if the current version of stringi is 1.5.3, it will create version 1.5.4. (I received a few warnings that didn't seem to affect the outcome.)
  8. Move the newly created package to your local repository. Update the repository index. And install the package.
Malacca answered 22/4, 2021 at 14:58 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.