Watchman: Unable to build on Linux Mint 18.2 (Ubuntu 16.04)

Created on 7 Sep 2017  路  7Comments  路  Source: facebook/watchman

Greetings. Tying to build Watchman on Mint 18.2 and am met with the following error:

misutowolf@jsdev ~/projects/watchman $ make
make  all-am
make[1]: Entering directory '/home/misutowolf/projects/watchman'
  CXXLD    watchman
watchman-ContentHash.o: In function `watchman::ContentHashCache::computeHashImmediate(watchman::ContentHashCacheKey const&) const':
/home/misutowolf/projects/watchman/ContentHash.cpp:65: undefined reference to `SHA1_Init'
/home/misutowolf/projects/watchman/ContentHash.cpp:78: undefined reference to `SHA1_Update'
/home/misutowolf/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/misutowolf/projects/watchman'
Makefile:1101: recipe for target 'all' failed
make: *** [all] Error 2

I noticed there was a similar issue raised regarding this error earlier, but the OP didn't mention his distro or anything.

Also, I've already installed libssl-dev and libcrypto++-dev on my system, and this build still fails. Not sure what else I could be missing here. Thanks in advance!

Most helpful comment

On Xubuntu 17.04, had this error but it disappeared after I did make clean, ./autogen.sh, ./configure, make. It now builds correctly. I installed several dependencies after doing my initial ./autogen.sh, including libssl-dev. It seems like a different issue to kwlzn's above, but hopefully this solution works for some people.

All 7 comments

I also repro this on 14.04.5 LTS, Trusty Tahr using a custom build of openssl 1.0.2l.

was able to work around it with LDFLAGS at ./Configure time, but suspect there needs to be a parameterized watchman_LDADD entry indicating the need to link against openssl in Makefile.am to properly repair.

On Xubuntu 17.04, had this error but it disappeared after I did make clean, ./autogen.sh, ./configure, make. It now builds correctly. I installed several dependencies after doing my initial ./autogen.sh, including libssl-dev. It seems like a different issue to kwlzn's above, but hopefully this solution works for some people.

I also can't find workaround to fix build problems. In my case I have this errors.

scm/watchman-Mercurial.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long)':
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
scm/watchman-Mercurial.o: In function `w_string::ensureNotNull() const':
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
scm/watchman-Mercurial.o: In function `watchman::Mercurial::mergeBaseWith(w_string_piece) const':
/home/kidnapkin/watchman/scm/Mercurial.cpp:110: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
scm/watchman-Mercurial.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long)':
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
scm/watchman-Mercurial.o: In function `watchman::Mercurial::mergeBaseWith(w_string_piece) const':
/home/kidnapkin/watchman/scm/Mercurial.cpp:116: undefined reference to `std::runtime_error::runtime_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
scm/watchman-Mercurial.o: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long)':
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
/usr/include/c++/5/bits/basic_string.h:754: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::resize(unsigned long, char)'
watchman-state.o: In function `std::thread::thread<void (&)()>(void (&)())':
/usr/include/c++/5/thread:137: undefined reference to `std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>, void (*)())'
watchman-string.o: In function `w_string::ensureNotNull() const':
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
watchman-string.o: In function `w_string_slice(watchman_string*, unsigned int, unsigned int)':
/home/kidnapkin/watchman/string.cpp:452: undefined reference to `std::range_error::range_error(char const*)'
watchman-string.o: In function `strlen_uint32(char const*)':
/home/kidnapkin/watchman/string.cpp:477: undefined reference to `std::range_error::range_error(char const*)'
watchman-string.o: In function `checked_len':
/home/kidnapkin/watchman/string.cpp:314: undefined reference to `std::range_error::range_error(char const*)'
watchman-string.o: In function `w_string::ensureNotNull() const':
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
watchman-string.o: In function `w_string::c_str() const':
/home/kidnapkin/watchman/string.cpp:366: undefined reference to `std::runtime_error::runtime_error(char const*)'
watchman-string.o: In function `w_string::ensureNotNull() const':
/home/kidnapkin/watchman/./watchman_string.h:356: undefined reference to `std::runtime_error::runtime_error(char const*)'
libwmanjson.a(libwmanjson_a-pack_unpack.o): In function `void std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*>(char const*, char const*, std::forward_iterator_tag)':
/usr/include/c++/5/bits/basic_string.tcc:223: undefined reference to `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_create(unsigned long&, unsigned long)'
libwmanjson.a(libwmanjson_a-value.o): In function `json_ref::object()':
/home/kidnapkin/watchman/thirdparty/jansson/value.cpp:86: undefined reference to `std::domain_error::domain_error(char const*)'
libwmanjson.a(libwmanjson_a-value.o): In function `json_ref::array()':
/home/kidnapkin/watchman/thirdparty/jansson/value.cpp:353: undefined reference to `std::domain_error::domain_error(char const*)'
libwmanjson.a(libwmanjson_a-value.o): In function `json_to_w_string(json_t const*)':
/home/kidnapkin/watchman/thirdparty/jansson/value.cpp:584: undefined reference to `std::runtime_error::runtime_error(char const*)'
libwmanjson.a(libwmanjson_a-value.o): In function `json_ref::get(char const*) const':
/home/kidnapkin/watchman/thirdparty/jansson/value.cpp:137: undefined reference to `std::domain_error::domain_error(char const*)'
/home/kidnapkin/watchman/thirdparty/jansson/value.cpp:143: undefined reference to `std::range_error::range_error(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
Makefile:1565: recipe for target 'watchman' failed
make[1]: *** [watchman] Error 1
make[1]: Leaving directory '/home/kidnapkin/watchman'
Makefile:1100: recipe for target 'all' failed
make: *** [all] Error 2

Any suggestions what can cause such problems?

I added -lcrypto -lssl to the end of my LIBS = line in my Makefile to get it to compile on a Debian based system.

can confirm @glodfinch method works if you ran './configure' without realizing it needs libssl-dev.

Compiling on Ubuntu 16.04 requires libtool m4 automake libssl-dev, before running autogen.sh

@forbesmyester looks like this is what I had to do

  • installed libssl-dev and libcrypto++-dev
  • then appended -lcrypto -lssl to the end of my LIBS =

This worked for both 16.04 and 18.04 Ubuntu

Was this page helpful?
0 / 5 - 0 ratings