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.39k stars 6.29k forks source link

Build fails on github `macos-latest` (MacOS 14.5) runners with "no member named '_rjem_realloc' in namespace 'std'" #12708

Open andlr opened 4 months ago

andlr commented 4 months ago

Expected behavior

RocksDB can be built on MacOS

Actual behavior

On updated github runners with MacOS 14.5, build fails with:

warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/memory/jemalloc_nodump_allocator.cc:1:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/memory/jemalloc_nodump_allocator.cc:13:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/include/rocksdb/convenience.h:13:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/include/rocksdb/db.h:21:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/include/rocksdb/iterator.h:26:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /.../rocksdb/include/rocksdb/wide_columns.h:8:
warning: roxide-librocksdb-sys@8.1.1-dev: In file included from /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:172:
warning: roxide-librocksdb-sys@8.1.1-dev: /Applications/Xcode_15.0.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/locale:2827:22: error: no member named '_rjem_realloc' in namespace 'std'; did you mean simply '_rjem_realloc'?
warning: roxide-librocksdb-sys@8.1.1-dev:     _Tp* __t = (_Tp*)std::realloc(__owns ? __b.get() : 0, __new_cap);
warning: roxide-librocksdb-sys@8.1.1-dev:                      ^~~~~
warning: roxide-librocksdb-sys@8.1.1-dev: /.../jemalloc/jemalloc.h:267:32: note: '_rjem_realloc' declared here
warning: roxide-librocksdb-sys@8.1.1-dev:     void JEMALLOC_SYS_NOTHROW   *je_realloc(void *ptr, size_t size)
warning: roxide-librocksdb-sys@8.1.1-dev:                                  ^
warning: roxide-librocksdb-sys@8.1.1-dev: /.../include/jemalloc/jemalloc.h:86:22: note: expanded from macro 'je_realloc'
warning: roxide-librocksdb-sys@8.1.1-dev: #  define je_realloc _rjem_realloc
warning: roxide-librocksdb-sys@8.1.1-dev:                      ^
warning: roxide-librocksdb-sys@8.1.1-dev: 1 warning and 1 error generated.

Steps to reproduce the behavior

This became an intermittent problem recently. Github rolls out newer build agents with MacOS 14.5 (more than half of the CI/CD runs land on older build agents with MacOS 14.4.1, and build doesn't fail there). macos-latest now can have either MacOS 14.4.1 or MacOS 14.5 installed, and build fails on the latter.

andlr commented 4 months ago

Including "rocksdb/convenience.h" before "port/jemalloc_helper.h" like here fixes the build. But I am not sure it's the only place which needs a fix, it's only enough to fix RocksDB lib build. It seems that some utilities / tests may also have this problem

alanpaxton commented 3 months ago

@andlr I am trying to reproduce this. Could you share how you are configuring github actions ? Is there are branch/PR ? facebook/main/.github/workflows/pr-jobs.yml explicitly runs-on: macos-13 and xcode-version: 14.3.1 Have you simply changed to runs-on: macos-latest ? Your log reports that you are using Xcode_15.0.1.app

I can build successfully (make clean; make -j16 all) on my MBP with MacOS 14.5 with XCode 15.4

andlr commented 3 months ago

The project where we're using RocksDB uses macos-latest github runners for MacOS builds, and it started failing whenever build lands on a build runner with MacOS 14.5 and Xcode 15.0.1.

And the build uses jemalloc, with these env variables

export ROCKSDB_JEMALLOC
export JEMALLOC_NO_DEMANGLE
make -j16 static_lib
alanpaxton commented 3 months ago

Hi @andlr - thanks. Building RocksDB locally with jemalloc on MacOS 14.5 and Xcode 15.0.1 works fine for me. If you could share all the details of how you build RocksDB on github actions, i.e. the contents of the .github/workflows/.yml file you use, I may have a better chance of reproducing the problem by running actions myself.