スーパーユーザ権限のないサーバにソースコードからインストールしてみたのでそのメモ
大学のサーバなど勝手になんでもインストールできない環境ではローカルのユーザ環境に色々とインストールしないといけません。今回はRをインストールしてみました
Rの取得
cranからRのソースコードをダウンロードしコンパイルします
1 2 3 4 5 6 | wget https://cran.r-project.org/src/base/R-3/R-3.3.2.tar.gz tar zxvfp R-3.3.2.tar.gz cd R-3.3.2 mkdir builddir cd builddir ../configure --prefix=/work/$USER/local --with-cairo --with-jpeglib --with-readline --with-tcltk --with-blas --with-lapack --enable-R-profiling --enable-R-shlib --enable-memory-profiling |
エラーになります
1 2 | checking if bzip2 version >= 1.0.6... no checking whether bzip2 support suffices... configure: error: bzip2 library and headers are required |
足りないライブラリを入れていきます
bzip2
。
1 2 3 | wget http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz tar zxvfp bzip2-1.0.6.tar.gz cd bzip2-1.0.6 |
このあたりを参考にMakefileを修正しておきます。CFLAGSに-fPICを追加します
1 | CFLAGS=-fPIC -Wall -Winline -O2 -g $(BIGFILES) |
makeします
1 2 3 4 5 | make -f Makefile-libbz2_so make clean make make -n install PREFIX=/work/$USER/local make install PREFIX=/work/$USER/local |
Rのconfigを再開します。この際、オプションにライブラリのパスを入れます
1 | ../configure --prefix=/work/$USER/local --with-cairo --with-jpeglib --with-readline --with-tcltk --with-blas --with-lapack --enable-R-profiling --enable-R-shlib --enable-memory-profiling CPPFLAGS="-I/work/$USER/local/include" LDFLAGS="-L/work/$USER/local/lib" |
またエラーです
1 2 | checking for lzma_version_number in -llzma... no configure: error: "liblzma library and headers are required" |
xz
xzライブラリを入れます。
1 2 3 4 5 | wget http://tukaani.org/xz/xz-5.2.3.tar.gz tar zxvfp xz-5.2.3.tar.gz cd xz-5.2.3 ./configure --prefix=/work/$USER/local make install |
Rのconfigを再開
1 | ../configure --prefix=/work/$USER/local --with-cairo --with-jpeglib --with-readline --with-tcltk --with-blas --with-lapack --enable-R-profiling --enable-R-shlib --enable-memory-profiling CPPFLAGS="-I/work/$USER/local/include" LDFLAGS="-L/work/$USER/local/lib" |
またエラー
1 2 | checking for pcre_fullinfo in -lpcre... no checking whether PCRE support suffices... configure: error: pcre >= 8.10 library |
pcre
pcreライブラリを入れる。ここで、UTF8を有効にしておきます
1 2 3 4 5 | wget https://ftp.pcre.org/pub/pcre/pcre-8.10.zip unzip pcre-8.10.zip cd pcre-8.10 ./configure --prefix=/work/$USER/local/ --enable-utf8 make install |
Rのconfigを再開
1 2 | checking if libcurl is version 7 and >= 7.28.0... no configure: error: libcurl >= 7.28.0 library and headers are required with support for https |
またエラーです
curl
1 2 3 4 5 6 | wget --no-check-certificate https://curl.haxx.se/download/curl-7.47.1.tar.gz tar zxvfp curl-7.47.1.tar.gz cd curl-7.47.1 ./configure --prefix=/work/$USER/local make -j3 make install |
Rのconfigを再開
1 | ../configure --prefix=/work/$USER/local --with-cairo --with-jpeglib --with-readline --with-tcltk --with-blas --with-lapack --enable-R-profiling --enable-R-shlib --enable-memory-profiling CPPFLAGS="-I/work/$USER/local/include" LDFLAGS="-L/work/$USER/local/lib" |
成功しました
コンパイル
1 | make |
またエラー。。
1 | /work/xxxxx/work/R-3.3.2/builddir/bin/exec/R: /usr/lib64/libgomp.so.1: version `GOMP_4.0' not found (required by /work/xxxxx/work/R-3.3.2/builddir/lib/libR.so) |
これは使っているGCCとそのライブラリがずれていたためでした。
LD_LIBRARY_PATHに使っているGCCのライブラリパスを前の方に追加し再度make
1 2 | make make install |
これでOKです。