报错信息为:
configure: error: off_t undefined; check your library configuration
下面是配置信息
./configure --prefix=/application/php5.6.27 \
--with-mysql=/application/mysql-5.5.53 \
--with-iconv-dir=/usr/local/libiconv \
--with-freetype-dir \
--with-jpeg-dir \
--with-png-dir \
--with-zlib \
--with-libxml-dir=/usr \
--enable-xml \
--disable-rpath \
--enable-safe-mode \
--enable-bcmath \
--enable-shmop \
--enable-sysvsem \
--enable-inline-optimization \
--with-curl \
--with-curlwrappers \
--enable-mbregex \
--enable-fpm \
--enable-mbstring \
--with-mcrypt \
--with-gd \
--enable-gd-native-ttf \
--with-openssl \
--with-mhash \
--enable-pcntl \
--enable-sockets \
--with-xmlrpc \
--enable-zip \
--enable-soap \
--enable-short-tags \
--enable-zend-multibyte \
--enable-static \
--with-xsl \
--with-fpm-user=nginx \
--with-fpm-group=nginx \
--enable-opcache=no \
--enable-ftp
求解,非常感谢!
回答
根据报错信息分析 configure: error: off_t undefined; check your library configuration
未定义的类型 off_t。
off_t 类型是在 头文件 unistd.h中定义的,在32位系统 编译成 long int ,64位系统则编译成 long long int ,这里题主的系统应该是 64位的吧,在进行编译的时候 是默认查找64位的动态链接库,但是默认情况下 centos 的动态链接库配置文件/etc/ld.so.conf里并没有加入搜索路径,这个时候需要将 /usr/local/lib64 /usr/lib64 这些针对64位的库文件路径加进去。
所以 @张馆长 的方法是可行的
# 添加搜索路径到配置文件
echo '/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64'>>/etc/ld.so.conf
# 更新配置
ldconfig -v
(其中ldconfig -v 是用来更新ld的缓存文件 ld.so.cache , 缓存文件的目的是记录动态编译库文件的路径,加快二进制文件运行时的速度)
待验证: ld默认搜索路径应该是 /usr/local/lib /usr/lib ,这个待验证
ld默认搜索路径是 /usr/local/lib /usr/lib
我也遇到这个问题了,报的前一个错是
configure: error: Don’t know how to define struct flock on this system, set –enable-opcache=no
我把–enable-opcache=no加上,结果报了这个错;
最后,
[[email protected] php-7.1.7]#vim /etc/ld.so.conf.d/local.conf
# 添加一行
/usr/local/lib
[[email protected] php-7.1.7]# ldconfig -v
而且把–enable-opcache=no去掉也不报错了。
yum install libzip
echo ‘/usr/local/lib64
/usr/local/lib
/usr/lib
/usr/lib64′>>/etc/ld.so.conf&&ldconfig -v
这歌off_t在哪呢我怎么么看着.
我也遇到这问题,请问楼主解决了吗
CentOS 6有32位和64之分,在32位里编译PHP应当不会出这个问题,路径问题也不算太复杂。
在64位里情况复杂一些,@代码狗 和@张馆长 两位的修改/etc/ld.so.conf文件的办法可以解决这个问题,但是修改完该文件后,通常还要运行一下ldconfig才会生效。
不过,这样做虽然可以解决PHP编译通过的问题,也极有可能带来另一个麻烦,它会造成其它编译的文件的链接出错。
比如在自行编译OpenSSL和cURL之后,往往出出现(直接)运行curl命令系统提示找不到libsso动态运行库的情况,更麻烦的是,此时运行YUM命令,会报python损坏无法使用YUM的情况,如红帽子官方提供的信息称与curl这个第三方库造成的损坏有关。
我尝试了一下,完全按照上面的办法的确会造成这个问题,即YUM无法运行,于是再次将ld.so.conf文件复原并运行ldconfig后修复。
对于编译PHP出现楼主所提出的问题,我自己在一台CentOS 6.10Final x86-64的机器上运行过,在产生同样的问题后,用了PKG_CONFIG_PATH的方式来解决,即增加除默认路径/usr/local/lib以外64位机器下lib64的路径的pkgconfig信息,交给程序自己抽取位置。
具体的,就是添加这样一段:
PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/local/lib/pkgconfig \
./configure --prefix=/usr/local/php7 --other-options
此外,这个问题可能与–enable-zip及libzip有关,PHP官方有过一个bug报告可参考一下,链接如下
https://bugs.php.net/bug.php?…
根据php的bug中的如下说明
[2018-12-12 14:12 UTC] agiokov at gmail dot com
In my case, the issue was caused by the correct path to libzip library missing from the LD_LIBRARY_PATH environment variable. Adding it there solved it.
我在configure时,
export LD_LIBRARY_PATH=”/usr/local/lib”
之后再编译通过.(/usr/local/lib是libzip的路径)
yum install libmcrypt-devel
如果yum里面没有,更新yum
No package libmcrypt-devel available
yum install epel-release //扩展包更新包
yum update //更新yum源
yum install libmcrypt libmcrypt-devel mcrypt mhash
先执行 ./buildconf 进行环境监测, 再去执行./configure
报错一:
configure: error: Don't know how to define struct flock on this system, set --enable-opcache=no
报错二:
configure: error: off_t undefined; check your library configuration
问题:
需要libmysqlclient.so 文件,也就是mysql下的/lib/目录下的 libmysqlclient.so
解决方法:解决问题二 off_t 的报错。问题一报错中说了添加一个–enable-opcache=no就可以
[[email protected] lib]# vim /etc/ld.so.conf
添加如下:
/usr/local/mysql/lib (/usr/local/mysql是mysql的安装目录)
保存退出,执行ldconfig命令,如下:
[[email protected] lib]# ldconfig
然后运行 ./configure …… 我的configure如下:
(configure不一样不重要,重要的是报错是一样的。我是为后边装zabbix做准备)
./configure –prefix=/usr/local/php –with-gettext –with-mysqli=/usr/local/mysql/bin/mysql_config –with-mysql=/usr/local/mysql –with-iconv-dir=/usr/local/libiconv –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –disable-rpath –enable-bcmath –enable-shmop –enable-sysvsem –enable-inline-optimization –with-curl –enable-mbregex –enable-fpm –enable-mbstring –with-mcrypt –with-gd –enable-gd-native-ttf –with-openssl –with-mhash –enable-pcntl –enable-sockets –with-xmlrpc –enable-zip –enable-soap –enable-short-tags –enable-static –with-xsl –with-fpm-user=nginx –with-fpm-group=nginx –enable-ftp –enable-opcache=no
希望能帮到你!
本文详细阐述了解决PHP编译过程中遇到的off_t undefined错误,涉及检查library configuration,修改ld.so.conf文件,增加64位库路径,并提到了与opcache和libzip可能存在的关联。

3801

被折叠的 条评论
为什么被折叠?



