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

Bug: can't build on Debian 12 with dynamic linking due to undefined reference to ZSTD_* #1001

Closed
ben-grande opened this issue Feb 3, 2024 · 18 comments · Fixed by #1014
Closed
Labels
bug Something isn't working

Comments

@ben-grande
Copy link
Contributor

Describe the bug

I can't build electrs dynamically linking to rocksdb available from Debian.

Electrs version
Which version of electrs do you use? Please try to use newest version if possible.
If it's not the newest version why you can't try the newest one?

Tag v0.10.2.

To Reproduce

Follow the install guide to install the dependencies:

sudo apt update
sudo apt install clang cmake build-essential cargo librocksdb-dev

Check the version of the installed dependencies:

$ apt list --installed cargo cmake clang build-essential librocksdb-dev libzstd-dev
Listing... Done
build-essential/stable,now 12.9 amd64 [installed]
cargo/stable,now 0.66.0+ds1-1 amd64 [installed]
clang/stable,now 1:14.0-55.7~deb12u1 amd64 [installed]
cmake/stable,now 3.25.1-1 amd64 [installed]
librocksdb-dev/stable,now 7.8.3-2 amd64 [installed]
libzstd-dev/stable,now 1.5.4+dfsg2-5 amd64 [installed]

Use rocksdb from Debian, not built from source.

Try to build dynamically linking to rocksdb on amd64:

$ ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --release --locked --no-default-features
   Compiling electrs v0.10.2 (/home/user/src/electrs)
