| 1 |
# Installing *stringi* |
| 2 |
|
| 3 |
In most cases, installing *stringi* is as simple as calling: |
| 4 |
|
| 5 |
```r |
| 6 |
install.packages("stringi") |
| 7 |
``` |
| 8 |
|
| 9 |
However, due to the overwhelming complexity of the ICU4C library, |
| 10 |
upon which *stringi* is based, and the diversity of environments |
| 11 |
it operates on, you might still experience a few issues. |
| 12 |
Hopefully, they can be resolved with the help of this short manual. |
| 13 |
|
| 14 |
Below we also describe some available build process tweaks. |
| 15 |
|
| 16 |
|
| 17 |
> To get the most out of stringi, you are strongly encouraged to rely |
| 18 |
> on our custom ICU4C 74.1 bundle by calling: |
| 19 |
> |
| 20 |
> ```r |
| 21 |
> install.packages("stringi", configure.args="--disable-pkg-config") |
| 22 |
> ``` |
| 23 |
> |
| 24 |
> This ensures maximum portability across all platforms |
| 25 |
> (Windows and macOS users fetch the pre-compiled binaries |
| 26 |
> from CRAN built precisely this way). |
| 27 |
|
| 28 |
|
| 29 |
## ICU4C |
| 30 |
|
| 31 |
The stringi package depends on the ICU4C >= 61 library. |
| 32 |
|
| 33 |
ICU will be built together with stringi based on a customised |
| 34 |
ICU4C 74.1 source bundle that is shipped with the package |
| 35 |
if we install the package from sources and one of the following is true: |
| 36 |
|
| 37 |
* this requirement is not met (check out <https://icu.unicode.org/download>, |
| 38 |
the `libicu-devel` package on Fedora/CentOS/OpenSUSE, |
| 39 |
`libicu-dev` on Ubuntu/Debian, etc.), or |
| 40 |
|
| 41 |
* `pkg-config` fails to find appropriate build settings |
| 42 |
for ICU-based projects, or |
| 43 |
|
| 44 |
* `R CMD INSTALL` is called with the `--configure-args='--disable-pkg-config'` |
| 45 |
argument, or the `STRINGI_DISABLE_PKG_CONFIG` environment variable |
| 46 |
is set to non-zero or |
| 47 |
`install.packages("stringi", configure.args="--disable-pkg-config")` |
| 48 |
is executed. |
| 49 |
|
| 50 |
|
| 51 |
## Customising the Build Process |
| 52 |
|
| 53 |
Additional features and options of the `./configure` script: |
| 54 |
|
| 55 |
* `--disable-icu-bundle`: Enforce system ICU. |
| 56 |
|
| 57 |
* `--disable-pkg-config`: Disable `pkg-config`; |
| 58 |
ICU4C will be compiled from sources. |
| 59 |
|
| 60 |
* `--with-extra-cxxflags=FLAGS`: Additional C++ compiler flags. |
| 61 |
|
| 62 |
* `--with-extra-cppflags=FLAGS`: Additional C++ preprocessor flags. |
| 63 |
|
| 64 |
* `--with-extra-ldflags=FLAGS`: Additional linker flags. |
| 65 |
|
| 66 |
* `--with-extra-libs=FLAGS`: Additional libraries to link against. |
| 67 |
|
| 68 |
|
| 69 |
Some environment variables: |
| 70 |
|
| 71 |
* `PKG_CONFIG_PATH`: An optional list of directories to search for |
| 72 |
`pkg-config`'s `.pc` files. |
| 73 |
|
| 74 |
* `R_HOME`: Override the R directory, e.g., |
| 75 |
`/usr/lib64/R`. Note that `$R_HOME/bin/R` point to the R executable. |
| 76 |
|
| 77 |
* `CAT`: The `cat` command used to generate the list of source files to compile. |
| 78 |
|
| 79 |
* `PKG_CONFIG`:The `pkg-config` command used to fetch the necessary compiler |
| 80 |
flags to link to the existing `libicu` installation. |
| 81 |
|
| 82 |
* `STRINGI_DISABLE_PKG_CONFIG`: Compile ICU from sources; |
| 83 |
see also `--disable-pkg-config`. |
| 84 |
|
| 85 |
* `STRINGI_DISABLE_ICU_BUNDLE`: Enforce system ICU; |
| 86 |
see also `--disable-icu-bundle`. |
| 87 |
|
| 88 |
* `STRINGI_CXXFLAGS`: see `--with-extra-cxxflags`. |
| 89 |
|
| 90 |
* `STRINGI_CPPFLAGS`: see `--with-extra-cppflags`. |
| 91 |
|
| 92 |
* `STRINGI_LDFLAGS`: see `--with-extra-ldflags`. |
| 93 |
|
| 94 |
* `STRINGI_LIBS`: see `--with-extra-libs`. |
| 95 |
|
| 96 |
|
| 97 |
## Getting Help |
| 98 |
|
| 99 |
If you do not manage to set up a successful build, do not |
| 100 |
hesitate to [file a bug report](https://github.com/gagolews/stringi/issues). |
| 101 |
However, please check the list of archived (closed) issues first -- |
| 102 |
it is quite likely that a solution to your problem has already been posted. |
| 103 |
|
| 104 |
To help diagnose your error further, please run (from the terminal) |
| 105 |
the following commands and submit the output from `./configure` |
| 106 |
as well as the contents of `config.log`. |
| 107 |
|
| 108 |
```bash |
| 109 |
cd /tmp |
| 110 |
wget https://github.com/gagolews/stringi/archive/master.zip |
| 111 |
unzip master.zip |
| 112 |
cd stringi-master |
| 113 |
./configure |
| 114 |
``` |