• php-7.1编译记录


    编译php-7.1.28步骤

    • 检查环境
    ./configure 
    --prefix=/u01/server/php-7.1.28 
    --enable-fpm 
    --with-fpm-user=daemon 
    --with-fpm-group=daemon 
    --with-zlib-dir=/u01/server/common 
    --enable-mbstring=all 
    --enable-soap 
    --enable-bcmath 
    --enable-ftp 
    --with-xmlrpc 
    --enable-cgi 
    --with-imap-ssl=/u01/server/common 
    --with-png-dir=/u01/server/common 
    --with-gd 
    --with-zlib 
    --with-curl=/u01/server/common 
    --with-jpeg-dir=/u01/server/common 
    --enable-exif 
    --with-openssl=/u01/server/common 
    --with-ldap=/u01/server/common 
    --enable-calendar 
    --enable-ctype 
    --enable-pcntl 
    --enable-session 
    --with-bz2=/usr 
    --enable-sockets 
    --with-mcrypt=/u01/server/common 
    --with-icu-dir=/u01/server/common 
    --with-tidy=/u01/server/common 
    --with-mysqli=mysqlnd 
    --with-pdo-mysql=mysqlnd 
    --with-pdo_sqlite=/u01/server/sqlite 
    --with-sqlite3=/u01/server/sqlite 
    --with-iconv=/u01/server/common 
    --with-libxml-dir=/u01/server/common 
    --with-xsl=/u01/server/common 
    --with-freetype-dir=/u01/server/common 
    --with-gmp=/u01/server/common 
    --with-gettext 
    --enable-intl 
    --with-readline=/u01/server/common 
    --enable-zip 
    --with-libzip=/u01/server/common 
    --disable-huge-code-pages
    
    • 编译
    make
    
    • 安装
    make install
    

    备注

    • bz2 == bzip2是同一个意思
    • libzip提示不可用,google了很久也没找到啥原因,后面实在没招了,硬着头皮仔细看了configure脚本里面怎么处理的,最终发现了一些蛛丝马迹

    碰到的问题

    • 问题1:gcc编译工具问题
    configure: error: in `/root/php-7.1.28':
    configure: error: C++ preprocessor "/lib/cpp" fails sanity check
    
    • 解决方法
    yum install glibc-headers gcc-c++
    
    • 问题2:提示libzip版本过低

    • 解决方法

    安装新版本的libzip yum自带的不行,编译安装libzip-1.3.0版本
    yum install libzip-devel.x86_64
    yum remove libzip -y
    
    
    • 问题3:libzip检查失败
    checking for zip_open in -lzip... no
    configure: error: could not find usable libzip
    
    • 问题定位
    • 分析./configure脚本,发现最终会执行如下
    $CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5
    
    cc -o conftest 
    -I/u01/server/common/include -g -O2 -fvisibility=hidden 
    -Wl,-rpath,/u01/server/common/lib -L/u01/server/common/lib -L/u01/server/common/lib -Wl,-rpath,/u01/server/common/lib -L/u01/server/common/lib -Wl,-rpath,/u01/server/sqlite/lib -L/u01/server/sqlite/lib -Wl,-rpath,/bitnami/ruby24stack-linux-x64/output/sqlite/lib -L/bitnami/ruby24stack-linux-x64/output/sqlite/lib -Wl,-rpath,/bitnami/ruby24stack-linux-x64/output/ImageMagick/lib -L/bitnami/ruby24stack-linux-x64/output/ImageMagick/lib  
    conftest.c 
    -lzip -lz -lexslt -ltidy -lresolv -lcrypt -lreadline -lrt -lsqlite3 -lmcrypt -lltdl -lldap -llber -lstdc++ -liconv -lgmp -lpng -lz -ljpeg -lcrypto -lssl -lcrypto -lcurl -lbz2 -lz -lsqlite3 -lcrypto -lssl -lcrypto -lrt -lm -ldl -lnsl -lxml2 -lz -liconv -lm -ldl -lcurl -lxml2 -lz -liconv -lm -ldl -lfreetype -lz -lbz2 -ldl -lm -licui18n -licuuc -licudata -ldl -lm -licuio -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lcrypt -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxml2 -lz -liconv -lm -ldl -lxslt -lxml2 -lz -liconv -ldl -lm
    
    • 执行这个提示tidy这个库不存在
    • 源码编译tidy库后,这个问题解决
    • 问题4:off_t类型未定义
    configure: error: off_t undefined; check your library configuration
    
    • 解决方法
    # 添加搜索路径到配置文件
    echo '/usr/local/lib64
    /usr/local/lib
    /usr/lib
    /usr/lib64'>>/etc/ld.so.conf
    # 更新配置
    ldconfig -v
    
    • 问题5:autoconf时提示一些宏不存在
    [root@localhost libzip]# autoconf
    configure.ac:6: error: possibly undefined macro: AM_INIT_AUTOMAKE
          If this token and others are legitimate, please use m4_pattern_allow.
          See the Autoconf documentation.
    configure.ac:21: error: possibly undefined macro: AM_PROG_CC_C_O
    configure.ac:109: error: possibly undefined macro: AM_CONDITIONAL
    
    • 解决方法
    [root@localhost libzip]# autoreconf --install
    

    参考资料

  • 相关阅读:
    pygame系列_pygame的各模块叙述
    pygame系列_pygame安装
    python开发_thread_线程基础
    python开发_thread_布朗运动
    python开发_thread_线程_搜索本地文件
    python学习两月总结_汇总大牛们的思想_值得收藏
    C# .net中获取台式电脑中串口设备的名称
    C# ini文件操作【源码下载】
    C#中的串口通信
    Winform TreeView 查找下一个节点
  • 原文地址:https://www.cnblogs.com/wadeyu/p/10874842.html
Copyright © 2020-2023  润新知