🤩

Erlang/OTP ソースコードインストールのススメ

2020/11/23に公開約2,200字

この資料は定期的に更新される

概要

Erlang/OTP を GitHub にあるソースコードからビルドして利用する方法についてまとめている。

前提

  • 株式会社時雨堂 の商用製品向けのビルド設定
  • パッケージングに利用する Erlang/OTP は OpenSSL を dynamic link しない
  • OpenSSL 最新版を自前ビルドする
  • GitHub から clone してきてビルドする

Linux

古いカーネルは利用しないほうがいい

  • 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.1.0.tar.gz
tar xvfz openssl-3.1.0.tar.gz
cd openssl-3.1.0
./config --prefix=/opt/openssl/3.1.0 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-25.3 -b OTP-25.3
cd otp-25.3
./configure --prefix=/opt/erlang/25.3 \
            --enable-kernel-poll \
            --enable-dirty-schedulers \
            --enable-jit \
            --disable-sctp \
            --disable-dynamic-ssl-lib \
            --disable-sharing-preserving \
            --with-ssl=/opt/openssl/3.1.0 \
            --without-javac \
            --without-odbc
make -j
make install

開発環境用 Erlang/OTP

curl -LO https://www.openssl.org/source/openssl-3.1.0.tar.gz
tar xvfz openssl-3.1.0.tar.gz
cd openssl-3.1.0
./config --prefix=/opt/openssl/3.1.0 no-shared no-module
make -j
make install_sw
git clone https://github.com/erlang/otp
git clone otp otp-26.0 -b OTP-26.0
cd otp-26.0
./configure --prefix=/opt/erlang/26.0 \
            --enable-kernel-poll \
            --enable-dirty-schedulers \
            --enable-jit \
            --disable-sctp \
            --disable-dynamic-ssl-lib \
            --disable-sharing-preserving \
            --with-ssl=/opt/openssl/3.1.0 \
            --without-javac \
            --with-microstate-accounting=extra \
            --without-odbc
make -j
make install

maybe 構文

利用するモジュールで以下の設定をする。

-feature(maybe_expr, enable).

Discussion

ログインするとコメントできます