error: linking with `cc` failed: exit status: 1
  |
  = note: "cc" "-m64" "/tmp/rustcmWJgyd/symbols.o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49.electrs.bda64cd0-cgu.0.rcgu.o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49.electrs.bda64cd0-cgu.1.rcgu.o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49.electrs.bda64cd0-cgu.2.rcgu.o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49.electrs.bda64cd0-cgu.3.rcgu.o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49.1xrl7w90q4un9cju.rcgu.o" "-Wl,--as-needed" "-L" "/home/user/src/electrs/target/release/deps" "-L" "/home/user/src/electrs/target/release/build/secp256k1-sys-9feb0213015c2d9b/out" "-L" "/usr/lib" "-L" "/home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out" "-L" "/home/user/src/electrs/target/release/build/zstd-sys-50b3e371843b6c83/out" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/home/user/src/electrs/target/release/deps/libelectrs-50fbf3c3daaadb66.rlib" "/home/user/src/electrs/target/release/deps/libenv_logger-af00cb7c55f4c487.rlib" "/home/user/src/electrs/target/release/deps/libtermcolor-7fc9415ba58c9791.rlib" "/home/user/src/electrs/target/release/deps/libis_terminal-a3ec62262b6dd91b.rlib" "/home/user/src/electrs/target/release/deps/librustix-f27e50d61884348e.rlib" "/home/user/src/electrs/target/release/deps/libbitflags-d8217462f8a3f83d.rlib" "/home/user/src/electrs/target/release/deps/liblinux_raw_sys-30d70957178d0616.rlib" "/home/user/src/electrs/target/release/deps/libhumantime-b53e8f79d3b532e5.rlib" "/home/user/src/electrs/target/release/deps/libregex-c9e6d0559ea9e7ec.rlib" "/home/user/src/electrs/target/release/deps/libregex_automata-9ecac564219e49ea.rlib" "/home/user/src/electrs/target/release/deps/libaho_corasick-a237934cbc3d70fb.rlib" "/home/user/src/electrs/target/release/deps/libmemchr-50bc2ce88dd40e2f.rlib" "/home/user/src/electrs/target/release/deps/libregex_syntax-6c2cb698b388ce44.rlib" "/home/user/src/electrs/target/release/deps/libsignal_hook-abfb33669e8bcb2c.rlib" "/home/user/src/electrs/target/release/deps/libsignal_hook_registry-476761afaeb2ba0f.rlib" "/home/user/src/electrs/target/release/deps/libbitcoin_slices-e0c2aef7f6ba5d87.rlib" "/home/user/src/electrs/target/release/deps/libsha2-9748ebbe31d44e18.rlib" "/home/user/src/electrs/target/release/deps/libcpufeatures-035ee40d8fd88e4b.rlib" "/home/user/src/electrs/target/release/deps/libdigest-e9fdd08d38c37d75.rlib" "/home/user/src/electrs/target/release/deps/libblock_buffer-e14ca4ab1fb40dc1.rlib" "/home/user/src/electrs/target/release/deps/libcrypto_common-d6b085dc630df57c.rlib" "/home/user/src/electrs/target/release/deps/libgeneric_array-8bb973377671d389.rlib" "/home/user/src/electrs/target/release/deps/libtypenum-12e7c4352b7f1f6b.rlib" "/home/user/src/electrs/target/release/deps/librayon-3ff006ddd3febbcf.rlib" "/home/user/src/electrs/target/release/deps/librayon_core-defc67fcefc72ebf.rlib" "/home/user/src/electrs/target/release/deps/libcrossbeam_deque-aeb2f4ae71149250.rlib" "/home/user/src/electrs/target/release/deps/libcrossbeam_epoch-29c2a2fc4021d56a.rlib" "/home/user/src/electrs/target/release/deps/libmemoffset-afa43c8a39c16636.rlib" "/home/user/src/electrs/target/release/deps/libeither-d0e02bae8773b5e7.rlib" "/home/user/src/electrs/target/release/deps/libelectrs_rocksdb-94989cb73cb69044.rlib" "/home/user/src/electrs/target/release/deps/libelectrs_librocksdb_sys-4f9926d476e7aa40.rlib" "/home/user/src/electrs/target/release/deps/libzstd_sys-15820ebdc0bd5f6a.rlib" "/home/user/src/electrs/target/release/deps/libcrossbeam_channel-76b1468b23c0617b.rlib" "/home/user/src/electrs/target/release/deps/libcrossbeam_utils-974b79e17f2f7375.rlib" "/home/user/src/electrs/target/release/deps/libdirs_next-e64f31b8bc2281bb.rlib" "/home/user/src/electrs/target/release/deps/libdirs_sys_next-981872e6d16aa20c.rlib" "/home/user/src/electrs/target/release/deps/libbitcoincore_rpc-f7bfa139657f1d01.rlib" "/home/user/src/electrs/target/release/deps/libbitcoincore_rpc_json-5d2a2fad4bba6be6.rlib" "/home/user/src/electrs/target/release/deps/libjsonrpc-2f237f878af8fdeb.rlib" "/home/user/src/electrs/target/release/deps/libbase64-2b93b7bde08e30ea.rlib" "/home/user/src/electrs/target/release/deps/libserde_json-790c4a93faa2ab40.rlib" "/home/user/src/electrs/target/release/deps/libryu-ae08aa4807fcf020.rlib" "/home/user/src/electrs/target/release/deps/libitoa-73b3b277c4124679.rlib" "/home/user/src/electrs/target/release/deps/libparking_lot-b4f73a71eeb4959d.rlib" "/home/user/src/electrs/target/release/deps/libparking_lot_core-0c8f28d82f2ba0f5.rlib" "/home/user/src/electrs/target/release/deps/libsmallvec-6280637caf89174e.rlib" "/home/user/src/electrs/target/release/deps/liblock_api-7986c11a1c760183.rlib" "/home/user/src/electrs/target/release/deps/libscopeguard-876b88b031e64a9f.rlib" "/home/user/src/electrs/target/release/deps/libbitcoin-38d313dbb53eaf7a.rlib" "/home/user/src/electrs/target/release/deps/libhex_lit-ec9eaf01856de9ab.rlib" "/home/user/src/electrs/target/release/deps/libbitcoin_internals-586228d1efc120a2.rlib" "/home/user/src/electrs/target/release/deps/libsecp256k1-ae4d3e595900068d.rlib" "/home/user/src/electrs/target/release/deps/librand-f7effedcd30201dc.rlib" "/home/user/src/electrs/target/release/deps/librand_chacha-262d6c4e50ef448b.rlib" "/home/user/src/electrs/target/release/deps/libppv_lite86-5dd1c82a483557ac.rlib" "/home/user/src/electrs/target/release/deps/librand_core-59d4c6b18ea44016.rlib" "/home/user/src/electrs/target/release/deps/libgetrandom-0c372f61f187d36e.rlib" "/home/user/src/electrs/target/release/deps/liblibc-f91dc48f9ee56c60.rlib" "/home/user/src/electrs/target/release/deps/libcfg_if-6cf9962cb4cd313b.rlib" "/home/user/src/electrs/target/release/deps/libsecp256k1_sys-217c3e3c28cfc6df.rlib" "/home/user/src/electrs/target/release/deps/libbitcoin_hashes-9bf68329680ac16a.rlib" "/home/user/src/electrs/target/release/deps/libhex_conservative-1b83e05829280c5c.rlib" "/home/user/src/electrs/target/release/deps/libbech32-e7e8d168d571fde3.rlib" "/home/user/src/electrs/target/release/deps/libconfigure_me-fdbd31832bba7da8.rlib" "/home/user/src/electrs/target/release/deps/libparse_arg-d8c2365a02b56db0.rlib" "/home/user/src/electrs/target/release/deps/libtoml-c7ee6ac3740d44e9.rlib" "/home/user/src/electrs/target/release/deps/libserde-8204de0b6a6ad12d.rlib" "/home/user/src/electrs/target/release/deps/liblog-6a8ddad80c5e1f08.rlib" "/home/user/src/electrs/target/release/deps/libanyhow-0f7a6c8649d87e56.rlib" "-Wl,--start-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-a5a48102fbd58791.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-f0e4c798e55eb654.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libobject-307baf4031e47837.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libmemchr-305ae9bf263d8a5c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libaddr2line-bfb90caaf028ee20.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgimli-2c6daf3a2deaba46.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-8cb2f9d159f6bf8c.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd_detect-b06d29abccadf228.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-498d89bc37e5de38.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libminiz_oxide-42b5e54fb481e115.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libadler-291cc4a48d040358.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-2062da69d643cc3e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-baae4a4ed2b00f9a.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-f5d328336c4924b8.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-0763527bd6f3ab8e.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-58cdb5243485a5f4.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-964226cfc9235464.rlib" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-2b149c462998d8e4.rlib" "-Wl,--end-group" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-efe39c76b5577058.rlib" "-Wl,-Bdynamic" "-lrocksdb" "-lstdc++" "-lgcc_s" "-lutil" "-lrt" "-lpthread" "-lm" "-ldl" "-lc" "-Wl,--eh-frame-hdr" "-Wl,-znoexecstack" "-L" "/usr/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-o" "/home/user/src/electrs/target/release/deps/electrs-fa49290caf98dd49" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro,-znow" "-Wl,-O1" "-nodefaultlibs"
  = note: /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/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, bool, bool)':
          db_impl.cc:(.text._ZN7rocksdb6DBImplC2ERKNS_9DBOptionsERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEbbb+0x1f3d): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_reader.o): in function `rocksdb::ZSTDStreamingUncompress::~ZSTDStreamingUncompress()':
          log_reader.cc:(.text._ZN7rocksdb23ZSTDStreamingUncompressD0Ev[_ZN7rocksdb23ZSTDStreamingUncompressD5Ev]+0x17): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_reader.o): in function `rocksdb::ZSTDStreamingUncompress::~ZSTDStreamingUncompress()':
          log_reader.cc:(.text._ZN7rocksdb23ZSTDStreamingUncompressD2Ev[_ZN7rocksdb23ZSTDStreamingUncompressD5Ev]+0x17): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_reader.o): in function `rocksdb::log::Reader::~Reader()':
          log_reader.cc:(.text._ZN7rocksdb3log6ReaderD2Ev+0x5e): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_writer.o): in function `rocksdb::ZSTDStreamingCompress::~ZSTDStreamingCompress()':
          log_writer.cc:(.text._ZN7rocksdb21ZSTDStreamingCompressD0Ev[_ZN7rocksdb21ZSTDStreamingCompressD5Ev]+0x17): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_writer.o): in function `rocksdb::ZSTDStreamingCompress::~ZSTDStreamingCompress()':
          log_writer.cc:(.text._ZN7rocksdb21ZSTDStreamingCompressD2Ev[_ZN7rocksdb21ZSTDStreamingCompressD5Ev]+0x17): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(log_writer.o): in function `rocksdb::log::Writer::~Writer()':
          log_writer.cc:(.text._ZN7rocksdb3log6WriterD2Ev+0x61): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_reader.o): in function `rocksdb::UncompressionContext::UncompressionContext(rocksdb::CompressionType)':
          block_based_table_reader.cc:(.text._ZN7rocksdb20UncompressionContextC2ENS_15CompressionTypeE[_ZN7rocksdb20UncompressionContextC5ENS_15CompressionTypeE]+0x71): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: block_based_table_reader.cc:(.text._ZN7rocksdb20UncompressionContextC2ENS_15CompressionTypeE[_ZN7rocksdb20UncompressionContextC5ENS_15CompressionTypeE]+0x8b): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_reader.o): in function `rocksdb::UncompressionContext::~UncompressionContext()':
          block_based_table_reader.cc:(.text._ZN7rocksdb20UncompressionContextD2Ev[_ZN7rocksdb20UncompressionContextD5Ev]+0x39): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_fetcher.o): in function `rocksdb::BlockFetcher::ReadBlockContents() [clone .cold]':
          block_fetcher.cc:(.text.unlikely._ZN7rocksdb12BlockFetcher17ReadBlockContentsEv+0x268): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_fetcher.o): in function `rocksdb::BlockFetcher::ReadBlockContents()':
          block_fetcher.cc:(.text._ZN7rocksdb12BlockFetcher17ReadBlockContentsEv+0x13f9): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_fetcher.o):block_fetcher.cc:(.text._ZN7rocksdb12BlockFetcher17ReadBlockContentsEv+0x1fcb): more undefined references to `ZSTD_freeDCtx' follow
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(format.o): in function `rocksdb::UncompressBlockData(rocksdb::UncompressionInfo const&, char const*, unsigned long, rocksdb::BlockContents*, unsigned int, rocksdb::ImmutableOptions const&, rocksdb::MemoryAllocator*)':
          format.cc:(.text._ZN7rocksdb19UncompressBlockDataERKNS_17UncompressionInfoEPKcmPNS_13BlockContentsEjRKNS_16ImmutableOptionsEPNS_15MemoryAllocatorE+0x1d8): undefined reference to `ZSTD_decompress_usingDict'
          /usr/bin/ld: format.cc:(.text._ZN7rocksdb19UncompressBlockDataERKNS_17UncompressionInfoEPKcmPNS_13BlockContentsEjRKNS_16ImmutableOptionsEPNS_15MemoryAllocatorE+0x342): undefined reference to `snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)'
          /usr/bin/ld: format.cc:(.text._ZN7rocksdb19UncompressBlockDataERKNS_17UncompressionInfoEPKcmPNS_13BlockContentsEjRKNS_16ImmutableOptionsEPNS_15MemoryAllocatorE+0x3b9): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: format.cc:(.text._ZN7rocksdb19UncompressBlockDataERKNS_17UncompressionInfoEPKcmPNS_13BlockContentsEjRKNS_16ImmutableOptionsEPNS_15MemoryAllocatorE+0x462): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'
          /usr/bin/ld: format.cc:(.text._ZN7rocksdb19UncompressBlockDataERKNS_17UncompressionInfoEPKcmPNS_13BlockContentsEjRKNS_16ImmutableOptionsEPNS_15MemoryAllocatorE+0x4ed): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::ZSTDStreamingCompress::Reset()':
          compression.cc:(.text._ZN7rocksdb21ZSTDStreamingCompress5ResetEv+0xe): undefined reference to `ZSTD_CCtx_reset'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::ZSTDStreamingUncompress::Reset()':
          compression.cc:(.text._ZN7rocksdb23ZSTDStreamingUncompress5ResetEv+0xe): undefined reference to `ZSTD_DCtx_reset'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::ZSTDStreamingUncompress::Uncompress(char const*, unsigned long, char*, unsigned long*)':
          compression.cc:(.text._ZN7rocksdb23ZSTDStreamingUncompress10UncompressEPKcmPcPm+0x52): undefined reference to `ZSTD_decompressStream'
          /usr/bin/ld: compression.cc:(.text._ZN7rocksdb23ZSTDStreamingUncompress10UncompressEPKcmPcPm+0x5a): undefined reference to `ZSTD_isError'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::ZSTDStreamingCompress::Compress(char const*, unsigned long, char*, unsigned long*)':
          compression.cc:(.text._ZN7rocksdb21ZSTDStreamingCompress8CompressEPKcmPcPm+0x65): undefined reference to `ZSTD_compressStream2'
          /usr/bin/ld: compression.cc:(.text._ZN7rocksdb21ZSTDStreamingCompress8CompressEPKcmPcPm+0x70): undefined reference to `ZSTD_isError'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::StreamingCompress::Create(rocksdb::CompressionType, rocksdb::CompressionOptions const&, unsigned int, unsigned long)':
          compression.cc:(.text._ZN7rocksdb17StreamingCompress6CreateENS_15CompressionTypeERKNS_18CompressionOptionsEjm+0x6c): undefined reference to `ZSTD_createCCtx'
          /usr/bin/ld: compression.cc:(.text._ZN7rocksdb17StreamingCompress6CreateENS_15CompressionTypeERKNS_18CompressionOptionsEjm+0x82): undefined reference to `ZSTD_CCtx_setParameter'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression.o): in function `rocksdb::StreamingUncompress::Create(rocksdb::CompressionType, unsigned int, unsigned long)':
          compression.cc:(.text._ZN7rocksdb19StreamingUncompress6CreateENS_15CompressionTypeEjm+0x46): undefined reference to `ZSTD_createDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression_context_cache.o): in function `rocksdb::CompressionContextCache::~CompressionContextCache()':
          compression_context_cache.cc:(.text._ZN7rocksdb23CompressionContextCacheD2Ev+0x4a): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression_context_cache.o): in function `rocksdb::CompressionContextCache::GetCachedZSTDUncompressData() [clone .cold]':
          compression_context_cache.cc:(.text.unlikely._ZN7rocksdb23CompressionContextCache27GetCachedZSTDUncompressDataEv+0x12): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression_context_cache.o): in function `rocksdb::CompressionContextCache::GetCachedZSTDUncompressData()':
          compression_context_cache.cc:(.text._ZN7rocksdb23CompressionContextCache27GetCachedZSTDUncompressDataEv+0x79): undefined reference to `ZSTD_createDCtx'
          /usr/bin/ld: compression_context_cache.cc:(.text._ZN7rocksdb23CompressionContextCache27GetCachedZSTDUncompressDataEv+0xd5): undefined reference to `ZSTD_createDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compression_context_cache.o): in function `rocksdb::CoreLocalArray<rocksdb::compression_cache::ZSTDCachedData>::CoreLocalArray()':
          compression_context_cache.cc:(.text._ZN7rocksdb14CoreLocalArrayINS_17compression_cache14ZSTDCachedDataEEC2Ev[_ZN7rocksdb14CoreLocalArrayINS_17compression_cache14ZSTDCachedDataEEC5Ev]+0xd9): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: compression_context_cache.cc:(.text._ZN7rocksdb14CoreLocalArrayINS_17compression_cache14ZSTDCachedDataEEC2Ev[_ZN7rocksdb14CoreLocalArrayINS_17compression_cache14ZSTDCachedDataEEC5Ev]+0x17c): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(column_family.o): in function `rocksdb::CheckCompressionSupported(rocksdb::ColumnFamilyOptions const&)':
          column_family.cc:(.text._ZN7rocksdb25CheckCompressionSupportedERKNS_19ColumnFamilyOptionsE+0x237): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: column_family.cc:(.text._ZN7rocksdb25CheckCompressionSupportedERKNS_19ColumnFamilyOptionsE+0x2a9): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: column_family.cc:(.text._ZN7rocksdb25CheckCompressionSupportedERKNS_19ColumnFamilyOptionsE+0x641): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: column_family.cc:(.text._ZN7rocksdb25CheckCompressionSupportedERKNS_19ColumnFamilyOptionsE+0x809): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: column_family.cc:(.text._ZN7rocksdb25CheckCompressionSupportedERKNS_19ColumnFamilyOptionsE+0x85c): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_builder.o): in function `rocksdb::CompressBlock(rocksdb::Slice const&, rocksdb::CompressionInfo const&, rocksdb::CompressionType*, unsigned int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) [clone .cold]':
          block_based_table_builder.cc:(.text.unlikely._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x9): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_builder.o): in function `rocksdb::CompressBlock(rocksdb::Slice const&, rocksdb::CompressionInfo const&, rocksdb::CompressionType*, unsigned int, bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*)':
          block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x7b): undefined reference to `snappy::MaxCompressedLength(unsigned long)'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x9b): undefined reference to `snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x14e): undefined reference to `snappy::MaxCompressedLength(unsigned long)'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x172): undefined reference to `snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x191): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x1a1): undefined reference to `ZSTD_versionNumber'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x294): undefined reference to `ZSTD_compressBound'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x2dc): undefined reference to `ZSTD_compress_usingCDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x31a): undefined reference to `ZSTD_compress_usingDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x344): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x3a9): undefined reference to `ZSTD_compressBound'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x408): undefined reference to `ZSTD_compress_usingCDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x43d): undefined reference to `ZSTD_compress_usingDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb13CompressBlockERKNS_5SliceERKNS_15CompressionInfoEPNS_15CompressionTypeEjbPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESE_SE_+0x4b3): undefined reference to `ZSTD_createCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_builder.o): in function `rocksdb::BlockBasedTableBuilder::Rep::~Rep()':
          block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepD2Ev[_ZN7rocksdb22BlockBasedTableBuilder3RepD5Ev]+0x1b0): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepD2Ev[_ZN7rocksdb22BlockBasedTableBuilder3RepD5Ev]+0x223): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepD2Ev[_ZN7rocksdb22BlockBasedTableBuilder3RepD5Ev]+0x271): undefined reference to `ZSTD_freeCDict'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_builder.o): in function `rocksdb::BlockBasedTableBuilder::Rep::Rep(rocksdb::BlockBasedTableOptions const&, rocksdb::TableBuilderOptions const&, rocksdb::WritableFileWriter*)':
          block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x1727): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x1784): undefined reference to `ZSTD_createCCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x1cd2): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x1d20): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x2515): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x257e): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x25c8): undefined reference to `ZSTD_freeCDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder3RepC2ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE[_ZN7rocksdb22BlockBasedTableBuilder3RepC5ERKNS_22BlockBasedTableOptionsERKNS_19TableBuilderOptionsEPNS_18WritableFileWriterE]+0x29e2): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(block_based_table_builder.o): in function `rocksdb::BlockBasedTableBuilder::EnterUnbuffered()':
          block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x381): undefined reference to `ZDICT_trainFromBuffer'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x38c): undefined reference to `ZDICT_isError'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x477): undefined reference to `ZSTD_freeCDict'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x16ef): undefined reference to `ZDICT_finalizeDictionary'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x16fe): undefined reference to `ZDICT_isError'
          /usr/bin/ld: block_based_table_builder.cc:(.text._ZN7rocksdb22BlockBasedTableBuilder15EnterUnbufferedEv+0x1857): undefined reference to `ZSTD_createCDict'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(blob_file_builder.o): in function `rocksdb::BlobFileBuilder::CompressBlobIfNeeded(rocksdb::Slice*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const [clone .cold]':
          blob_file_builder.cc:(.text.unlikely._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x12): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(blob_file_builder.o): in function `rocksdb::BlobFileBuilder::CompressBlobIfNeeded(rocksdb::Slice*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*) const':
          blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x265): undefined reference to `ZSTD_freeCCtx'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x271): undefined reference to `ZSTD_createCCtx'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x30d): undefined reference to `snappy::MaxCompressedLength(unsigned long)'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x337): undefined reference to `snappy::RawCompress(char const*, unsigned long, char*, unsigned long*)'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x404): undefined reference to `ZSTD_compressBound'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x452): undefined reference to `ZSTD_compress_usingCDict'
          /usr/bin/ld: blob_file_builder.cc:(.text._ZNK7rocksdb15BlobFileBuilder20CompressBlobIfNeededEPNS_5SliceEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE+0x48d): undefined reference to `ZSTD_compress_usingDict'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(blob_file_reader.o): in function `rocksdb::BlobFileReader::UncompressBlobIfNeeded(rocksdb::Slice const&, rocksdb::CompressionType, rocksdb::MemoryAllocator*, rocksdb::SystemClock*, rocksdb::Statistics*, std::unique_ptr<rocksdb::BlobContents, std::default_delete<rocksdb::BlobContents> >*) [clone .cold]':
          blob_file_reader.cc:(.text.unlikely._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0xa2): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(blob_file_reader.o): in function `rocksdb::BlobFileReader::UncompressBlobIfNeeded(rocksdb::Slice const&, rocksdb::CompressionType, rocksdb::MemoryAllocator*, rocksdb::SystemClock*, rocksdb::Statistics*, std::unique_ptr<rocksdb::BlobContents, std::default_delete<rocksdb::BlobContents> >*)':
          blob_file_reader.cc:(.text._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0x541): undefined reference to `ZSTD_freeDCtx'
          /usr/bin/ld: blob_file_reader.cc:(.text._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0x7b9): undefined reference to `ZSTD_decompress_usingDict'
          /usr/bin/ld: blob_file_reader.cc:(.text._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0x819): undefined reference to `snappy::GetUncompressedLength(char const*, unsigned long, unsigned long*)'
          /usr/bin/ld: blob_file_reader.cc:(.text._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0x853): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'
          /usr/bin/ld: blob_file_reader.cc:(.text._ZN7rocksdb14BlobFileReader22UncompressBlobIfNeededERKNS_5SliceENS_15CompressionTypeEPNS_15MemoryAllocatorEPNS_11SystemClockEPNS_10StatisticsEPSt10unique_ptrINS_12BlobContentsESt14default_deleteISC_EE+0x92d): undefined reference to `snappy::RawUncompress(char const*, unsigned long, char*)'
          /usr/bin/ld: /home/user/src/electrs/target/release/build/electrs-librocksdb-sys-d1c1260be954374a/out/librocksdb.a(compressed_secondary_cache.o): in function `rocksdb::CompressionDict::~CompressionDict()':
          compressed_secondary_cache.cc:(.text._ZN7rocksdb15CompressionDictD2Ev[_ZN7rocksdb15CompressionDictD5Ev]+0xd): undefined reference to `ZSTD_freeCDict'
          collect2: error: ld returned 1 exit status
          
  = help: some `extern` functions couldn't be found; some native libraries may need to be installed or have their path specified
  = note: use the `-l` flag to specify native libraries to link
  = note: use the `cargo:rustc-link-lib` directive to specify the native libraries to link with Cargo (see https://doc.rust-lang.org/cargo/reference/build-scripts.html#cargorustc-link-libkindname)

error: could not compile `electrs` due to previous error

Expected behavior

Build succeeds.

System running electrs

Qubes R4.2, Debian 12 Template.

Additional context

Statically linking works.

@ben-grande ben-grande added the bug Something isn't working label Feb 3, 2024
@ben-grande ben-grande changed the title Bug: can't build on Debian 12 with dynamic linking due to undefined reference to ZSTD_*` Bug: can't build on Debian 12 with dynamic linking due to undefined reference to ZSTD_* Feb 3, 2024
@Kixunil
Copy link
Contributor

