Skip to content

Instantly share code, notes, and snippets.

@voluntas
Last active February 12, 2026 02:44
Show Gist options
  • Select an option

  • Save voluntas/303d0ca6cfe3869497a8da37f143f946 to your computer and use it in GitHub Desktop.

Select an option

Save voluntas/303d0ca6cfe3869497a8da37f143f946 to your computer and use it in GitHub Desktop.
Erlang/OTP ソースコードインストール

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

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

概要

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

前提

  • 株式会社時雨堂 の商用製品向けのビルド設定
  • パッケージングに利用する Erlang/OTP は OpenSSL / AWS-LC を dynamic link しない
  • OpenSSL / AWS-LC 最新版を自前ビルドする
  • 利用していないモジュールはビルドしない
    • jinterface
    • odbc
    • wx
    • debugger
    • observer
    • et
    • tftp
    • ftp
    • megaco
    • eldap
    • diameter
    • jinterface
    • mnesia
    • snmp
    • ssh
    • erl_docgen
    • mnesia
  • 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
  • Red Hat Enterprise Linux 10 x86_64
    • dnf install autoconf gcc glibc-devel make ncurses-devel perl
  • Red Hat Enterprise Linux 9 x86_64
    • dnf install autoconf gcc glibc-devel make ncurses-devel perl

OpenSSL

curl -LO https://github.com/openssl/openssl/releases/download/openssl-3.6.1/openssl-3.6.1.tar.gz
tar xvfz openssl-3.6.1.tar.gz
cd openssl-3.6.1
./Configure --prefix=/opt/openssl/3.6.1 no-shared no-module
make -j$(nproc)
make install_sw

Erlang/OTP

git clone した otp は pull 専用にしてビルドするのは別リポジトリにする

git clone https://github.com/erlang/otp
git clone otp otp-28.3 -b OTP-28.3
cd otp-28.3
./configure --prefix=/opt/erlang/28.3 \
            --enable-kernel-poll \
            --enable-dirty-schedulers \
            --enable-jit \
            --disable-sctp \
            --disable-dynamic-ssl-lib \
            --disable-sharing-preserving \
            --with-ssl=/opt/openssl/3.6.1 \
            --without-javac \
            --without-odbc \
            --without-wx \
            --without-debugger \
            --without-observer \
            --without-crashdump_viewer \
            --without-et \
            --without-tftp \
            --without-ftp \
            --without-megaco \
            --without-eldap \
            --without-diameter \
            --without-jinterface \
            --without-snmp \
            --without-ssh \
            --without-erl_docgen \
            --without-mnesia
make -j$(nproc)
make install

開発環境用 Erlang/OTP

  • Erlang/OTP 最新版を積極的に利用
  • microstate-accounting を有効化
git clone https://github.com/erlang/otp
git clone otp OTP-28.3 -b OTP-28.3
cd OTP-28.3
./configure --prefix=/opt/erlang/28.3 \
            --enable-kernel-poll \
            --enable-dirty-schedulers \
            --enable-jit \
            --disable-sctp \
            --disable-dynamic-ssl-lib \
            --disable-sharing-preserving \
            --with-ssl=/opt/openssl/3.6.1 \
            --with-microstate-accounting=extra \
            --without-javac \
            --without-odbc \
            --without-wx \
            --without-debugger \
            --without-observer \
            --without-crashdump_viewer \
            --without-et \
            --without-tftp \
            --without-ftp \
            --without-megaco \
            --without-eldap \
            --without-diameter \
            --without-jinterface \
            --without-snmp \
            --without-ssh \
            --without-erl_docgen \
            --without-mnesia
make -j$(nproc)
make install

OTP + AWS-LC

時雨堂では AWS が開発している AWS-LC を OpenSSL の代わりに利用し始めてる。 ただしパッチを当てる必要があるので、要注意。

AWS-LC

AWS-LC のビルドには CMake と Ninja と Go が必要なのでインストールしておくこと。

git clone --branch v1.67.0 --depth 1 https://github.com/aws/aws-lc
cd aws-lc
cmake -GNinja -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/opt/aws-lc/v1.67.0
ninja -C build
sudo $(which ninja) -C build install

voluntas/otp

AWS-LC を利用できるようにパッチを当てている shiguredo/otp の aws-lc-support ブランチまたは aws-lc-* タグを利用する。

git clone https://github.com/shiguredo/otp
cd otp
git checkout aws-lc-OTP-29.0-rc1
./configure --prefix=/opt/erlang/29.0-rc1 \
            --enable-kernel-poll \
            --enable-dirty-schedulers \
            --enable-jit \
            --disable-sctp \
            --disable-dynamic-ssl-lib \
            --disable-sharing-preserving \
            --with-ssl=/opt/aws-lc/v1.67.0 \
            --with-ssl-rpath=no \
            --without-javac \
            --without-odbc \
            --without-wx \
            --without-debugger \
            --without-observer \
            --without-crashdump_viewer \
            --without-et \
            --without-tftp \
            --without-ftp \
            --without-megaco \
            --without-eldap \
            --without-diameter \
            --without-jinterface \
            --without-snmp \
            --without-ssh \
            --without-erl_docgen \
            --without-mnesia
make -j$(nproc)
make install

確認方法

crypto:info(). で AWS-LC と表示されていることを確認してください。

Erlang/OTP 29 [RELEASE CANDIDATE 1] [erts-17.0] [source-c1e85e4910] [64-bit] [smp:14:14] [ds:14:14:10] [async-threads:1] [jit]

Eshell V17.0 (press Ctrl+G to abort, type help(). for help)
1> crypto:info().
#{otp_crypto_version => "5.9",compile_type => normal,
  link_type => static,
  cryptolib_version_compiled =>
      "OpenSSL 1.1.1 (compatible; AWS-LC 1.67.0)",
  cryptolib_version_linked => "AWS-LC 1.67.0"}

docker images

OpenSSL 版と AWS-LC 版両方のイメージを提供しています。

https://github.com/shiguredo/docker-erlang-otp/pkgs/container/erlang

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment