Skip to content

Instantly share code, notes, and snippets.

@markis
Last active April 4, 2022 08:53
Show Gist options
  • Star 21 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save markis/705f101a549f958d62546fb966caae42 to your computer and use it in GitHub Desktop.
Save markis/705f101a549f958d62546fb966caae42 to your computer and use it in GitHub Desktop.
sudo apt install -y autoconf automake build-essential python-dev libtool libssl-dev pkg-config
cd /tmp
git clone https://github.com/facebook/watchman.git -b v4.9.0 --depth 1
cd watchman/
./autogen.sh
./configure --enable-lenient
make
sudo make install
@jmgallo55
Copy link

thanks Markis for putting this together! It is better than the installation instructions on Watchmen page

@mnpenner
Copy link

mnpenner commented Dec 5, 2017

N.B. these same instructions don't work on v4.9.0. It craps out here on Ubuntu 16.04:

❯ make                                                                            
make  all-am
make[1]: Entering directory '/home/me/Projects/watchman'
cd python && /usr/bin/python ./setup.py clean build_py -c -d . build_ext -i
  CXXLD    watchman
running clean
removing 'build/temp.linux-x86_64-2.7' (and everything under it)
running build_py
running build_ext
copying build/lib.linux-x86_64-2.7/pywatchman/bser.so -> pywatchman
watchman-ContentHash.o: In function `watchman::ContentHashCache::computeHashImmediate(watchman::ContentHashCacheKey const&) const':
/home/me/Projects/watchman/ContentHash.cpp:65: undefined reference to `SHA1_Init'
/home/me/Projects/watchman/ContentHash.cpp:78: undefined reference to `SHA1_Update'
/home/me/Projects/watchman/ContentHash.cpp:81: undefined reference to `SHA1_Final'
collect2: error: ld returned 1 exit status
Makefile:1566: recipe for target 'watchman' failed
make[1]: *** [watchman] Error 1
make[1]: Leaving directory '/home/me/Projects/watchman'
Makefile:1101: recipe for target 'all' failed
make: *** [all] Error 2

Switching to v4.7.0, doing a make clean and then trying again didn't work either. Had to nuke entire watchman dir and then the instructions above worked. Thanks Markis!

@Aishwarya-Surana
Copy link

What helped you @mnpenner

@thidasapankaja
Copy link

Everything works until 8th step. When I start running make this is what I get.

make  all-am
make[1]: Entering directory '/home/pankaja/watchman'
  CC       thirdparty/libart/src/art.o
  AR       libart.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       thirdparty/libtap_a-tap.o
  AR       libtap.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       thirdparty/jansson/libwmanjson_a-dump.o
  CC       thirdparty/jansson/libwmanjson_a-error.o
  CC       thirdparty/jansson/libwmanjson_a-hashtable.o
  CC       thirdparty/jansson/libwmanjson_a-load.o
  CC       thirdparty/jansson/libwmanjson_a-memory.o
  CC       thirdparty/jansson/libwmanjson_a-pack_unpack.o
  CC       thirdparty/jansson/libwmanjson_a-strbuffer.o
  CC       thirdparty/jansson/libwmanjson_a-strconv.o
  CC       thirdparty/jansson/libwmanjson_a-utf.o
  CC       thirdparty/jansson/libwmanjson_a-value.o
  AR       libwmanjson.a
ar: `u' modifier ignored since `D' is the default (see `U')
  CC       watchman-argv.o
  CC       watchman-envp.o
  CC       watchman-spawn.o
  CC       watchman-opt.o
  CC       watchman-cfg.o
  CC       watchman-clockspec.o
  CC       watchman-checksock.o
  CC       watchman-fstype.o
  CC       watchman-log.o
  CC       watchman-ignore.o
  CC       watchman-json.o
  CC       watchman-bser.o
  CC       watchman-expflags.o
  CC       watchman-hash.o
hash.c: In function ‘w_hash_bytes’:
hash.c:228:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 12: c+=((uint32_t)k[11])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~~
hash.c:229:7: note: here
       case 11: c+=((uint32_t)k[10])<<16;
       ^~~~
hash.c:229:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 11: c+=((uint32_t)k[10])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~~
hash.c:230:7: note: here
       case 10: c+=((uint32_t)k[9])<<8;
       ^~~~
hash.c:230:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 10: c+=((uint32_t)k[9])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:231:7: note: here
       case 9 : c+=k[8];
       ^~~~
hash.c:231:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 9 : c+=k[8];
                ~^~~~~~
hash.c:232:7: note: here
       case 8 : b+=((uint32_t)k[7])<<24;
       ^~~~
hash.c:232:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 8 : b+=((uint32_t)k[7])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:233:7: note: here
       case 7 : b+=((uint32_t)k[6])<<16;
       ^~~~
hash.c:233:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 7 : b+=((uint32_t)k[6])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:234:7: note: here
       case 6 : b+=((uint32_t)k[5])<<8;
       ^~~~
hash.c:234:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 6 : b+=((uint32_t)k[5])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:235:7: note: here
       case 5 : b+=k[4];
       ^~~~
hash.c:235:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 5 : b+=k[4];
                ~^~~~~~
hash.c:236:7: note: here
       case 4 : a+=((uint32_t)k[3])<<24;
       ^~~~
hash.c:236:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 4 : a+=((uint32_t)k[3])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:237:7: note: here
       case 3 : a+=((uint32_t)k[2])<<16;
       ^~~~
hash.c:237:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 3 : a+=((uint32_t)k[2])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:238:7: note: here
       case 2 : a+=((uint32_t)k[1])<<8;
       ^~~~
hash.c:238:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 2 : a+=((uint32_t)k[1])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:239:7: note: here
       case 1 : a+=k[0];
       ^~~~
