Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build error 'LZ4_compress_fast_continue' was not declared in this scope #149

Closed
fibigerg opened this issue Aug 27, 2016 · 4 comments
Closed

Comments

@fibigerg
Copy link

Hi, I am trying to build latest master on Debian 8, but I am getting this error. Thanks for help!

make
make  all-recursive
make[1]: Entering directory '/root/mcrouter-master/mcrouter'
Making all in lib
make[2]: Entering directory '/root/mcrouter-master/mcrouter/lib'
Making all in .
make[3]: Entering directory '/root/mcrouter-master/mcrouter/lib'
g++ -DHAVE_CONFIG_H   -I../..   -DLIBMC_FBTRACE_DISABLE  -Wno-missing-field-initializers -Wno-deprecated -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -g -O2 -std=gnu++1y -MT libmcrouter_a-Lz4CompressionCodec.o -MD -MP -MF .deps/libmcrouter_a-Lz4CompressionCodec.Tpo -c -o libmcrouter_a-Lz4CompressionCodec.o `test -f 'Lz4CompressionCodec.cpp' || echo './'`Lz4CompressionCodec.cpp
Lz4CompressionCodec.cpp: In constructor 'facebook::memcache::Lz4CompressionCodec::Lz4CompressionCodec(std::unique_ptr<folly::IOBuf>, uint32_t, facebook::memcache::FilteringOptions, uint32_t)':
Lz4CompressionCodec.cpp:36:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if (res != dictionary_->length()) {
           ^
Lz4CompressionCodec.cpp: In member function 'virtual std::unique_ptr<folly::IOBuf> facebook::memcache::Lz4CompressionCodec::compress(const iovec*, size_t)':
Lz4CompressionCodec.cpp:61:8: error: 'LZ4_compress_fast_continue' was not declared in this scope
       1);
        ^
In file included from /usr/include/c++/4.9/cassert:43:0,
                 from /usr/local/include/folly/io/IOBuf.h:21,
                 from ../../mcrouter/lib/IOBufUtil.h:15,
                 from Lz4CompressionCodec.h:17,
                 from Lz4CompressionCodec.cpp:10:
Lz4CompressionCodec.cpp: In member function 'virtual std::unique_ptr<folly::IOBuf> facebook::memcache::Lz4CompressionCodec::uncompress(const iovec*, size_t, size_t)':
Lz4CompressionCodec.cpp:90:44: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   assert(bytesWritten <= 0 || bytesWritten == uncompressedLength);
                                            ^
Makefile:1171: recipe for target 'libmcrouter_a-Lz4CompressionCodec.o' failed
make[3]: *** [libmcrouter_a-Lz4CompressionCodec.o] Error 1
make[3]: Leaving directory '/root/mcrouter-master/mcrouter/lib'
Makefile:1810: recipe for target 'all-recursive' failed
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory '/root/mcrouter-master/mcrouter/lib'
Makefile:2074: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/root/mcrouter-master/mcrouter'
Makefile:681: recipe for target 'all' failed
make: *** [all] Error 2
@fibigerg
Copy link
Author

Anyone? Thanks

@jmswen
Copy link
Member

jmswen commented Aug 29, 2016

Hi @fibigerg, which version of liblz4 do you have installed? The error seems to indicate that LZ4_compress_fast_continue is not declared in the lz4.h header, which may be because your header file is too old. It looks like LZ4_compress_fast_continue was added around May 2015: lz4/lz4@1b17bf2

@TiagoTT
Copy link

TiagoTT commented Sep 1, 2016

I am also trying to build mcrouter on Debian 8 and hit this same problem.
The version of liblz4 shipped with Debian 8 is r122 (0.0~r122-2), which does not have LZ4_compress_fast_continue.

I have fetched the source lz4 package from Debian 9 (testing) and built it on Debian 8. In short:

apt-get install dpkg-dev debhelper
echo "deb-src http://ftp.de.debian.org/debian/ stretch main" > /etc/apt/sources.list.d/stretch-source-packages.list
apt-get update
apt-get source lz4=0.0~r131-2
cd lz4-0.0~r131
dpkg-buildpackage -rfakeroot -uc -b
cd ..
dpkg -i liblz4-1_0.0~r131-2_amd64.deb liblz4-dev_0.0~r131-2_amd64.deb

So I have now the Debian package liblz4-1 version 0.0~r131-2, which packs the version r131, which is pretty recent and has LZ4_compress_fast_continue.

Then I hit a different problem compiling mcrouter, also related to liblz4 LZ4_freeStream:

/bin/bash ../../libtool  --tag=CXX   --mode=link g++  -DLIBMC_FBTRACE_DISABLE  -Wno-missing-field-initializers -Wno-deprecated -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -g -O2 -std=gnu++1y   -o mock_mc_server test/mock_mc_server-MockMc.o test/mock_mc_server-MockMcServer.o ../../lib/libmcrouter.a -lwangle -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 -pthread
libtool: link: g++ -DLIBMC_FBTRACE_DISABLE -Wno-missing-field-initializers -Wno-deprecated -W -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -g -O2 -std=gnu++1y -o mock_mc_server test/mock_mc_server-MockMc.o test/mock_mc_server-MockMcServer.o -pthread  ../../lib/libmcrouter.a -lwangle -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 -pthread
/usr/bin/ld: ../../lib/libmcrouter.a(libmcrouter_a-Lz4CompressionCodec.o): undefined reference to symbol 'LZ4_freeStream'
//usr/lib/x86_64-linux-gnu/liblz4.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Makefile:473: recipe for target 'mock_mc_server' failed

So it seems that the flag -llz4 was missing in the linker command line.

Because I did not know exactly where liblz4 was necessary, I added -llz4 to the LIBS list in all the Makefiles in a quick and dirty way:

find . -name Makefile | xargs -L1 sed -i "s/-lz -lssl/-lz -llz4 -lssl/"

@fibigerg
Copy link
Author

fibigerg commented Sep 7, 2016

Thank you @TiagoTT! I had to tweak ./install_ubuntu_15.04.sh script. It's finally working now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants