0、准备工作
(1)确定gcc版本
[root@master ~]# gcc --version
gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
如果gcc版本低于4.8,需要升级,参考:http://www.linuxdiyf.com/linux/27499.html
(2)Python
[root@master ~]# yum install -y python-devel
1、下载源码
git clone https://github.com/facebook/watchman.git
最近国外网络很慢,可以通过迅雷等下载工具下载
打开 https://github.com/facebook/watchman,单击“download”
2、安装编译工具
[root@master ~]# yum install -y automake
[root@master watchman-master]# yum install -y gcc gcc-c++
3、编译源码
(1)解压缩
[root@master ~]# unzip watchman-master.zip
(2)进入watchman根目录
[root@master ~]# cd watchman-master
[root@master watchman-master]#
(3)执行脚本
[root@master watchman-master]# ./autogen.sh
configure.ac:29: installing `./compile'
configure.ac:2: installing `./config.guess'
configure.ac:2: installing `./config.sub'
configure.ac:3: installing `./install-sh'
configure.ac:3: installing `./missing'
Makefile.am: installing `./depcomp'
(4)[root@master watchman-master]# ./configure
Your build configuration:
CC = gcc
CPPFLAGS = -D_REENTRANT -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE
CFLAGS = -g -O2 -Wall -Wextra -Wdeclaration-after-statement -g -gdwarf-2 -fno-omit-frame-pointer
CXX = g++ -std=C++11
CXXFLAGS = -g -O2 -Wall -Wextra -g -gdwarf-2 -fno-omit-frame-pointer
LDFLAGS =
prefix: /usr/local
version: 4.8.0
state directory: /usr/local/var/run/watchman
(5)[root@master watchman-master]# make
gcc -pthread -shared build/temp.Linux-x86_64-2.6/pywatchman/bser.o -L/usr/lib64 -lpython2.6 -o /root/watchman-master/python/pywatchman/bser.so
make[1]: Leaving directory `/root/watchman-master'
(6)make install
[root@master watchman-master]# make install
/usr/bin/install -c -d -m 777 //usr/local/var/run/watchman
chmod g+s //usr/local/var/run/watchman
touch //usr/local/var/run/watchman/.not-empty
test -z "/usr/local/share/doc/watchman-4.8.0" || /bin/mkdir -p "//usr/local/share/doc/watchman-4.8.0"
/usr/bin/install -c -m 644 README.markdown '//usr/local/share/doc/watchman-4.8.0'
make[1]: Leaving directory `/root/watchman-master'
参考: