Skip to content

[Bug] be/test does not compile on macOS: Linux-only APIs and Darwin type identity in recently added tests #68404

Description

@robll-v1

Search before asking

  • I had searched in the issues and found no similar issues.

Version

master. Reproduced on f5da8fb165 and still present on 1a3772ff04.

Platform / toolchain: macOS 27 (build 26A428) arm64 (Apple Silicon), Homebrew LLVM/Clang 23.1.1, CMake 3.25.3, ninja 1.13.2, JDK 17, BUILD_TYPE=ASAN, third-party from the doris-thirdparty-prebuilt-darwin-arm64 release.

What's Wrong?

be/test does not compile on macOS, so run-be-ut.sh is unusable locally. Note that .github/workflows/be-ut-mac.yml deliberately does not compile be/test ("Only verify that the BE compiles on macOS; do NOT compile be/test. The unit tests are built and run locally, not in this job."), so nothing in CI catches this.

All test sources are linked into the single doris_be_test target, therefore a handful of failing files blocks every --filter= run as well.

The BE itself (./build.sh --be) builds and runs fine on macOS; only the unit-test target is affected.

7 TUs fail. 5 of them are macOS-incompatible test code added in the last few weeks:

file compiler error why it only fails on macOS
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp 6 × format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') / 'unsigned long' but 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat] Darwin int64_t is long long; on glibc it is long
be/test/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp no member named 'posix_fadvise' in the global namespace, use of undeclared identifier 'POSIX_FADV_DONTNEED', and cannot initialize a parameter of type 'char *' with an rvalue of type 'value_type *' (aka 'unsigned char *') for mincore() posix_fadvise() is Linux-only and mincore()'s 3rd parameter is char* on macOS
be/test/storage/index/snii/bkd/bkd_corruption_test.cpp 2 × deduced conflicting types ('size_type' (aka 'unsigned long') vs 'uint64_t' (aka 'unsigned long long')) for initializer list element type size_t and uint64_t are distinct types on Darwin
be/test/storage/index/snii/writer/spimi_locality_bench_test.cpp no matching function for call to object of type 'key_equal' (aka 'Equal') raised from libc++ <__hash_table> the custom Equal functor used for heterogeneous lookup does not provide the overloads libc++ instantiates
be/test/storage/segment/hierarchical_data_iterator_test.cpp 3 × no matching function for call to 'min' (std::min(*rows, kRows - _state->current_ordinal)) uint64_t vs size_t (unsigned long long vs unsigned long)

2 more TUs fail for include/build-configuration reasons (also reproduced with the same toolchain):

