Apache2.4.63をセルフビルド時にAPRパッケージが足りない問題の解決方法

問題:checking for APR... no configure: error: APR not found. Please read the documentation.

APR は Apache の動作に必要なライブラリであり、事前にインストールされている必要があります。

解決策

1️⃣ APR(Apache Portable Runtime)をインストール

まず、APR をインストールします。

bash

sudo apt update
sudo apt install libapr1 libaprutil1

もし libapr1-dev が必要な場合は、次のコマンドも実行してください。

bash

sudo apt install libapr1-dev libaprutil1-dev

2️⃣ Apache のコンパイル時に APR の場所を指定

APR が configure スクリプトで認識されるよう、以下のようにパスを指定してコンパイルします。

bash

./configure --with-apr=/usr/bin/apr-1-config --enable-ssl --enable-http2 --enable-http3

もし /usr/bin/apr-1-config のパスが異なる場合は、以下で確認できます。

bash

which apr-1-config

3️⃣ ソースから APR を手動インストール

もし APR をパッケージからインストールできない 場合は、ソースからビルドする必要があります。

bash

cd /usr/local/src
wget https://downloads.apache.org/apr/apr-1.7.0.tar.gz
tar xvf apr-1.7.0.tar.gz
cd apr-1.7.0
./configure
make
sudo make install

🚀 まとめ

  1. libapr1libapr1-dev をインストールする
  2. configure 実行時に --with-apr オプションで APR のパスを指定する
  3. 必要なら APR をソースからビルドする