xml2がインストールできないとき

# Rを用いてxml2をインストールするとき

```R:xmlのインストール
BiocManager::install("xml2")
```
## これを実行すると、以下のようなエラーが生じる。
```R:エラーコード
Bioconductor version 3.15 (BiocManager 1.30.18), R 4.2.1 (2022-06-23)
Installing package(s) 'xml2'
trying URL 'https://cloud.r-project.org/src/contrib/xml2_1.3.3.tar.gz'
Content type 'application/x-gzip' length 283965 bytes (277 KB)
==================================================
downloaded 277 KB

* installing *source* package ‘xml2’ ...
** package ‘xml2’ successfully unpacked and MD5 sums checked
** using staged installation
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include
Using PKG_LIBS=-L/home/username/miniconda3/lib -lxml2 -L/home/username/miniconda3/lib -lz -L/home/username/miniconda3/lib -llzma -lpthread -L/home/username/miniconda3/lib -L/home/username/miniconda3/lib -licui18n -licuuc -licudata -lm -ldl
** libs
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c connection.cpp -o connection.o
gcc -std=gnu11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include   -fpic  -g -O2  -c init.c -o init.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_doc.cpp -o xml2_doc.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_init.cpp -o xml2_init.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_namespace.cpp -o xml2_namespace.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_node.cpp -o xml2_node.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_output.cpp -o xml2_output.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_schema.cpp -o xml2_schema.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_url.cpp -o xml2_url.o
g++ -std=gnu++11 -I"/home/username/local/lib64/R/include" -DNDEBUG -I../inst/include -I/home/username/miniconda3/include/libxml2 -I/home/username/miniconda3/include -DUCHAR_TYPE=wchar_t -DU_SHOW_CPLUSPLUS_API=0  -I/home/username/local/include  -fvisibility=hidden -fpic  -g -O2  -c xml2_xpath.cpp -o xml2_xpath.o
g++ -std=gnu++11 -shared -L/home/username/local/lib64/R/lib -L/home/username/local/lib -Wl,-rpath=/home/username/local/lib -o xml2.so connection.o init.o xml2_doc.o xml2_init.o xml2_namespace.o xml2_node.o xml2_output.o xml2_schema.o xml2_url.o xml2_xpath.o -L/home/username/miniconda3/lib -lxml2 -L/home/username/miniconda3/lib -lz -L/home/username/miniconda3/lib -llzma -lpthread -L/home/username/miniconda3/lib -L/home/username/miniconda3/lib -licui18n -licuuc -licudata -lm -ldl -L/home/username/local/lib64/R/lib -lR
installing to /home/username/local/lib64/R/library/00LOCK-xml2/00new/xml2/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
Error : read_xml.Rd:58: unable to load shared object '/home/username/local/lib64/R/library/00LOCK-xml2/00new/xml2/libs/xml2.so':
  libicui18n.so.58: cannot open shared object file: No such file or directory
ERROR: installing Rd objects failed for package ‘xml2’
* removing ‘/home/username/local/lib64/R/library/xml2’

The downloaded source packages are in
        ‘/tmp/Rtmpr8Z4Aj/downloaded_packages’
Warning message:
In install.packages(...) :
  installation of package ‘xml2’ had non-zero exit status
```

## ここで、xmlが入れられないのはlibicui18n.so.58が無いから
```bash:find
find /home/username/ -name libicui18n.so.58
```
#### この作業で、libicui18n.so.58がある場所がわかる。
```bash:findの結果
/home/username/miniconda3/envs/Ragtag/lib/libicui18n.so.58
/home/username/miniconda3/envs/orp_v2/lib/libicui18n.so.58
/home/username/miniconda3/envs/orp_transabyss/lib/libicui18n.so.58
/home/username/miniconda3/lib/libicui18n.so.58　←
/home/username/miniconda3/pkgs/icu-58.2-hf484d3e_1000/lib/libicui18n.so.58
/home/username/miniconda3/pkgs/icu-58.2-he6710b0_3/lib/libicui18n.so.58
```

左矢印（←）で示した部分をPATHに指定する。
```bash:PATHの追加
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/username/miniconda3/lib/
#パス環境の読み込み
source ~/.bashrc
```

以上です