Error compiling catapult with rocksdb

Hello I am trying to compiled an catapult and that error appears. I compile zstd, lz4, etc.

I install rockdb in this way

git clone https://github.com/lz4/lz4.git

cd lz4/

make

make install

git clone https://github.com/facebook/zstd.git

cd zstd/

make install

aptitude install libgflags-dev

wget -O rocksdb-5.13.1.tar.gz https://github.com/facebook/rocksdb/archive/v5.13.1.tar.gz

tar zxvf rocksdb-5.13.1.tar.gz

cd rocksdb-5.13.1

CFLAGS=-fPIC CXXFLAGS=-fPIC make shared_lib

make install

and the cmake with catapult

git clone https://github.com/nemtech/catapult-server

cd catapult-server/

mkdir _build

cd _build

export PYTHON_EXECUTABLE=/usr/bin/python3

export BOOST_ROOT=/usr/local/include/boost

export GTEST_ROOT=/usr/local/include/gtest

export LIBMONGOCXX_DIR=/usr/local/lib/cmake/libmongocxx-3.0.2

export LIBBSONCXX_DIR=/usr/local/lib/cmake/libbsoncxx-3.0.2

export cppzmq_DIR=/usr/local/share/cmake/cppzmq

export ROCKSDB_ROOT_DIR=/usr/local/include/rocksdb

export ZeroMQ_DIR=/usr/local/share/cmake/ZeroMQ

cmake -DCMAKE_BUILD_TYPE=RelWithDebugInfo \

-DCMAKE_C_FLAGS="-lpthread" \

-DCMAKE_MODULE_LINKER_FLAGS="-lpthread" \

-DCMAKE_SHARED_LINKER_FLAGS="-lpthread" \

-DBSONCXX_LIB=/usr/local/lib/libbsoncxx.so \

-DMONGOCXX_LIB=/usr/local/lib/libmongocxx.so \

…

make publish && make

this is the error

[ 27%] Linking CXX executable …/…/…/bin/tests.catapult.cache_db
/usr/bin/ld: /usr/local/lib/librocksdb.a(db_impl.o): in function rocksdb::DBImpl::DBImpl(rocksdb::DBOptions const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, bool)': /home/catapult/rocksdb-5.13.1/./util/compression.h:92: undefined reference toZSTD_versionNumber’
/usr/bin/ld: /usr/local/lib/librocksdb.a(column_family.o): in function rocksdb::CheckCompressionSupported(rocksdb::ColumnFamilyOptions const&)': /home/catapult/rocksdb-5.13.1/./util/compression.h:92: undefined reference toZSTD_versionNumber’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:92: undefined reference to ZSTD_versionNumber' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:92: undefined reference toZSTD_versionNumber’
/usr/bin/ld: /usr/local/lib/librocksdb.a(compaction_job.o): in function rocksdb::CompactionJob::ProcessKeyValueCompaction(rocksdb::CompactionJob::SubcompactionState*)': /home/catapult/rocksdb-5.13.1/./util/compression.h:828: undefined reference toZDICT_trainFromBuffer’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:831: undefined reference to ZDICT_isError' /usr/bin/ld: /usr/local/lib/librocksdb.a(options_helper.o): in functionrocksdb::GetSupportedCompressions()’:
/home/catapult/rocksdb-5.13.1/./util/compression.h:92: undefined reference to ZSTD_versionNumber' /usr/bin/ld: /usr/local/lib/librocksdb.a(format.o): in functionrocksdb::UncompressBlockContentsForCompressionType(char const*, unsigned long, rocksdb::BlockContents*, unsigned int, rocksdb::Slice const&, rocksdb::CompressionType, rocksdb::ImmutableCFOptions const&)’:
/home/catapult/rocksdb-5.13.1/./util/compression.h:804: undefined reference to ZSTD_createDCtx' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:805: undefined reference toZSTD_decompress_usingDict’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:808: undefined reference to ZSTD_freeDCtx' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:182: undefined reference tosnappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:326: undefined reference to inflateInit2_' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:334: undefined reference toinflateSetDictionary’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:352: undefined reference to inflate' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:386: undefined reference toinflateEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:626: undefined reference to LZ4_createStreamDecode' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:631: undefined reference toLZ4_decompress_safe_continue’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:634: undefined reference to LZ4_freeStreamDecode' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:477: undefined reference toBZ2_bzDecompressInit’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:492: undefined reference to BZ2_bzDecompress' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:524: undefined reference toBZ2_bzDecompressEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:626: undefined reference to LZ4_createStreamDecode' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:631: undefined reference toLZ4_decompress_safe_continue’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:634: undefined reference to LZ4_freeStreamDecode' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:516: undefined reference toBZ2_bzDecompressEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:191: undefined reference to snappy::RawUncompress(char const*, unsigned long, char*)' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:378: undefined reference toinflateEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:628: undefined reference to LZ4_setStreamDecode' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:628: undefined reference toLZ4_setStreamDecode’
/usr/bin/ld: /usr/local/lib/librocksdb.a(block_based_table_builder.o): in function rocksdb::CompressBlock(rocksdb::Slice const&, rocksdb::CompressionOptions const&, rocksdb::CompressionType*, unsigned int, rocksdb::Slice const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)': /home/catapult/rocksdb-5.13.1/./util/compression.h:251: undefined reference todeflateInit2_’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:259: undefined reference to deflateSetDictionary' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:277: undefined reference todeflate’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:263: undefined reference to deflateEnd' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:766: undefined reference toZSTD_compressBound’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:770: undefined reference to ZSTD_createCCtx' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:771: undefined reference toZSTD_compress_usingDict’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:774: undefined reference to ZSTD_freeCCtx' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:169: undefined reference tosnappy::MaxCompressedLength(unsigned long)’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:171: undefined reference to snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:421: undefined reference toBZ2_bzCompressInit’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:435: undefined reference to BZ2_bzCompress' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:444: undefined reference toBZ2_bzCompressEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:560: undefined reference to LZ4_compressBound' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:565: undefined reference toLZ4_createStream’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:571: undefined reference to LZ4_compress_fast_continue' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:579: undefined reference toLZ4_freeStream’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:681: undefined reference to LZ4_compressBound' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:686: undefined reference toLZ4_createStreamHC’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:687: undefined reference to LZ4_resetStreamHC' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:691: undefined reference toLZ4_loadDictHC’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:695: undefined reference to LZ4_compress_HC_continue' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:703: undefined reference toLZ4_freeStreamHC’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:444: undefined reference to BZ2_bzCompressEnd' /usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:286: undefined reference todeflateEnd’
/usr/bin/ld: /home/catapult/rocksdb-5.13.1/./util/compression.h:567: undefined reference to `LZ4_loadDict’
collect2: error: ld returned 1 exit status
make[2]: *** [tests/catapult/cache_db/CMakeFiles/tests.catapult.cache_db.dir/build.make:233: bin/tests.catapult.cache_db] Error 1
make[1]:

Thanks

2 Likes

What OS you use? I got it built and running in Ubuntu 16.04 and Ubuntu 18.04 using Makefile from here: https://github.com/wzulfikar/nem-catapult-ubuntu