Post

R source file๋กœ ์„ค์น˜ in linux

๐Ÿ‘‰ R version 4 homepage

TL;DR

1
2
3
4
5
6
7
8
9
10
11
wget https://cran.r-project.org/src/base/R-4/R-4.3.1.tar.gz

tar -xvzf R-4.3.1.tar.gz 
cd R-4.3.1

mkdir /source/R-4.3.1
./configure --prefix=/source/R-4.3.1 
make -j 10 & make install

# bashrc์— path์„ค์ • ์ถ”๊ฐ€
echo -e "PATH=/source/R-4.3.1/bin:$PATH" >> ~/.bash_profile

๊ฐ™์ด ์„ค์น˜ํ•˜๋ฉด ์ข‹์€..

1
2
3
if (!require("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
BiocManager::install(version = "3.17")

Error ๋ชจ์Œ์ง‘

PCRE2

๐Ÿšจ configure: error: PCRE2 library and headers are required, or use --with-pcre1 and PCRE >= 8.32 with UTF-8 support

๐Ÿ’ก PCRE2 ์„ค์น˜ํ•ด์ค€๋‹ค

PCRE2 homepage

https://www.linuxfromscratch.org/blfs/view/svn/general/pcre2.html

1
2
3
4
5
6
7
8
9
10
11
12
13
wget https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2
tar -xvf pcre2-10.42.tar.bz2
cd pcre2-10.42

mkdir /source/pcre2
./configure --prefix=/source/pcre2
make & make install

# bash_profile์ด๋‚˜ bashrc์— path ์žก์•„์ฃผ์ž OR R ./configureํ• ๋•Œ --with-pcre2='/source/pcre2' ์˜ต์…˜์ฃผ๊ธฐ
# CFLAGS, LDFLAGS๊ฐ€ ์ค‘์š”ํ•œ๋“ฏ
export LD_LIBRARY_PATH=/source/pcre2/lib:$LD_LIBRARY_PATH
export CFLAGS="-I/source/pcre2/include"
export LDFLAGS="-L//source/pcre2/lib" 

์ดํ›„ ์‹คํŒจํ•œ ๋ถ€๋ถ„์œผ๋กœ ๋Œ์•„๊ฐ€์„œ ๋‹ค์‹œ์‹œ๋„, R ์••์ถ•ํ’€์—ˆ๋˜ ํด๋” ์ง€์šฐ๊ณ  ์ฒ˜์Œ๋ถ€ํ„ฐ ๋‹ค์‹œ ๋Œ๋ฆฌ๋Š” ๊ฒƒ๋„ ์ถ”์ฒœ

Fortran

๐Ÿšจ configure: error: Maybe check LDFLAGS for paths to Fortran libraries?

๐Ÿ’ก gfortran ์œ„์น˜ ์žก์•„์ฃผ์ž

1
2
3
4
5
6
7
# gfortran ์œ„์น˜ ํ™•์ธ
which gfortran

> /hpc/packages/minerva-centos7/gcc/11.2.0/bin/gfortran # ๋‚œ ์ด๋Ÿฐ์‹์œผ๋กœ ๋‚˜์˜ด

# LDFLAGS ์— ์œ„์น˜ ์„ค์ • ์ถ”๊ฐ€ (์ž˜๋ณด๊ณ  ๋ณธ์ธํ™˜๊ฒฝ์— ๋งž๊ฒŒ ์ˆ˜์ •ํ•ด์„œ ๋„ฃ๊ธฐ!)
export LDFLAGS="-L/hpc/packages/minerva-centos7/gcc/11.2.0/lib64 -L/hpc/packages/minerva-centos7/gcc/11.2.0/lib  -lgfortran"

์ดํ›„ ์‹คํŒจํ•œ ๋ถ€๋ถ„์œผ๋กœ ๋Œ์•„๊ฐ€์„œ ๋‹ค์‹œ์‹œ๋„, R ์••์ถ•ํ’€์—ˆ๋˜ ํด๋” ์ง€์šฐ๊ณ  ์ฒ˜์Œ๋ถ€ํ„ฐ ๋‹ค์‹œ ๋Œ๋ฆฌ๋Š” ๊ฒƒ๋„ ์ถ”์ฒœ

C compiler

์ด๊ฑด .configure ์ดํ›„, make ์‹œ๋„ํ•˜๋ฉด์„œ ์ƒ๊ธด ์—๋Ÿฌ

configure: error: cannot run C compiled programs.

gcc ๋ถ„๋ช… ์ž˜ ์„ค์น˜ ๋ผ์žˆ๋Š”๋ฐ ์™œ ์ด๋Ÿฐ ์—๋Ÿฌ๊ฐ€ ์ƒ๊ธฐ๋Š”์ง€ ์ดํ•ดํ•  ์ˆ˜ ์—†๊ตฌ์š”. gcc ๊ฒฝ๋กœ ํ™•์ธํ•˜๊ณ  bash_profile์— ๋„ฃ์–ด์ค€๋‹ค.

1
2
export PATH=/hpc/packages/minerva-centos7/gcc/11.2.0/bin:$PATH
export LD_LIBRARY_PATH=/hpc/packages/minerva-centos7/gcc/11.2.0/lib64/:$LD_LIBRARY_PATH

R ๋‹ค์‹œ ์„ค์น˜ํ•˜๋Š”๋ฐ ๊ทธ๋ž˜๋„ ์•ˆ๋˜๋ฉด.. --host=arm ์˜ต์…˜์„ ๋„ฃ์–ด๋ณด์ž.

Reference

This post is licensed under CC BY 4.0 by the author.

ยฉ Subin Cho. Some rights reserved.

Using the Chirpy theme for Jekyll.