Environment:
CentOS 6.5
php7.0
GCC 4.9
CMake 3.5.2
The arduous process
A brief introduction to this extension, which is based on the PHPX architecture, has slightly modified the source code. P.S. Because the source code is not how to participate in the preparation, here only the installation process of the pit.
First of all, due to inconsistent environment, the development of the use of CENTOS7, when installed in 6.5, a lot of tools are not on the version, so the need for various upgrades.
1, the GCC upgrade
# Uninstall GCC
Yum Remove gcc
wget http://gcc.skazkaforyou.com/releases/gcc-4.9.1/gcc-4.9.1.tar.gztar-xf GCC-4.9.1.TAR.GZCD gcc-4.9.1./contrib/ Download_prerequisites # This script will automatically help you download the required dependent files and libraries # Build the output directory, put all the intermediate files into that directory mkdir gcc_tempcd gcc_temp. /configure--enable-checking=release--enable-languages=c,c++--disable-multilibmake & make Install
This is a long process ...
2, the upgrade of CMake
wget https://cmake.org/files/v3.5/cmake-3.5.2.tar.gztar xvf cmake-3.5. 2 . TAR.GZCD cmake-3.4. 3 . /bootstrap--prefix=/usr #这一步很关键, if you do not specify prefix, the subsequent use will be error could not find Cmake_rootmake# here in the pit, The following begins to explain
First, because the installation path is not specified for the above GCC installations, the default is/usr/local, so when you execute to the make step, you are prompted:
The C compiler identification is unknown
At this time, you set the path of the/etc/profile will also report the same error, the correct way is to create a soft connection:
Ln-s/usr/local/bin/gcc/usr/bin/-s/usr/local/bin/c++/usr/bin/c++-s/usr/local/bin/g++/usr/bin/ g++
Ln-s/usr/local/bin/gcc/usr/bin/cc # here CC for the back of the CMake self-write extension when used, in fact, point to the GCC
Error Tip 2:
/usr/lib/libstdc++.so.6:version ' glibcxx_3.4.15 ' not found
[Email protected] cmake-2.8.12.2]# strings/usr/lib64/libstdc++.so.6 | grep glibcxx
glibcxx_3.4
glibcxx_3.4.1
glibcxx_3.4.2
glibcxx_3.4.3
glibcxx_3.4.4
glibcxx_3.4.5
glibcxx_3.4.6
glibcxx_3.4.7
glibcxx_3.4.8
glibcxx_3.4.9
glibcxx_3.4.10
glibcxx_3.4.11
glibcxx_3.4.12
glibcxx_3.4.13
Glibcxx_force_new
Glibcxx_debug_message_length
[Email protected] cmake-2.8.12.2]# Strings/usr/local/lib64/libstdc++.so.6.0.20|grep glibcxx
glibcxx_3.4
glibcxx_3.4.1
glibcxx_3.4.2
glibcxx_3.4.3
glibcxx_3.4.4
glibcxx_3.4.5
glibcxx_3.4.6
glibcxx_3.4.7
glibcxx_3.4.8
glibcxx_3.4.9
glibcxx_3.4.10
glibcxx_3.4.11
glibcxx_3.4.12
glibcxx_3.4.13
glibcxx_3.4.14
glibcxx_3.4.15
glibcxx_3.4.16
glibcxx_3.4.17
glibcxx_3.4.18
glibcxx_3.4.19
glibcxx_3.4.20
Glibcxx_force_new
Glibcxx_debug_message_length
Here's all there is, put the soft link to the right place:
[Email protected] cmake-2.8.12.2]# cp/usr/local/lib64/libstdc++.so.6.0.20/usr/lib64/
[Email protected] cmake-2.8.12.2]# cd/usr/lib64/
[Email protected] lib64]# rm-f libstdc++.so.6
[Email protected] lib64]# ln-s libstdc++.so.6.0.20 libstdc++.so.6
[email protected] lib64]# ll libstdc*
lrwxrwxrwx. 1 root root 19 May 13:34 libstdc++.so.6-libstdc++.so.6.0.20
-rwxr-xr-x. 1 root root 987096 November 02:08 libstdc++.so.6.0.13
-rwxr-xr-x. 1 root root 6700716 May 13:33 libstdc++.so.6.0.20
Go
At this point, the CMake can be successfully installed
3. Installation extension
First Compile and install PHPX
git clone https://github.com/swoole/php-xcd PHP--dphp_config_dir=/usr/local/ bin-dcmake_install_prefix=./output# Next error, explained behind ... make makeinstall
Because the compile PHPX need ccache support, so need to install the cache, otherwise, CMake can pass, but make error
wget https://www.samba.org/ftp/ccache/ccache-3.3.4.tar.gztar -zxf ccache- 3.3. 4. Tar . GZCD CCache-3.3. 4 . /configure--prefix=/usrmake doinstall
After the installation is complete, install on make && makes.
This concludes the standard process installation
4. Custom PHP Extension Installation
This installation is relatively simple, because in the development of the source code has been packaged into a shared library (. so file), at this time only need:
LDD extension. So to look at the shared file required by the share library is not valid, if there is an invalid, point it to the desired add to point to the directory.
Finally, the installation is complete and the PHP extension runs normally.
Remember to install the self-write PHP extension