cc1: all warnings being treated as errors
Makefile:2313: recipe for target 'watchman-hash.o' failed
make[1]: *** [watchman-hash.o] Error 1
make[1]: Leaving directory '/home/pankaja/watchman'
Makefile:868: recipe for target 'all' failed
make: *** [all] Error 2

What's wrong ? How can I fix this ?

@drazisil
Copy link

I arrived here searching on the error @mnpenner had https://gist.github.com/markis/705f101a549f958d62546fb966caae42#gistcomment-2276955

What corrected that error for me on Ubuntu 16.04 was running ./configure again after installing libssl-dev

@AlexKarari
Copy link

Try ./configure --enable-lenientinstead of./configure.

It worked perfectly for me.

@chrismou
Copy link

FYI I also had to sudo apt-get install libcrypto++-dev to get around the following build errors on 18.04 using v4.9.0:

ContentHash.cpp:65: undefined reference to `SHA1_Init'
ContentHash.cpp:78: undefined reference to `SHA1_Update'
ContentHash.cpp:81: undefined reference to `SHA1_Final'

@ganesh-deshmukh
Copy link

ganesh-deshmukh commented May 26, 2018

I am using Ubuntu 18.04,
getting error after make command.

error screen is

gd@gd10:/tmp/watchman$ make
make  all-am
make[1]: Entering directory '/tmp/watchman'
  CC       watchman-hash.o
hash.c: In function ‘w_hash_bytes’:
hash.c:228:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 12: c+=((uint32_t)k[11])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~~
hash.c:229:7: note: here
       case 11: c+=((uint32_t)k[10])<<16;
       ^~~~
hash.c:229:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 11: c+=((uint32_t)k[10])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~~
hash.c:230:7: note: here
       case 10: c+=((uint32_t)k[9])<<8;
       ^~~~
hash.c:230:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 10: c+=((uint32_t)k[9])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:231:7: note: here
       case 9 : c+=k[8];
       ^~~~
hash.c:231:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 9 : c+=k[8];
                ~^~~~~~
hash.c:232:7: note: here
       case 8 : b+=((uint32_t)k[7])<<24;
       ^~~~
hash.c:232:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 8 : b+=((uint32_t)k[7])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:233:7: note: here
       case 7 : b+=((uint32_t)k[6])<<16;
       ^~~~
hash.c:233:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 7 : b+=((uint32_t)k[6])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:234:7: note: here
       case 6 : b+=((uint32_t)k[5])<<8;
       ^~~~
hash.c:234:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 6 : b+=((uint32_t)k[5])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:235:7: note: here
       case 5 : b+=k[4];
       ^~~~
hash.c:235:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 5 : b+=k[4];
                ~^~~~~~
hash.c:236:7: note: here
       case 4 : a+=((uint32_t)k[3])<<24;
       ^~~~
hash.c:236:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 4 : a+=((uint32_t)k[3])<<24;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:237:7: note: here
       case 3 : a+=((uint32_t)k[2])<<16;
       ^~~~
hash.c:237:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 3 : a+=((uint32_t)k[2])<<16;
                ~^~~~~~~~~~~~~~~~~~~~~~
hash.c:238:7: note: here
       case 2 : a+=((uint32_t)k[1])<<8;
       ^~~~
hash.c:238:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
       case 2 : a+=((uint32_t)k[1])<<8;
                ~^~~~~~~~~~~~~~~~~~~~~
hash.c:239:7: note: here
       case 1 : a+=k[0];
       ^~~~
cc1: all warnings being treated as errors
Makefile:2313: recipe for target 'watchman-hash.o' failed
make[1]: *** [watchman-hash.o] Error 1
make[1]: Leaving directory '/tmp/watchman'
Makefile:868: recipe for target 'all' failed
make: *** [all] Error 2
gd@gd10:/tmp/watchman$```

@DavidPineda
Copy link

I install with master branch, and worked perfectly for me.

@devlargs
Copy link

Thanks for this man! 🥇

@jonnygovish
Copy link

How do you test if watchman works?

@Cyci25
Copy link

Cyci25 commented Aug 5, 2018

How do I correct this error found after running the sudo apt-get install -y autoconf automake build-essential python-dev libtool libssl-dev command

The following packages have unmet dependencies:
python-dev : Depends: python (= 2.7.11-1) but 2.7.12-116.04 is to be installed
Depends: libpython-dev (= 2.7.11-1) but it is not going to be installed
Depends: python2.7-dev (>= 2.7.11-1
) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

@marktyers
Copy link

These steps worked for me on Ubuntu 18.4 (note I had to install the pkg-config package):

sudo apt install -y autoconf automake build-essential python-dev libtool libssl-dev pkg-config
cd /tmp
git clone https://github.com/facebook/watchman.git
cd watchman/
git checkout v4.9.0
./autogen.sh 
./configure 
make
sudo make install

@longtc170593
Copy link

thank you

@collinanderson
Copy link

ditto on 18.04 pkg-config is also needed

@harsh-98
Copy link

@maurojaf
Copy link

These steps worked for me on Ubuntu 18.4 (note I had to install the pkg-config package):

sudo apt install -y autoconf automake build-essential python-dev libtool libssl-dev pkg-config
cd /tmp
git clone https://github.com/facebook/watchman.git
cd watchman/
git checkout v4.9.0
./autogen.sh 
./configure 
make
sudo make install

Working! thx!!

@elarb
Copy link

elarb commented Nov 27, 2019

./configure --without-python --without-pcre --enable-lenient

did the trick on 19.04

@markis
Copy link
Author

markis commented Dec 2, 2019

I updated the script with all the comments mentioned here, ie. pkg-config and --enable-lenient

@Shair17
Copy link

Shair17 commented May 1, 2020

Another way more easiest is sudo apt install watchman

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment