Skip to content

Build error on Mac with CMake. Success with make. #13854

@hicder

Description

@hicder

On MacOS (I use M4 Mac), the build fails when building with CMake. Surprisingly, build succeeds with make

  • Setup
➜  rocksdb git:(main) export CC=/opt/homebrew/opt/llvm@19/bin/clang                                                                                                                                                                                                                                                                                                                 
➜  rocksdb git:(main) export CXX=/opt/homebrew/opt/llvm@19/bin/clang++                                                                                                                                                                                                                                                                                                              
➜  rocksdb git:(main) cmake -S . -B build -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Debug                                                                                                                                                                                                                                                                       
-- The CXX compiler identification is Clang 19.1.7                                                                                                                                                                                                                                                                                                                                   
-- The C compiler identification is Clang 19.1.7
-- The ASM compiler identification is Clang with GNU-like command-line
-- Found assembler: /opt/homebrew/opt/llvm@19/bin/clang
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /opt/homebrew/opt/llvm@19/bin/clang++ - skipped
  • Compilation error
FAILED: [code=1] CMakeFiles/testutillib.dir/table/mock_table.cc.o
ccache /opt/homebrew/opt/llvm@19/bin/clang++ -DGFLAGS=1 -DHAVE_FULLFSYNC -DOS_MACOSX -DROCKSDB_LIB_IO_POSIX -DROCKSDB_NO_DYNAMIC_EXTENSION -DROCKSDB_PLATFORM_POSIX -I/opt/homebrew/include -I/Users/hpham/code/rocksdb -I/Users/hpham/code/rocksdb/include -isystem /Users/hpham/code/rocksdb/third-party/gtest-1.8.1/fused-src -W -Wextra -Wall -pthread -Wsign-compare -Wshadow -Wno-unused-parameter -Wno-unused-variable -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-strict-aliasing -Wno-invalid-offsetof -march=armv8-a+crc+crypto -Wno-unused-function -Werror -g -DROCKSDB_USE_RTTI -std=gnu++17 -arch arm64 -MD -MT CMakeFiles/testutillib.dir/table/mock_table.cc.o -MF CMakeFiles/testutillib.dir/table/mock_table.cc.o.d -o CMakeFiles/testutillib.dir/table/mock_table.cc.o -c /Users/hpham/code/rocksdb/table/mock_table.cc
In file included from /Users/hpham/code/rocksdb/table/mock_table.cc:6:
In file included from /Users/hpham/code/rocksdb/table/mock_table.h:15:
In file included from /Users/hpham/code/rocksdb/db/version_edit.h:26:
In file included from /Users/hpham/code/rocksdb/table/table_reader.h:13:
In file included from /Users/hpham/code/rocksdb/db/range_tombstone_fragmenter.h:15:
In file included from /Users/hpham/code/rocksdb/db/pinned_iterators_manager.h:12:
/Users/hpham/code/rocksdb/table/internal_iterator.h:203:30: error: unknown type name 'MultiScanArgs'
  203 |   virtual void Prepare(const MultiScanArgs* /*scan_opts*/) {}
      |                              ^
In file included from /Users/hpham/code/rocksdb/table/mock_table.cc:6:
In file included from /Users/hpham/code/rocksdb/table/mock_table.h:21:
In file included from /Users/hpham/code/rocksdb/table/table_builder.h:21:
In file included from /Users/hpham/code/rocksdb/file/writable_file_writer.h:26:
/Users/hpham/code/rocksdb/utilities/fault_injection_fs.h:161:45: error: only virtual member functions can be marked 'override'
  161 |   IOStatus GetFileSize(uint64_t* file_size) override;
      |                                             ^~~~~~~~
/Users/hpham/code/rocksdb/utilities/fault_injection_fs.h:306:42: error: only virtual member functions can be marked 'override'
  306 |                     IODebugContext* dbg) override;
      |                                          ^~~~~~~~

However, when running with make, it succeeds. Not sure why.

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