1.首先下载watchman
git clone https://github.com/facebook/watchman.git
2.然后切换到最新版本
cd watchman
git checkout v4.9.0 # the latest stable release
3.安装工具
sudo dnf install libtool*
4.然后执行
./autogen.sh
5.执行 ./configure
我的报错了:
checking whether we are using the GNU C++ compiler... no
checking whether g++ accepts -g... no
checking dependency style of g++... none
checking whether g++ supports C++11 features by default... no
checking whether g++ supports C++11 features with -std=c++11... no
checking whether g++ supports C++11 features with -std=c++0x... no
checking whether g++ supports C++11 features with +std=c++11... no
checking whether g++ supports C++11 features with -h std=c++11... no
configure: error: *** A compiler with support for C++11 language features is required.
a.需要安装g++
然后执行:sudo yum install gcc-c++
b.然后执行make又报错:
ContentHash.cpp:13:10: 致命错误:openssl/sha.h:No such file or directory
#include <openssl/sha.h>
^~~~~~~~~~~~~~~
解决办法执行:yum -y install openssl-devel
c.然后再执行make,又报错
watchman-ContentHash.o: In function `watchman::ContentHashCache::computeHashImmediate(watchman::ContentHashCacheKey const&) const':
ContentHash.cpp:(.text+0x8d4): undefined reference to `SHA1_Update'
ContentHash.cpp:(.text+0x8fc): undefined reference to `SHA1_Final'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:1566:watchman] 错误 1
make[1]: 离开目录“/home/liuxu/github/watchman”
解决办法再运行一次./configure,然后再运行make,又报错了:
gcc: 错误:/usr/lib/rpm/redhat/redhat-hardened-cc1:No such file or directory
error: command 'gcc' failed with exit status 1
make[1]: *** [Makefile:5059:py-build] 错误 1
make[1]: 离开目录“/home/liuxu/github/watchman”
make: *** [Makefile:1100:all] 错误 2
解决办法:
sudo dnf install redhat-rpm-config
再次运行make又报错了:
pywatchman/bser.c:31:10: 致命错误:Python.h:No such file or directory
#include <Python.h>
^~~~~~~~~~
解决办法:
sudo yum install python-devel
然后再执行:
sudo make install
因为inotify默认内核参数值太小,修改之:
echo 256 | sudo tee -a /proc/sys/fs/inotify/max_user_instances
echo 32768 | sudo tee -a /proc/sys/fs/inotify/max_queued_events
echo 65536 | sudo tee -a /proc/sys/fs/inotify/max_user_watches
watchman shutdown-server