You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] BE unit tests fail to compile on aarch64: SNII_CRC32C_X86 is undefined (-Wundef -Werror) #67445
On any non-x86 target the macro is never defined, so the four #if SNII_CRC32C_X86 sites (lines 105, 239, 253, 268) trip -Wundef, which the BE builds with -Werror:
be/src/storage/index/snii/encoding/crc32c.cpp:105:5: error: 'SNII_CRC32C_X86' is not defined, evaluates to 0 [-Werror,-Wundef]
be/src/storage/index/snii/encoding/crc32c.cpp:239:5: error: ...
be/src/storage/index/snii/encoding/crc32c.cpp:253:5: error: ...
be/src/storage/index/snii/encoding/crc32c.cpp:268:5: error: ...
The whole file is wrapped in #ifdef BE_TEST, so only unit-test builds compile it.
What You Expected?
./run-be-ut.sh builds on aarch64.
How to Reproduce?
On an aarch64 host (Apple Silicon or Linux arm64):
BUILD_TYPE_UT=Debug ./run-be-ut.sh
Anything Else?
CI does not cover this. The only aarch64 workflow is be-ut-mac.yml (runs-on: macos-15), and it builds with -DMAKE_TEST=OFF, so nothing under be/test is compiled and BE_TEST is never defined there. The Linux workflows run on ubuntu-22.04/ubuntu-latest (x86_64), where the macro is defined. So this only blocks developers building BE unit tests on an arm64 machine.
Verdict: confirmed build-portability bug (high confidence). The issue is sufficiently detailed for initial triage; no additional reporter information is required to establish the failure mechanism.
Verified facts
At ddbaaab1388, be/src/storage/index/snii/encoding/crc32c.cpp defines SNII_CRC32C_X86 only when __x86_64__ or _M_X64 is present, but evaluates it numerically at lines 105, 239, 253, and 268.
be/CMakeLists.txt enables both -Wundef and -Werror. run-be-ut.sh configures with -DMAKE_TEST=ON, and that configuration defines BE_TEST, so the guarded implementation is compiled for BE unit-test builds.
On aarch64, the x86 condition is false and SNII_CRC32C_X86 remains undefined. Clang therefore emits the reported [-Wundef] diagnostic at each numeric #if, and -Werror makes the build fail before the existing portable slice-by-8 fallback can be used.
A minimal Clang preprocessor check reproduces the diagnostic exactly. I did not run a full arm64 Doris build during this analysis, but the failure follows deterministically from the verified source and compiler flags.
Production builds without BE_TEST are unaffected. The configuration surface is slightly broader than unit tests: non-x86 benchmark or file-cache microbenchmark builds that define BE_TEST can encounter the same compile error.
The issue is currently open, unassigned, and has no labels or linked PR.
Recommended fix
Prefer defining the feature macro on both branches, since the file intentionally treats it as a numeric feature flag and this matches existing Doris patterns such as DORIS_HAS_X87_FMOD_FAST:
Changing all four sites to #if defined(SNII_CRC32C_X86) would also resolve this specific failure, but the explicit 0/1 definition better preserves the current value-style contract.
Validation and next steps
Apply the single preprocessor fix without changing CRC behavior.
On arm64, build with BUILD_TYPE_UT=Debug ./run-be-ut.sh; ideally also run ./run-be-ut.sh --run --filter='SniiCrc32cTest.*' to verify that the software fallback remains byte-identical to the bundled CRC32C implementation.
Keep or add x86 coverage for SniiCrc32cTest.* so the SSE4.2 path remains covered.
Consider a narrow arm64 BE_TEST compile check in CI, because the current macOS arm64 workflow explicitly builds with MAKE_TEST=OFF and cannot detect test-only portability failures.
Add the repository's applicable bug and BE/build/arm64 labels; the issue is currently unlabeled.
Activity
Doris-Breakwater commentedon Sep 2, 2026
Initial assessment
Verdict: confirmed build-portability bug (high confidence). The issue is sufficiently detailed for initial triage; no additional reporter information is required to establish the failure mechanism.
Verified facts
ddbaaab1388,be/src/storage/index/snii/encoding/crc32c.cppdefinesSNII_CRC32C_X86only when__x86_64__or_M_X64is present, but evaluates it numerically at lines 105, 239, 253, and 268.be/CMakeLists.txtenables both-Wundefand-Werror.run-be-ut.shconfigures with-DMAKE_TEST=ON, and that configuration definesBE_TEST, so the guarded implementation is compiled for BE unit-test builds.SNII_CRC32C_X86remains undefined. Clang therefore emits the reported[-Wundef]diagnostic at each numeric#if, and-Werrormakes the build fail before the existing portable slice-by-8 fallback can be used.BE_TESTare unaffected. The configuration surface is slightly broader than unit tests: non-x86 benchmark or file-cache microbenchmark builds that defineBE_TESTcan encounter the same compile error.Recommended fix
Prefer defining the feature macro on both branches, since the file intentionally treats it as a numeric feature flag and this matches existing Doris patterns such as
DORIS_HAS_X87_FMOD_FAST:Changing all four sites to
#if defined(SNII_CRC32C_X86)would also resolve this specific failure, but the explicit0/1definition better preserves the current value-style contract.Validation and next steps
BUILD_TYPE_UT=Debug ./run-be-ut.sh; ideally also run./run-be-ut.sh --run --filter='SniiCrc32cTest.*'to verify that the software fallback remains byte-identical to the bundled CRC32C implementation.SniiCrc32cTest.*so the SSE4.2 path remains covered.BE_TESTcompile check in CI, because the current macOS arm64 workflow explicitly builds withMAKE_TEST=OFFand cannot detect test-only portability failures.Breakwater-GitHub-Analysis-Slot: slot_eeef596d7d73
[fix](build) Fix two arm64 BE build failures: kuromoji_build_dict lin…