安装PHP的时候,我使用的编译参数为
./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql/ --with-apxs2=/usr/local/apache/bin/apxs --with-iconv --enable-mbstring --with-gd --with-ttf --with-jpeg-dir --with-png-dir --with-zlib-dir --with-openssl --with-curl --enable-magic-quotes --enable-xml --with-mcrypt
make的时候出现如下错误,如
果不带--with-gd则正常:(此处截取了出错的报告)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:38:21: jpeglib.h: No such file or directory
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:39:20: jerror.h: No such file or directory
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:49: error: syntax error before "jpeg_info"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_jpeg_emit_message':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:51: error: `JMSG_LENGTH_MAX' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:51: error: (Each undeclared identifier is reported only once
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:51: error: for each function it appears in.)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:55: error: `jpeg_info' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:64: error: `level' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:85: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `fatal_jpeg_error':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:90: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:132: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_gdImageJpegCtx':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:136: error: storage size of 'cinfo' isn't known
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:137: error: storage size of 'jerr' isn't known
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:140: error: syntax error before "row"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:141: error: `JSAMPROW' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:143: error: `JDIMENSION' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:143: error: syntax error before "nlines"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:153: error: `row' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:166: error: `JCS_RGB' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:169: error: `TRUE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:179: error: syntax error before "_safe_emalloc"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:180: error: `JSAMPLE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:181: error: `rowptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:186: error: `JPEG_LIB_VERSION' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:190: error: `JPEG_COM' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:207: error: `nlines' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:230:2: #error IJG JPEG library BITS_IN_JSAMPLE value must be 8 or 12
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:266: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_gdImageCreateFromJpegCtx':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:277: error: storage size of 'cinfo' isn't known
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:278: error: storage size of 'jerr' isn't known
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:281: error: syntax error before "row"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:283: error: `JSAMPROW' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:283: error: syntax error before "rowptr"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:286: error: `JDIMENSION' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:286: error: syntax error before "nrows"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:298: error: syntax error before "j_common_ptr"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:302: error: `row' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:318: error: `JPEG_APP0' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:320: error: `TRUE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:321: error: `JPEG_HEADER_OK' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:342: error: `JCS_CMYK' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:342: error: `JCS_YCCK' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:345: error: `JCS_RGB' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:372: error: `jpeg_saved_marker_ptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:372: error: syntax error before "marker"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:378: error: `marker' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:396: error: `JSAMPLE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:398: error: `rowptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:402: error: syntax error before "currow"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:404: error: `nrows' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:409: error: `currow' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:415: error: syntax error before "currow"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:488: error: field `pub' has incomplete type
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:504: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_init_source':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:506: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:512: error: `TRUE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:551: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_fill_input_buffer':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:553: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:576: error: `JERR_INPUT_EMPTY' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:578: error: `JWRN_JPEG_EOF' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:581: error: `JPEG_EOI' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:587: error: `FALSE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:589: error: `TRUE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:605: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_skip_input_data':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:607: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:612: error: `num_bytes' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:644: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:659: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_jpeg_gdIOCtx_src':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:670: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:672: error: `j_common_ptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:672: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:674: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:682: error: `jpeg_resync_to_restart' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:684: error: `infile' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:693: error: field `pub' has incomplete type
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:707: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_init_destination':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:709: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:712: error: `j_common_ptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:712: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:742: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_empty_output_buffer':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:744: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:747: error: `JERR_FILE_WRITE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:753: error: `TRUE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:766: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_term_destination':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:768: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:773: error: `JERR_FILE_WRITE' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: At top level:
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:784: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c: In function `php_gd_jpeg_gdIOCtx_dest':
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:794: error: `cinfo' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:795: error: `j_common_ptr' undeclared (first use in this function)
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:795: error: syntax error before "cinfo"
/root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c:802: error: `outfile' undeclared (first use in this function)
make: *** [ext/gd/libgd/gd_jpeg.lo] Error 1
错误原因:
通过查看代码发现,发现 PHP make的时候无法找到jpeg的相关文件
解决方法:
1.cp /root/software/jpeg-6b/* /root/software/php-5.2.6/ext/gd/libgd/
2.编辑 /root/software/php-5.2.6/ext/gd/libgd/gd_jpeg.c文件
找到jpeglib.h和jerror.h的所在位置,然后给他指明绝对路径,这个东西应该是装jpegsrc.v6b.tar.gz的时候产生的
#include "/root/software/jpeg-6b/jpeglib.h"
#include "/root/software/jpeg-6b/jerror.h"
转载于:https://blog.51cto.com/wangmukun/206169