我试图在Unix上启用GD的情况下从源代码构建PHP 8.4
root@dev:/ # uname -a
FreeBSD dev 14.2-RELEASE FreeBSD 14.2-RELEASE releng/14.2-n269506-c8918d6c7412 GENERIC amd64
我从源代码libjpeg编译(尝试版本6b、7、8和9)
https://www.ijg.org/files/
使用:
./configure --enable-shared --enable-static
生成的文件:
dir /usr/local/lib/*jpeg*
-rw-r--r-- 1 root wheel 2039538 Feb 15 12:25 /usr/local/lib/libjpeg.a
-rwxr-xr-x 1 root wheel 868 Feb 15 12:25 /usr/local/lib/libjpeg.la
lrwxr-xr-x 1 root wheel 12 Feb 14 12:52 /usr/local/lib/libjpeg.so -> libjpeg.so.9
-rwxr-xr-x 1 root wheel 1097904 Feb 14 12:52 /usr/local/lib/libjpeg.so.9
-rw-r--r-- 1 root wheel 1482374 Jan 30 03:03 /usr/local/lib/libturbojpeg.a
lrwxr-xr-x 1 root wheel 17 Jan 30 03:03 /usr/local/lib/libturbojpeg.so -> libturbojpeg.so.0
lrwxr-xr-x 1 root wheel 21 Jan 30 03:03 /usr/local/lib/libturbojpeg.so.0 -> libturbojpeg.so.0.3.0
-rwxr-xr-x 1 root wheel 976216 Jan 30 03:03 /usr/local/lib/libturbojpeg.so.0.3.0
我尝试配置PHP所得到的一切
找不到包“libjpeg”
我的配置命令:
./configure --with-apxs2=/usr/local/apache/bin/apxs \
--with-config-file-path=/usr/local/etc \
--enable-bcmath --without-cdb \
--enable-gd --without-iodbc --enable-inline-optimization \
--without-gdbm --with-ndbm --without-db2 --without-dbm \
--without-readline --without-recode --with-openssl \
--without-db3 --enable-dba \
--with-curl \
--with-jpeg --enable-calendar \
--with-mhash --enable-mbstring=all \
--with-zlib \
--with-png-dir=/usr/local/libpng/lib \
--with-freetype --with-pdo-mysql \
--enable-exif --enable-zip \
--without-libzip \
--with-mysqli=mysqlnd \
--without-sqlite3
搜索
config.log
对于“jpeg”显示,它似乎第一次看到它时就打开了,但第二次就失败了。
configure:35077: checking for libjpeg
configure:35094: result: yes
...
configure:36211: checking for libjpeg
configure:36218: $PKG_CONFIG --exists --print-errors "libjpeg"
Package libjpeg was not found in the pkg-config search path.
Perhaps you should add the directory containing `libjpeg.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libjpeg' not found
configure:36221: $? = 1
configure:36235: $PKG_CONFIG --exists --print-errors "libjpeg"
Package libjpeg was not found in the pkg-config search path.
Perhaps you should add the directory containing `libjpeg.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libjpeg' not found
configure:36238: $? = 1
configure:36252: result: no
Package 'libjpeg' not found
configure:36277: error: Package requirements (libjpeg) were not met:
Package 'libjpeg' not found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables JPEG_CFLAGS
and JPEG_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
我不是C程序员,也不太熟悉构建过程,所以如果能得到一些帮助,我将不胜感激。我用谷歌搜索这些建议
配置
列出了,但找不到任何有用的东西。
编辑
根据评论,我安装了libjpeg的9f版本
root@dev:/usr/local/jpeg-9f # make install
mkdir -p '/usr/local/lib'
/bin/sh ./libtool --mode=install /usr/bin/install -c libjpeg.la '/usr/local/lib'
libtool: install: /usr/bin/install -c .libs/libjpeg.so.9.6.0 /usr/local/lib/libjpeg.so.9.6.0
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.6.0 libjpeg.so.9 || { rm -f libjpeg.so.9 && ln -s libjpeg.so.9.6.0 libjpeg.so.9; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libjpeg.so.9.6.0 libjpeg.so || { rm -f libjpeg.so && ln -s libjpeg.so.9.6.0 libjpeg.so; }; })
libtool: install: /usr/bin/install -c .libs/libjpeg.lai /usr/local/lib/libjpeg.la
libtool: install: /usr/bin/install -c .libs/libjpeg.a /usr/local/lib/libjpeg.a
libtool: install: chmod 644 /usr/local/lib/libjpeg.a
libtool: install: ranlib /usr/local/lib/libjpeg.a
mkdir -p '/usr/local/bin'
/bin/sh ./libtool --mode=install /usr/bin/install -c cjpeg djpeg jpegtran rdjpgcom wrjpgcom '/usr/local/bin'
libtool: install: /usr/bin/install -c .libs/cjpeg /usr/local/bin/cjpeg
libtool: install: /usr/bin/install -c .libs/djpeg /usr/local/bin/djpeg
libtool: install: /usr/bin/install -c .libs/jpegtran /usr/local/bin/jpegtran
libtool: install: /usr/bin/install -c rdjpgcom /usr/local/bin/rdjpgcom
libtool: install: /usr/bin/install -c wrjpgcom /usr/local/bin/wrjpgcom
/bin/sh /usr/local/jpeg-9f/install-sh -d /usr/local/include
/usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
mkdir -p '/usr/local/include'
/usr/bin/install -c -m 644 jerror.h jmorecfg.h jpeglib.h '/usr/local/include'
mkdir -p '/usr/local/share/man/man1'
/usr/bin/install -c -m 644 cjpeg.1 djpeg.1 jpegtran.1 rdjpgcom.1 wrjpgcom.1 '/usr/local/share/man/man1'
mkdir -p '/usr/local/lib/pkgconfig'
/usr/bin/install -c -m 644 libjpeg.pc '/usr/local/lib/pkgconfig'
libjpeg.pc存在:
/usr/local/lib/pkgconfig/libjpeg.pc
然而,当我配置PHP时仍然遇到同样的问题(我在重试之前删除了config.log/ince)
setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig
似乎奏效了,但现在失败了
iconv支持errno。。。不
checking for libjpeg... yes
checking for libXpm... no
checking for FreeType 2... yes
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for zlib >= 1.2.11... yes
checking for libpng... yes
checking for libjpeg... yes
checking for freetype2... yes
checking whether build works... yes
checking for GNU gettext support... no
checking for GNU MP support... no
checking for mhash support... yes
configure: WARNING: The --with-mhash option and mhash* functions are deprecated as of PHP 8.1.0
checking size of long... (cached) 8
checking if we're at 64-bit platform... yes
checking for iconv support... yes
checking for iconv... yes
checking for iconv implementation... GNU libiconv
checking if iconv supports errno... no
configure: error: in '/usr/local/dev_build_sources/php-8.4.3':
configure: error: The iconv check failed, 'errno' is missing.