Repository navigation
[Bug] be/test does not compile on macOS: Linux-only APIs and Darwin type identity in recently added tests #68404
Description
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.oExact 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) andhierarchical_data_iterator_test.cppwas changed by388c93aa8a([feature](variant) Enable Variant V2 by default, [feature](variant) Enable Variant V2 by default #66858, 2026-09-14). macOS CI intentionally skipsbe/test, so these went unnoticed. - Two possible fixes:
- make the 5 files portable (
%lld/%lluor thePRI*macros,reinterpret_cast<char*>formincore,#if defined(__linux__)aroundposix_fadvise, explicitstd::min<uint64_t>/casts, add the missingEqual::operator()(uint32_t, std::string_view)or drop heterogeneous lookup for that bench, and#include <charconv>inip_address_cidr.h); and/or - if macOS coverage of those tests is not desired, extend the existing platform-exclusion block in
be/test/CMakeLists.txt—if (OS_MACOSX) list(REMOVE_ITEM UT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/util/system_metrics_test.cpp) endif()— with the files above.
- make the 5 files portable (
- 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
- I agree to follow this project's Code of Conduct
Activity
Doris-Breakwater commentedon Sep 23, 2026
Initial maintainer triage
Assessment: valid and actionable build-portability regression (high confidence). I inspected the exact reported revision
1a3772ff041630444eab49b98eaccbc90fabbe8e. I could not execute a Darwin build on this Linux host, but the reported diagnostics match the source and Darwin ABI/API differences. The impact is currently limited to building the monolithicdoris_be_testtarget on macOS; the production BE build is not implicated.The issue is open, unassigned, and currently has no labels.
Verified facts
be/test/CMakeLists.txtglob-adds these sources to onedoris_be_testexecutable, while.github/workflows/be-ut-mac.ymlconfiguresMAKE_TEST=OFF. Therefore any one compile failure blocks every filtered local UT run, and current macOS CI cannot detect it.int64_t/uint64_taslong long/unsigned long long, whilesize_tisunsigned long. This directly explains theprintf, initializer-list, andstd::minfailures. UsePRIi64/PRIu64(or type-safe formatting) rather than hard-coding%lld/%llu, which would merely move the mismatch to platforms whereint64_tislong.snii_vs_v3_benchmark_test.cppunconditionally calls Linux-onlyposix_fadvise(..., POSIX_FADV_DONTNEED), and passesunsigned char*to Darwin'smincore(..., char*)signature.Equal: it has(string_view, uint32_t)but not(uint32_t, string_view). The productionOwnedVocabEqinspimi_term_buffer.halready provides both directions and is the appropriate local pattern.ip_address_cidr.husesstd::from_charsbut does not include<charconv>; successful Linux builds currently depend on a transitive include.function_map_inner_product_test.cppincludesfunction_inner_product.h, which includesfunction_array_distance.hand therefore Faiss headers. On non-Apple builds,doris_be_testlinks thevector_search_testtarget and inherits its transitiveann_index -> faissusage requirements. The Apple branch instead links$<TARGET_FILE:vector_search_test>via-force_load; that archive path does not propagate target usage requirements to compilation ofdoris_be_test.__COUNTER__error is separate and not macOS-specific. The token is defined inruntime_profile.h; it is expanded bySCOPED_TIMER/SCOPED_RAW_TIMERcall sites in the two reported headers. New Clang versions diagnose that extension through-Wcounter-extensionunder-Wpedantic, and Doris promotes it with-Werror.Recommended direction
std::min, symmetric comparator, and direct<charconv>include. These are small correctness/build-hygiene fixes and preserve useful macOS coverage.snii_vs_v3_benchmark_test.cppspecially. A Darwin no-op aroundposix_fadvisewould compile but would violate the benchmark's explicit “cold page cache” contract. Either implement a verified Darwin-equivalent cold-read path (and keep the existingmincoreresidency check meaningful), or exclude only this disabled benchmark TU on macOS.function_map_inner_product_test.cpp. The Apple whole-archive linkage should retainvector_search_test/ann_index/faissusage requirements, ordoris_be_testshould receive the required dependency explicitly.__COUNTER__as a toolchain-compatibility item, ideally with narrowly scoped handling of-Wcounter-extensionfor Clang rather than relaxing-Wpedanticglobally.doris_be_teststep to macOS CI. Running all UTs can remain a separate policy decision, but compiling the target is needed to prevent the same class of regression.Missing information / acceptance checks
No additional information is required to accept and assign this issue. If a maintainer cannot reproduce the two configuration-sensitive failures, the only useful additions would be the corresponding
ninja -vcompile commands for the Faiss and__COUNTER__TUs.Before closing, verify a clean
./run-be-ut.sh -j 4build on arm64 macOS with the reported Clang 23 toolchain, run representative filters for the enabled affected tests, and confirm the Linux BE UT build remains clean. The author's prepared patch is a reasonable starting point, but the cold-cache semantics and Apple CMake usage-requirement propagation should be reviewed as above.Breakwater-GitHub-Analysis-Slot: slot_088b0c303f7b
robll-v1 commentedon Sep 23, 2026
Thanks for the triage — confirming the two configuration-sensitive failures with concrete evidence, plus one correction.
1) Faiss include on Apple: confirmed, and it is the
-force_loadcode pathbe/test/CMakeLists.txt:168-180is exactly as described: the Apple branch passes the archive as a raw link flagso
vector_search_test's INTERFACE usage requirements (ann_index -> faissinclude dirs) never reachdoris_be_testcompilation on Apple, while the non-Apple branch passesvector_search_testas a target name and does propagate them.The failing TU's recorded command (from
be/ut_build_ASAN/compile_commands.jsoncreated byrun-be-ut.sh) abridges to:with no faiss include directory anywhere, matching that explanation.
2)
__COUNTER__: tag name and blast radiusWith clang 23.1.1 the diagnostic is
-Wc2y-extensionson this revision, not-Wcounter-extension:Also, this is not limited to
be/test: with clang 23 the production BE build fails the same way —./build.sh --bestops atbe/src/runtime/memory/lru_cache_policy.h:177andbe/src/storage/segment/variant/hierarchical_data_iterator.h:174(SCOPED_TIMER/SCOPED_RAW_TIMERexpand__COUNTER__), and a syntax-only sweep ofbe/srcreports ~642 sites in total.One implementation note for whoever fixes it: adding
-Wno-*toCMAKE_CXX_FLAGS/EXTRA_CXX_FLAGSis ineffective, becausebe/CMakeLists.txtappends-Wpedanticlater on the command line and that re-enables the diagnostic group (last match wins). A#pragma clang diagnostic ignoredor a flag appended after the project's-Wpedanticis required.3)
snii_vs_v3_benchmark_test.cppAgreed — a Darwin no-op
posix_fadvisewould silently invalidate the benchmark's cold-page-cache contract, so it is not an acceptable upstream fix. I only used that shim locally as a temporary probe to enumerate the remaining failing TUs. Excluding this disabled benchmark on macOS (or implementing a verified Darwin cold-read path) is the right call.4) macOS CI
Also agree that at least a compile-only
doris_be_teststep in the macOS workflow would be worth it — that is the only thing that would have caught this class of regression, given the job deliberately sets-DMAKE_TEST=OFFsince #65796.Happy to prepare a PR along the lines of your option 1 (
PRIu64-style formatting, symmetric comparator mirroringOwnedVocabEqinspimi_term_buffer.h, explicitstd::min<uint64_t>,#include <charconv>inip_address_cidr.h), and to either fix the Apple-force_loadlinkage or excludesnii_vs_v3_benchmark_test.cppon macOS as you prefer.robll-v1 commentedon Oct 9, 2026
This is fixed by #68520 (merged 2026-09-28):
be/testnow builds and runs on macOS —the seven TUs reported here are covered, plus
run-be-ut.shnow initializes thecontrib/faissandcontrib/openblassubmodules it needs. Verified locally on macOS 27(arm64) with a clang-23 toolchain; the only remaining local diagnostics are clang-23
-Werroritems that need a newer toolchain-specific suppression, not code changes.Suggest closing this issue.