taowen / go-php7

bind php7 to go environment
MIT License
34 stars 6 forks source link

/usr/bin/ld: cannot find -lopcache #2

Open xtgxiso opened 7 years ago

xtgxiso commented 7 years ago

/usr/bin/ld: cannot find -lopcache

这个怎么解决呀。怎么生成libopcache.so

taowen commented 7 years ago
#!/bin/bash

# Halt on errors
set -e

# Be verbose
set -x

function compile_curl() {
    pushd curl-7_50_3
    [[ -e "configure" ]] || ./buildconf
    ./configure --prefix /opt/curl-7_50_3
    make -j8
    sudo make install
    sudo rm /opt/curl || true
    sudo ln -sf /opt/curl-7_50_3 /opt/curl
    popd
}

function compile_libmcrypt() {
    pushd libmcrypt-2.5.8
    [[ -e "configure" ]] || ./buildconf
    ./configure --prefix=/opt/libmcrypt-2.5.8 --disable-posix-threads --enable-static
    make -j8
    sudo make install
    sudo rm /opt/libmcrypt || true
    sudo ln -sf /opt/libmcrypt-2.5.8 /opt/libmcrypt
    sudo rm /opt/libmcrypt/lib/libmcrypt.so*
    sudo rm /opt/libmcrypt/lib/libmcrypt.la
    popd
}

function compile_zlib() {
    pushd zlib-1.2.8
    ./configure --prefix=/opt/zlib-1.2.8 --static
    make -j8
    sudo make install
    sudo rm /opt/zlib || true
    sudo ln -sf /opt/zlib-1.2.8 /opt/zlib
    popd
}

function compile_openssl() {
    pushd openssl-1.0.1u
    ./config --prefix=/opt/openssl-1.0.1u --openssldir=/opt/openssl-1.0.1u
    make -j8
    sudo make install
    sudo rm /opt/openssl || true
    sudo ln -sf /opt/openssl-1.0.1u /opt/openssl
    popd
}

function compile_libxml2() {
    pushd libxml2-2.9.4
    ./autogen.sh --with-zlib=/opt/zlib --prefix=/opt/libxml2-2.9.4 --disable-shared --without-python
    make -j8
    sudo make install
    sudo rm /opt/libxml2 || true
    sudo ln -sf /opt/libxml2-2.9.4 /opt/libxml2
    popd
}

[[ -e "/opt/curl" ]] || compile_curl
[[ -e "/opt/libmcrypt" ]] || compile_libmcrypt
[[ -e "/opt/zlib" ]] || compile_zlib
[[ -e "/opt/openssl" ]] || compile_openssl
[[ -e "/opt/libxml2" ]] || compile_libxml2
pushd php-7.0.13
[[ -e "configure" ]] || ./buildconf --force
./configure --prefix /opt/php-7.0.13 --enable-embed=static --enable-debug \
    --enable-fpm --without-pear --without-iconv --enable-xml --with-libxml-dir=/opt/libxml2 \
    --enable-sockets --enable-opcache --enable-redis --with-curl=/opt/curl --with-mysqli --with-mcrypt=/opt/libmcrypt \
    --enable-mbregex --enable-mbstring --enable-pdo --enable-bcmath --enable-pcntl --with-zlib=/opt/zlib \
    --with-openssl=/opt/openssl --enable-zip \
    --with-config-file-path=/home/xiaoju/php7/etc
make
sudo make install
sudo rm /opt/php || true
sudo ln -sf /opt/php-7.0.13 /opt/php
popd
# opcache is not linked into libphp7.a, even we are doing static build
# rename to libxxx, so that we can link statically into disf-php
sudo cp /opt/php/lib/php/extensions/debug-non-zts-20151012/opcache.a /opt/php/lib/php/extensions/debug-non-zts-20151012/libopcache.a
xtgxiso commented 7 years ago

多谢,我找时间再测试下。看好这个项目,如果定位替换fpm的话,真的可以实现好的有意思的功能。