Kixunil commented Feb 4, 2024

That's weird, it did work on my machine the last time I tried. And I also have Qubes, so the system should be practically identical. But looks like I built 0.10.0. Could you try to build that one?

@ben-grande
Copy link
Contributor Author

Thanks for the reply!

Tag v0.10.0 works:

[user@sys-electrs ~/src/electrs(v0.10.0)]
$ ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --release --locked --no-default-features
   ...
   Compiling electrs v0.10.0 (/home/user/src/electrs)
   ...
    Finished release [optimized] target(s) in 8m 03s

Tag v0.10.1 also works:

[user@sys-electrs ~/src/electrs(v0.10.1)]
$ ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --release --locked --no-default-features
   ...
   Compiling electrs v0.10.1 (/home/user/src/electrs)
   ...
    Finished release [optimized] target(s) in 8m 37s

Tried v0.10.2 again, same error as in the original post.

@Kixunil
Copy link
Contributor

Kixunil commented Feb 5, 2024

Can you run git bisect on it? I don't see anything suspicious in the log.

@ben-grande
Copy link
Contributor Author

Per the bisect logs below, it is b2760f3 the first bad commit.

Ran:

$ echo "#!/bin/sh
ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib \
  cargo build --release --locked --no-default-features" | tee /tmp/build-electrs.sh
