facebook/mcrouter

Unable to Build mcrouter Unit Tests on Ubuntu 16.04

redwolf3 opened this issue · 2 comments

I have been trying to develop a couple of changes for mcrouter and want to add proper unit tests as part of that effort. As a starting point I am trying to run the existing unit tests but I keep getting failures while building the unit tests.

Operating System: Ubuntu 16.04
Branch Tags Tested So Far:

  • release-40-0
  • release-39-0

Error:

make  mcrouter_network_test
make[5]: Entering directory '/home/stack/mcrouter/mcrouter/lib/network/test'
/bin/bash ../../../libtool  --tag=CXX   --mode=link g++ -std=gnu++14  -DLIBMC_FBTRACE_DISABLE -DDISABLE_COMPRESSION  -Wno-missing-field-initializers -Wno-deprecated -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -g -O2  -L/home/stack/mcrouter-install/install/lib -ljemalloc  -o mcrouter_network_test mcrouter_network_test-AccessPointTest.o mcrouter_network_test-AsyncMcClientTestSync.o mcrouter_network_test-CarbonMessageDispatcherTest.o mcrouter_network_test-CarbonMockMcTest.o mcrouter_network_test-CarbonQueueAppenderTest.o gen/mcrouter_network_test-CarbonTestMessages.o mcrouter_network_test-McAsciiParserTest.o mcrouter_network_test-McServerAsciiParserTest.o mcrouter_network_test-MockMc.o mcrouter_network_test-MockMcServer.o mcrouter_network_test-SessionTest.o mcrouter_network_test-SessionTestHarness.o mcrouter_network_test-TestClientServerUtil.o mcrouter_network_test-TestMcAsciiParserUtil.o ../../../lib/libmcrouter.a ../../../lib/libtestmain.la ../../../lib/network/libtest_util.a -lwangle -lfizz -lsodium -lfolly -lfizz -lsodium -lfolly -ldl -ldouble-conversion -lz -lssl -lcrypto -levent -lgflags -lglog  -L/usr/lib/x86_64-linux-gnu -lboost_context -lboost_filesystem       -lboost_program_options -lboost_system -lboost_regex       -lboost_thread -lpthread -pthread -ldl -lunwind
libtool: link: g++ -std=gnu++14 -DLIBMC_FBTRACE_DISABLE -DDISABLE_COMPRESSION -Wno-missing-field-initializers -Wno-deprecated -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -g -O2 -o mcrouter_network_test mcrouter_network_test-AccessPointTest.o mcrouter_network_test-AsyncMcClientTestSync.o mcrouter_network_test-CarbonMessageDispatcherTest.o mcrouter_network_test-CarbonMockMcTest.o mcrouter_network_test-CarbonQueueAppenderTest.o gen/mcrouter_network_test-CarbonTestMessages.o mcrouter_network_test-McAsciiParserTest.o mcrouter_network_test-McServerAsciiParserTest.o mcrouter_network_test-MockMc.o mcrouter_network_test-MockMcServer.o mcrouter_network_test-SessionTest.o mcrouter_network_test-SessionTestHarness.o mcrouter_network_test-TestClientServerUtil.o mcrouter_network_test-TestMcAsciiParserUtil.o -pthread  -L/home/stack/mcrouter-install/install/lib ../../../lib/libmcrouter.a ../../../lib/.libs/libtestmain.a -ljemalloc ../../../lib/network/libtest_util.a -lwangle -lfizz -lsodium -lfolly -ldouble-conversion -lz -lssl -lcrypto -levent -lgflags -lglog -L/usr/lib/x86_64-linux-gnu -lboost_context -lboost_filesystem -lboost_program_options -lboost_system -lboost_regex -lboost_thread -lpthread -ldl -lunwind -pthread
mcrouter_network_test-AsyncMcClientTestSync.o: In function `apache::thrift::CompactProtocolWriter::writeBinary(folly::IOBuf const&)':
/home/stack/mcrouter-install/install/include/thrift/lib/cpp2/protocol/CompactProtocol.tcc:319: undefined reference to `apache::thrift::protocol::TProtocolException::throwExceededSizeLimit()'
mcrouter_network_test-TestClientServerUtil.o: In function `apache::thrift::CompactProtocolWriter::writeBinary(folly::IOBuf const&)':
/home/stack/mcrouter-install/install/include/thrift/lib/cpp2/protocol/CompactProtocol.tcc:319: undefined reference to `apache::thrift::protocol::TProtocolException::throwExceededSizeLimit()'
collect2: error: ld returned 1 exit status
Makefile:447: recipe for target 'mcrouter_network_test' failed
make[5]: *** [mcrouter_network_test] Error 1
make[5]: Leaving directory '/home/stack/mcrouter/mcrouter/lib/network/test'

Steps to reproduce:

  1. Build Mcrouter from source
  2. cd mcrouter/mcrounter
  3. Run make check

I haven't been able to determine whether or not these unit tests are running as part of the normal CI process.

Does anyone have any ideas what might be causing these failures?

@sergmour I see that you were able to add unit tests under a recent PR. Did you run into any issues running the mcrouter unit tests?

I think I found the source of the issue - it appears that a combination of one or more library references were not added to several of the test related Makefile.am files.

In release-40-0 I found that I had to modify the following Makefile.am files to get the unit test builds passing:

  • mcrouter/lib/network/test/Makefile.am
  • mcrouter/routes/test/Makefile.am
  • mcrouter/test/cpp_unit_tests/Makefile.am

Adding the following libraries to the prog_LDADD fixed the issue:

  • -lthrift
  • -lthriftprotocol
  • -lprotocol

I still need to go back and find the minimal set of changes for each group of tests to address the build failures.

If someone else can confirm that they are seeing the same issue I will issue a PR with the changes to fix them.