file compiler error
be/test/exec/dictionary/dictionary_ip_trie_test.cpp be/src/core/value/ip_address_cidr.h:181: no member named 'from_chars' in namespace 'std' — the header uses std::from_chars without including <charconv>
be/test/exprs/function/function_map_inner_product_test.cpp 'faiss/impl/platform_macros.h' file not found — it includes be/src/exprs/function/array/function_array_distance.h, which needs faiss headers; be/test/CMakeLists.txt already removes storage/index/ann/*.cpp from UT_FILES for exactly this reason, but not test files that import faiss headers indirectly

Additionally, with clang ≥ 23 the __COUNTER__ uses in be/src/runtime/memory/lru_cache_policy.h and be/src/storage/segment/variant/hierarchical_data_iterator.h become hard errors under the project's -Wpedantic -Werror ('__COUNTER__' is a C2y extension [-Werror,-Wc2y-extensions]). Not macOS-specific, but it independently prevents building the UT target with a current clang.

What You Expected?

./run-be-ut.sh -j 4 and ./run-be-ut.sh --run --filter=<some_test> should build and run on macOS, as the macOS workflow's comment says unit tests are meant to be built locally.

How to Reproduce?

# macOS arm64, master
git clone https://github.com/apache/doris.git && cd doris
./build.sh --be -j 4       # succeeds, doris_be is produced
./run-be-ut.sh -j 4        # fails while compiling be/test

# a single TU is enough to see the platform issues, e.g.
cd be/ut_build_ASAN
ninja test/CMakeFiles/doris_be_test.dir/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp.o

Exact lines / errors (paths shortened to the repository root):

===== be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp  (6 errors)
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:375:88: error: format specifies type 'long' but the argument has type 'int64_t' (aka 'long long') [-Werror,-Wformat]
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:403:12: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:404:79: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:482:44: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:582:64: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]
be/test/storage/index/snii/bench/bkd_native_vs_clucene_bench_test.cpp:707:79: error: format specifies type 'unsigned long' but the argument has type 'uint64_t' (aka 'unsigned long long') [-Werror,-Wformat]

===== be/test/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp  (3 platform errors)
be/test/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp:1048:62: error: cannot initialize a parameter of type 'char *' with an rvalue of type 'value_type *' (aka 'unsigned char *')
be/test/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp:1083:15: error: no member named 'posix_fadvise' in the global namespace; did you mean 'posix_madvise'?
be/test/storage/index/snii/bench/snii_vs_v3_benchmark_test.cpp:1083:39: error: use of undeclared identifier 'POSIX_FADV_DONTNEED'

===== be/test/storage/index/snii/bkd/bkd_corruption_test.cpp  (2 errors)
be/test/storage/index/snii/bkd/bkd_corruption_test.cpp:557:36: error: deduced conflicting types ('size_type' (aka 'unsigned long') vs 'uint64_t' (aka 'unsigned long long')) for initializer list element type
be/test/storage/index/snii/bkd/bkd_corruption_test.cpp:566:36: error: deduced conflicting types ('uint64_t' (aka 'unsigned long long') vs 'size_type' (aka 'unsigned long')) for initializer list element type

===== be/test/storage/index/snii/writer/spimi_locality_bench_test.cpp  (1 error)
.../c++/v1/__hash_table:1802:43: error: no matching function for call to object of type 'key_equal' (aka 'Equal')

===== be/test/storage/segment/hierarchical_data_iterator_test.cpp  (3 errors)
be/test/storage/segment/hierarchical_data_iterator_test.cpp:121:33: error: no matching function for call to 'min'
be/test/storage/segment/hierarchical_data_iterator_test.cpp:169:33: error: no matching function for call to 'min'
be/test/storage/segment/hierarchical_data_iterator_test.cpp:224:33: error: no matching function for call to 'min'

===== be/test/exec/dictionary/dictionary_ip_trie_test.cpp  (1 error)
be/src/core/value/ip_address_cidr.h:181:42: error: no member named 'from_chars' in namespace 'std'; did you mean 'to_chars'?

===== be/test/exprs/function/function_map_inner_product_test.cpp  (1 error)
be/src/exprs/function/array/function_array_distance.h:20:10: fatal error: 'faiss/impl/platform_macros.h' file not found

Anything Else?

  • The failing files are recent: the snii ones were added by 96fd1e9bd2, 1db4b1d305, 9f3b084a75 (Aug–Sep 2026) and hierarchical_data_iterator_test.cpp was changed by 388c93aa8a ([feature](variant) Enable Variant V2 by default, [feature](variant) Enable Variant V2 by default #66858, 2026-09-14). macOS CI intentionally skips be/test, so these went unnoticed.
  • Two possible fixes:
    1. make the 5 files portable (%lld/%llu or the PRI* macros, reinterpret_cast<char*> for mincore, #if defined(__linux__) around posix_fadvise, explicit std::min<uint64_t>/casts, add the missing Equal::operator()(uint32_t, std::string_view) or drop heterogeneous lookup for that bench, and #include <charconv> in ip_address_cidr.h); and/or
    2. if macOS coverage of those tests is not desired, extend the existing platform-exclusion block in be/test/CMakeLists.txtif (OS_MACOSX) list(REMOVE_ITEM UT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/util/system_metrics_test.cpp) endif() — with the files above.
  • A local patch covering all of the above is already prepared (roughly 15 lines) and can be submitted as a PR if that direction is preferred.

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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