🤩
Erlang/OTP ソースコードインストールのススメ
この資料は定期的に更新される
概要
Erlang/OTP を GitHub にあるソースコードからビルドして利用する方法についてまとめている。
前提
- 株式会社時雨堂 の商用製品向けのビルド設定
- パッケージングに利用する Erlang/OTP は OpenSSL を dynamic link しない
- OpenSSL 最新版を自前ビルドする
- GitHub から clone してきてビルドする
Linux
古いカーネルは利用しないほうがいい
- Ubuntu 24.04 x86_64 | arm64
apt install build-essential libncurses5-dev autoconf
- Ubuntu 22.04 x86_64 | arm64
apt install build-essential libncurses5-dev autoconf
- Ubuntu 20.04 x86_64 | arm64
apt install build-essential libncurses5-dev autoconf
- Red Hat Enterprise Linux 9 x86_64
dnf install autoconf gcc glibc-devel make ncurses-devel perl
- Red Hat Enterprise Linux 8 x86_64
dnf install autoconf gcc glibc-devel make ncurses-devel perl
- RHEL8 で JIT 版をビルドするには
GCC Toolset 11 Toolchain
が必要になる。
OpenSSL
curl -LO https://www.openssl.org/source/openssl-3.2.1.tar.gz
tar xvfz openssl-3.2.1.tar.gz
cd openssl-3.2.1
./Configure --prefix=/opt/openssl/3.2.1 no-shared no-module
make -j
make install_sw
Erlang/OTP
git clone した otp は pull 専用にしてビルドするのは別リポジトリにする
git clone https://github.com/erlang/otp
git clone otp otp-26.2.3 -b OTP-26.2.3
cd otp-26.2.3
./configure --prefix=/opt/erlang/26.2.3 \
--enable-kernel-poll \
--enable-dirty-schedulers \
--enable-jit \
--disable-sctp \
--disable-dynamic-ssl-lib \
--disable-sharing-preserving \
--with-ssl=/opt/openssl/3.2.1 \
--without-javac \
--without-odbc
make -j
make install
開発環境用 Erlang/OTP
- Erlang/OTP 最新版を積極的に利用
- OpenSSL 開発版を積極的に利用
- microstate-accounting を有効化
curl -LO https://www.openssl.org/source/openssl-3.2.1.tar.gz
tar xvfz openssl-3.2.1.tar.gz
cd openssl-3.2.1
./Configure --prefix=/opt/openssl/3.2.1 no-shared no-module
make -j
make install_sw
git clone https://github.com/erlang/otp
git clone otp otp-27.0-rc2 -b OTP-27.0-rc2
cd otp-27.0-rc2
./configure --prefix=/opt/erlang/27.0-rc2 \
--enable-kernel-poll \
--enable-dirty-schedulers \
--enable-jit \
--disable-sctp \
--disable-dynamic-ssl-lib \
--disable-sharing-preserving \
--with-ssl=/opt/openssl/3.2.1 \
--without-javac \
--with-microstate-accounting=extra \
--without-odbc
make -j
make install
maybe 構文
- rebar の設定に maybe_expr 利用する設定を入れる
- Erlang/OTP 27.0 からは rebar の設定は不要
rebar.config
{erl_opts, [{feature, maybe_expr, enable}]}.
Discussion