facebook / rocksdb

A library that provides an embeddable, persistent key-value store for fast storage.
http://rocksdb.org
GNU General Public License v2.0
28.47k stars 6.3k forks source link

make static_build results in error #11225

Closed fonty422 closed 1 year ago

fonty422 commented 1 year ago

Expected behavior

Follow the instructions in CMakeList.txt and INSTALL.md and be able to run make static_lib without errors

Actual behavior

running make static_lib returns make: *** No rule to make target 'static_lib'. Stop. error Also, simply running the 'make' command resulted in an error:

[ 32%] Building CXX object CMakeFiles/cache_bench.dir/cache/cache_bench_tool.cc.o
/home/ics/rocksdb/cache/cache_bench_tool.cc: In member function ‘void rocksdb::CacheBench::PrintEnv() const’:
/home/ics/rocksdb/cache/cache_bench_tool.cc:615:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Number of threads   : %u\n", FLAGS_threads);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:619:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Num shard bits      : %u\n", FLAGS_num_shard_bits);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:622:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Skew degree         : %u\n", FLAGS_skew);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:624:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Lookup+Insert pct   : %u%%\n", FLAGS_lookup_insert_percent);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:625:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Insert percentage   : %u%%\n", FLAGS_insert_percent);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:626:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Lookup percentage   : %u%%\n", FLAGS_lookup_percent);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:627:12: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 2 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
     printf("Erase percentage    : %u%%\n", FLAGS_erase_percent);
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc: In member function ‘void rocksdb::StressCacheKey::Run()’:
/home/ics/rocksdb/cache/cache_bench_tool.cc:719:28: error: use of deleted function ‘std::reference_wrapper<_Tp>::reference_wrapper(_Tp&&) [with _Tp = unsigned int]’
       FLAGS_sck_db_count = 1;
                            ^
In file included from /usr/include/c++/8/bits/shared_ptr_base.h:54,
                 from /usr/include/c++/8/bits/shared_ptr.h:52,
                 from /usr/include/c++/8/memory:81,
                 from /home/ics/rocksdb/include/rocksdb/table_properties.h:10,
                 from /home/ics/rocksdb/include/rocksdb/unique_id.h:8,
                 from /home/ics/rocksdb/table/unique_id_impl.h:10,
                 from /home/ics/rocksdb/cache/cache_key.h:12,
                 from /home/ics/rocksdb/cache/cache_bench_tool.cc:6:
/usr/include/c++/8/bits/refwrap.h:301:7: note: declared here
       reference_wrapper(_Tp&&) = delete;
       ^~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:765:13: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 3 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
             "No collisions after %d x %u days                              "
             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             "                   \n",
             ~~~~~~~~~~~~~~~~~~~~~~~
             i, FLAGS_sck_days_per_run);
                ~~~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc:770:16: error: format ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘std::reference_wrapper<unsigned int>’ [-Werror=format=]
         printf("%" PRIu64
                ^~~~~~~~~~
                " collisions after %d x %u days, est %g days between (%g "
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                "corrected)        \n",
                ~~~~~~~~~~~~~~~~~~~~~~
                collisions_, i, FLAGS_sck_days_per_run, est, est * multiplier_);
                                ~~~~~~~~~~~~~~~~~~~~~~
/home/ics/rocksdb/cache/cache_bench_tool.cc: In member function ‘void rocksdb::StressCacheKey::RunOnce()’:
/home/ics/rocksdb/cache/cache_bench_tool.cc:785:29: error: use of deleted function ‘std::reference_wrapper<_Tp>::reference_wrapper(_Tp&&) [with _Tp = unsigned int]’
       FLAGS_sck_keep_bits = 64;
                             ^~
In file included from /usr/include/c++/8/bits/shared_ptr_base.h:54,
                 from /usr/include/c++/8/bits/shared_ptr.h:52,
                 from /usr/include/c++/8/memory:81,
                 from /home/ics/rocksdb/include/rocksdb/table_properties.h:10,
                 from /home/ics/rocksdb/include/rocksdb/unique_id.h:8,
                 from /home/ics/rocksdb/table/unique_id_impl.h:10,
                 from /home/ics/rocksdb/cache/cache_key.h:12,
                 from /home/ics/rocksdb/cache/cache_bench_tool.cc:6:
/usr/include/c++/8/bits/refwrap.h:301:7: note: declared here
       reference_wrapper(_Tp&&) = delete;
       ^~~~~~~~~~~~~~~~~
cc1plus: all warnings being treated as errors
make[2]: *** [CMakeFiles/cache_bench.dir/build.make:90: CMakeFiles/cache_bench.dir/cache/cache_bench_tool.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:678: CMakeFiles/cache_bench.dir/all] Error 2
make: *** [Makefile:146: all] Error 2

Steps to reproduce the behavior

git clone https://github.com/gflags/gflags.git
cd gflags
git checkout v2.0
./configure && make && sudo make install
sudo yum install snappy snappy-devel
sudo yum install zlib zlib-devel
sudo yum install bzip2 bzip2-devel
sudo yum install lz4-devel
sudo yum install libasan
sudo dnf install libzstd-devel

git clone https://github.com/facebook/rocksdb.git
cd rocksdb
mkdir build && cd build
cmake ..
make static_lib

System

Centos 8 stream

anand1976 commented 1 year ago

I don't think static_lib is supported by CMakeLists.txt - https://github.com/facebook/rocksdb/blob/main/CMakeLists.txt#L30-L33. Instead, you can try -DROCKSDB_BUILD_SHARED=0.