From 727eb881a56d75299cb180199a74673041c8d3c8 Mon Sep 17 00:00:00 2001 From: Jacquin Mininger Date: Wed, 30 May 2018 17:45:02 -0700 Subject: [PATCH] Compile error in db bench tool Summary: Small format error below causes build to fail. I believe that this : ``` fprintf(stderr, "num reads to do %lu\n", reads_); ``` Can be changed to this: ``` fprintf(stderr, "num reads to do %" PRIu64 "\n", reads_); ``` Successful build ``` CC utilities/blob_db/blob_dump_tool.o AR librocksdb_debug.a ar: creating archive librocksdb_debug.a /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: file: librocksdb_debug.a(rocks_lua_compaction_filter.o) has no symbols CC tools/db_bench.o CC tools/db_bench_tool.o tools/db_bench_tool.cc:4532:46: error: format specifies type 'unsigned long' but the argument has type 'int64_t' (aka 'long long') [-Werror,-Wformat] fprintf(stderr, "num reads to do %lu\n", reads_); ~~~ ^~~~~~ %lld 1 error generated. make: *** [tools/db_bench_tool.o] Error 1 ``` ``` $ cd rocksdb $ make all $ g++ --version Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1 Apple LLVM version 9.1.0 (clang-902.0.39.1) Target: x86_64-apple-darwin17.5.0 Thread model: posix InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin ``` Closes https://github.com/facebook/rocksdb/pull/3909 Differential Revision: D8215710 Pulled By: siying fbshipit-source-id: 15e49fb02a818fec846e9f9b2a50e372b6b67751 --- tools/db_bench_tool.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index 0b73d834c..79a06b4fe 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -4529,7 +4529,7 @@ void VerifyDBFromDB(std::string& truth_db_name) { ReadOptions read_options; Iterator* iter = db_.db->NewIterator(read_options); - fprintf(stderr, "num reads to do %lu\n", reads_); + fprintf(stderr, "num reads to do %" PRIu64 "\n", reads_); Duration duration(FLAGS_duration, reads_); uint64_t num_seek_to_first = 0; uint64_t num_next = 0;