Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
637 views
in Technique[技术] by (71.8m points)

CentOS6.8下编译安装PHP,执行 ./configure后报错,请问怎么解决?

报错信息为:

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

求解,非常感谢!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

根据报错信息分析 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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to MLink Developer Q&A Community for programmer and developer-Open, Learning and Share
...