LibGD2.3.2をCentOS6にソースインストール
篠原 隆司
実践環境で使う場合はご注意ください。
目的
PHP7.4.33をCentOS6にインストールしようとしたところ configure で次のエラーが発生しました。
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for gdlib >= 2.1.0... no
configure: error: Package requirements (gdlib >= 2.1.0) were not met:
Requested 'gdlib >= 2.1.0' but version of gd-devel is 2.0.34
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables GDLIB_CFLAGS
and GDLIB_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
PHP7.4.0 からLibGDは同梱されなくなりました。
特徴
- ソースコードからのインストール
- 複数バージョンの共存
特定バージョンでの開発や動作確認など開発環境での用途を目的としています。
環境
実施日 | 2022-12-10 |
サーバ | さくらのVPS 2G![]() |
OS | CentOS 6.10 |
cat /etc/redhat-release
CentOS release 6.10 (Final)
rpm -qa | grep centos-release
centos-release-6-10.el6.centos.12.3.x86_64
事前準備
LibGD 2.3.2
GitHubからダウンロードURLを確認します
https://github.com/libgd/libgd/tags
2022年12月10日時点では gd-2.3.3 が最新です。
ですが、諸事情があって今回は gd-2.3.2 です。
gd-2.3.2 欄の右下「Downloads」をクリックします。
ページが変わって下の方「Assets」に「libgd-2.3.2.tar.gz」があります。
「Source code (tar.gz)」ではないので注意
「libgd-2.3.2.tar.gz」の文字を右クリックして「リンクのアドレスをコピー(※)」
(※)ブラウザによって表記が異なります。リンクされてるURLが取得できれば方法はなんでも良いです
wget https://github.com/libgd/libgd/releases/download/gd-2.3.2/libgd-2.3.2.tar.gz
インストール
ls -la /usr/local/src
ls -la /usr/local/lib
mkdir /usr/local/src/gd-2.3.2
cd /usr/local/src/gd-2.3.2
wget https://github.com/libgd/libgd/releases/download/gd-2.3.2/libgd-2.3.2.tar.gz
tar xvzf libgd-2.3.2.tar.gz
cd libgd-2.3.2
./configure --prefix=/usr/local/lib/libgd-2.3.2
make
make install