$ chmod +x /tmp/build-electrs.sh
$ git bisect start v0.10.2 v0.10.1
$ git bisect run /tmp/build-electrs.sh
...

Bisecting: 0 revisions left to test after this (roughly 1 step)
[fd5e56a7ac5375f59094d40c5cd4077f942c70fb] Bump crossbeam-channel from 0.5.9 to 0.5.10 (#982)
running  '/tmp/build-electrs.sh'
   Compiling electrs v0.10.1 (/home/user/src/electrs)
error: linking with `cc` failed: exit status: 1
...
error: could not compile `electrs` due to previous error

Bisecting: 0 revisions left to test after this (roughly 0 steps)
[b2760f37ace4d8bb350c8575c6820c66a1c319c7] Update dependencies (#980)
running  '/tmp/build-electrs.sh'
   Compiling crossbeam-epoch v0.9.16
   Compiling crossbeam-deque v0.8.4
   Compiling rayon-core v1.12.0
   Compiling rayon v1.8.0
   Compiling electrs v0.10.1 (/home/user/src/electrs)
error: linking with `cc` failed: exit status: 1
...
error: could not compile `electrs` due to previous error

b2760f37ace4d8bb350c8575c6820c66a1c319c7 is the first bad commit
commit b2760f37ace4d8bb350c8575c6820c66a1c319c7
Author: Roman Zeyde <me@romanzey.de>
Date:   Sun Dec 24 14:50:07 2023 +0200

    Update dependencies (#980)

    Some of the crates don't compile on current MSRV (1.63.0).

    They need to be kept back with:

     cargo update -p regex --precise 1.9.6
     cargo update -p zstd-sys --precise 2.0.8+zstd.1.5.5
     cargo update -p jobserver --precise 0.1.26

 Cargo.lock | 339 +++++++++++++++++++++++++++++++++++--------------------------
 1 file changed, 193 insertions(+), 146 deletions(-)
bisect found first bad commit%
$ git bisect log
git bisect start
# status: waiting for both good and bad commits
# bad: [84c9a79cacc3cfb0131a75bd1d85f9bad27e6b45] Bump version
git bisect bad 84c9a79cacc3cfb0131a75bd1d85f9bad27e6b45
# status: waiting for good commit(s), bad commit known
# good: [7868c4813c96b9932fa1398e8c9bb3c505b4451f] Bump version
git bisect good 7868c4813c96b9932fa1398e8c9bb3c505b4451f
# good: [b24fcae18651ec1a8597cd024ac3e0226ba72f9d] Improve config documentation (#963)
git bisect good b24fcae18651ec1a8597cd024ac3e0226ba72f9d
# good: [db46643df19ba77a31d733140371e0f62005006d] Remove Mempool::new and Mempool::empty (#972)
git bisect good db46643df19ba77a31d733140371e0f62005006d
# good: [ab12ce784d7605b2ea134a4fb9e6d1a8109a0389] Use batched RPC to fetch mempool entries & transactions
git bisect good ab12ce784d7605b2ea134a4fb9e6d1a8109a0389
# bad: [fd5e56a7ac5375f59094d40c5cd4077f942c70fb] Bump crossbeam-channel from 0.5.9 to 0.5.10 (#982)
git bisect bad fd5e56a7ac5375f59094d40c5cd4077f942c70fb
# bad: [b2760f37ace4d8bb350c8575c6820c66a1c319c7] Update dependencies (#980)
git bisect bad b2760f37ace4d8bb350c8575c6820c66a1c319c7
# first bad commit: [b2760f37ace4d8bb350c8575c6820c66a1c319c7] Update dependencies (#980)

@ben-grande
Copy link
Contributor Author

Just as a test, I did checkout the latest revision.

Commits IDs for reference:

GOOD: 0eec28e doc: fix typos (#999)
GOOD: 6cf431e Bump shlex from 1.2.0 to 1.3.0 (#995)
BAD: d4835bb Bump crossbeam-channel from 0.5.10 to 0.5.11 (#989)
BAD: aafe2da Bump bitcoin from 0.31.0 to 0.31.1 (#991)
BAD: 83dbcdd Bump rayon from 1.8.0 to 1.8.1 (#993)
BAD: 9719e0c Bump env_logger from 0.10.1 to 0.10.2 (#994)
BAD: f1be85f Bump tempfile from 3.8.1 to 3.9.0 (#986)
BAD: 86879f0 Bump serde_json from 1.0.108 to 1.0.109 (#987)
BAD: 84c9a79 Bump version
BAD: fd5e56a Bump crossbeam-channel from 0.5.9 to 0.5.10 (#982)
BAD: b2760f3 Update dependencies (#980)
GOOD: ab12ce7 Use batched RPC to fetch mempool entries & transactions
$ git checkout 6cf431e
Previous HEAD position was f1be85f Bump tempfile from 3.8.1 to 3.9.0 (#986)
HEAD is now at 6cf431e Bump shlex from 1.2.0 to 1.3.0 (#995)
[user@sys-electrs ~/src/electrs(6cf431e)]
$ /tmp/build-electrs.sh
    Finished release [optimized] target(s) in 0.13s

@ben-grande
Copy link
Contributor Author

What the first bad commit b2760f3 and the recent good commit 6cf431e have in common is shlex.

GOOD: ab12ce7: shlex 1.1.0
BAD:  b2760f3: shlex 1.2.0
GOOD: 6cf431e: shlex 1.3.0

The electrs tag v1.10.2 is using shlex 1.2.0 which doesn't build and is vulnerable.

Can you please bump the electrs version so I can checkout a newer tag instead of a commit?

@Kixunil
Copy link
Contributor

Kixunil commented Feb 5, 2024

What the hell, how can shlex cause zstd not building?!

@Kixunil
Copy link
Contributor

Kixunil commented Feb 5, 2024

bindgen depends on it so it gets messed up somehow. FYI the vulnerability is non-issue because it's a build dependency.

@Kixunil
Copy link
Contributor

Kixunil commented Feb 5, 2024

It's used for parsing the BINDGEN_EXTRA_CLANG_ARGS environment variable so it must have something to do with it. I'm going AFK soon so can't look into it more.

@ben-grande
Copy link
Contributor Author

bindgen depends on it so it gets messed up somehow. FYI the vulnerability is non-issue because it's a build dependency.

Thanks for the information.

If I can do more tests to narrow down, please let me know. I understood what you said about command parsing but I'm not familiar with Rust to debug this issue more deeply.

@Kixunil
Copy link
Contributor

Kixunil commented Feb 6, 2024

Oh, I noticed master updated the dependency. Could you try building it?

@ben-grande
Copy link
Contributor Author

The electrs master? I built from it: #1001 (comment)

Commit 6cf431e with shlex 1.3.0 fixes the issue.

@Kixunil
Copy link
Contributor

Kixunil commented Feb 6, 2024

Ah, cool, so releasing a new version should be enough @romanz

@romanz romanz mentioned this issue Feb 10, 2024
@romanz
Copy link
Owner

romanz commented Feb 10, 2024

https://crates.io/crates/electrs/0.10.3 is released.

@ben-grande
Copy link
Contributor Author

# /home/user/build-electrs.sh
ROCKSDB_INCLUDE_DIR=/usr/include ROCKSDB_LIB_DIR=/usr/lib cargo build --locked --release --no-default-features

Thank you very much. At first, v0.10.3 failed, I did cargo clean and then reran and the build succeeded. Without cargo clean, it was failing at the same zstd problem.

[user@sys-electrs ~/src/electrs(v0.10.3)]
$ /home/user/build-electrs.sh
    ...
    Finished release [optimized] target(s) in 10m 22s

I decided to give v0.10.2 another shot, it has been successfully built:

[user@sys-electrs ~/src/electrs(v0.10.2)]
$ /home/user/build-electrs.sh
   ...
    Finished release [optimized] target(s) in 3m 14s

So, I did in the following order builds for v0.10.2:

  1. cargo clean
  2. dynamic build worked
  3. static build worked
  4. dynamic build FAILED

So at that moment I as unsure if v0.10.2 is really broken or it is an error of not clearing the build artifacts.

After the dynamic build failed, I did cargo clean and built dynamically again and succeeded with v0.10.2.

So I decided to do the same with v0.10.3

  1. cargo clean
  2. dynamic build worked
  3. static build worked
  4. dynamic build FAILED
  5. cargo clean
  6. dynamic build worked

I think the errors are reproducible this way, if you have a Debian 12 machine you can try.

After all, it is a lack of cleaning, mistake on my part. Can cleaning be documented in the install guide? It was probably a silly mistake to not clean the directory, but I didn't think of doing it until I did make clean on a project and thought that cargo might have a cleaning command also.

@Kixunil
Copy link
Contributor

Kixunil commented Feb 12, 2024

Oh, my guess is build.rs of rocksdb doesn't emit rerun-if-env-changed. I'm not sure if I'll have time to confirm it but I do think this is a bug and not your fault.

@romanz
Copy link
Owner

romanz commented Mar 2, 2024

@ben-grande Many thanks for the detailed analysis of this issue!

Can cleaning be documented in the install guide?

Sure! Could you please open a PR?

ben-grande added a commit to ben-grande/electrs that referenced this issue Mar 3, 2024
ben-grande added a commit to ben-grande/electrs that referenced this issue Mar 4, 2024
romanz pushed a commit that referenced this issue Mar 8, 2024
@ben-grande
Copy link
Contributor Author

@Kixunil

And I also have Qubes

I did a Qubes OS Saltstack formula for Electrs. @romanz Is it okay for me to share some info about my project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants