Skip to content

error: array subscript 32 is above array bounds when attempting to compile ldb #13870

@TheThing

Description

@TheThing

Hi there.

I am attempting to compile ldb following these instructions: https://github.com/facebook/rocksdb/wiki/RocksDB-Repairer

Unfortunately it fails every time:

$ make ldb
$DEBUG_LEVEL is 1, $LIB_MODE is shared
Makefile:186: Warning: Compiling in debug mode. Don't use the resulting binary in production
$DEBUG_LEVEL is 1, $LIB_MODE is shared
Makefile:186: Warning: Compiling in debug mode. Don't use the resulting binary in production
  CC       tools/ldb.o
  CC       tools/io_tracer_parser_tool.o
  CC       tools/ldb_cmd.o
[...snipped...]
  CC       table/plain/plain_table_reader.o
  CC       table/sst_file_dumper.o
  CC       table/sst_file_reader.o
In file included from ./include/rocksdb/data_structure.h:10,
                 from ./include/rocksdb/cache.h:20,
                 from ./include/rocksdb/advanced_options.h:13,
                 from ./include/rocksdb/options.h:21,
                 from ./include/rocksdb/iterator.h:24,
                 from ./include/rocksdb/sst_file_reader.h:8,
                 from table/sst_file_reader.cc:6:
In member function ‘constexpr std::array<_Tp, _Nm>::value_type& std::array<_Tp, _Nm>::operator[](size_type) [with _Tp = rocksdb::KeyContext*; long unsigned int _Nm = 32]’,
    inlined from ‘rocksdb::MultiGetContext::MultiGetContext(rocksdb::autovector<rocksdb::KeyContext*, 32>*, size_t, size_t, rocksdb::SequenceNumber, const rocksdb::ReadOptions&, rocksdb::FileSystem*, rocksdb::Statistics*)’ at ./table/multiget_context.h:142:24,
    inlined from ‘std::vector<rocksdb::Status> rocksdb::SstFileReader::MultiGet(const rocksdb::ReadOptions&, const std::vector<rocksdb::Slice>&, std::vector<std::__cxx11::basic_string<char> >*)’ at table/sst_file_reader.cc:132:52:
/usr/include/c++/15.1.1/array:211:24: error: array subscript 32 is above array bounds of ‘std::__array_traits<rocksdb::KeyContext*, 32>::_Type’ {aka ‘rocksdb::KeyContext* [32]’} [-Werror=array-bounds=]
  211 |         return _M_elems[__n];
      |                ~~~~~~~~^
/usr/include/c++/15.1.1/array: In member function ‘std::vector<rocksdb::Status> rocksdb::SstFileReader::MultiGet(const rocksdb::ReadOptions&, const std::vector<rocksdb::Slice>&, std::vector<std::__cxx11::basic_string<char> >*)’:
/usr/include/c++/15.1.1/array:117:55: note: while referencing ‘std::array<rocksdb::KeyContext*, 32>::_M_elems’
  117 |       typename __array_traits<_Tp, _Nm>::_Type        _M_elems;
      |                                                       ^~~~~~~~
cc1plus: all warnings being treated as errors
make: *** [Makefile:2574: table/sst_file_reader.o] Error 1

I tried searching issues for other ldb compile related issue or this error message to no avail.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions