Skip to content

[fix](compile) guard MD5 AVX2-only symbols under __AVX2__#63723

Merged
airborne12 merged 1 commit into
apache:masterfrom
airborne12:fix-md5-avx2-guard-macos
May 27, 2026
Merged

[fix](compile) guard MD5 AVX2-only symbols under __AVX2__#63723
airborne12 merged 1 commit into
apache:masterfrom
airborne12:fix-md5-avx2-guard-macos

Conversation

@airborne12
Copy link
Copy Markdown
Member

What problem does this PR solve?

Issue Number: N/A

Related PR: N/A

Problem Summary:

The constants MD5_A0/MD5_B0/MD5_C0/MD5_D0 and the helpers md5_num_blocks() and md5_pad_final_blocks() in be/src/util/md5.cpp are only referenced by the AVX2 multi-buffer code path (md5_multi_buffer_compute / md5_binary_batch_avx2). On non-AVX2 builds (e.g. macOS ARM64) the AVX2 block is #ifdef'd out, leaving these symbols orphaned and triggering compile errors under the project's strict warnings:

error: unused variable 'MD5_A0' [-Werror,-Wunused-const-variable]
error: unused variable 'MD5_B0' [-Werror,-Wunused-const-variable]
error: unused variable 'MD5_C0' [-Werror,-Wunused-const-variable]
error: unused variable 'MD5_D0' [-Werror,-Wunused-const-variable]
error: unused function 'md5_pad_final_blocks' [-Werror,-Wunused-function]

This PR moves those AVX2-only constants and helpers inside the existing #ifdef __AVX2__ block where they belong. MD5_DUMMY_INPUT and md5_to_hex stay outside the guard because the non-AVX2 fallback in md5_hex_batch still uses them. No behavior change on x86_64; restores build on ARM/non-AVX2 targets.

Release note

None

Check List (For Author)

  • Test

    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.

    Manual test: verified ./build.sh --be -j 20 now succeeds on macOS ARM64.

  • Behavior changed:

    • No.
  • Does this need documentation?

    • No.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

MD5_A0..D0 constants, md5_num_blocks(), and md5_pad_final_blocks()
are only used by the AVX2 multi-buffer path. On non-AVX2 builds
(e.g. macOS ARM64) they trigger -Werror=unused-const-variable and
-Werror=unused-function. Move them inside the existing #ifdef __AVX2__
block. MD5_DUMMY_INPUT and md5_to_hex stay outside since the non-AVX2
fallback uses them.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@hello-stephen
Copy link
Copy Markdown
Contributor

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR.

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

@airborne12
Copy link
Copy Markdown
Member Author

run buildall

Copy link
Copy Markdown
Member

@eldenmoon eldenmoon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hello-stephen
Copy link
Copy Markdown
Contributor

skip buildall

@github-actions github-actions Bot added the approved Indicates a PR has been approved by one committer. label May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

PR approved by at least one committer and no changes requested.

@github-actions
Copy link
Copy Markdown
Contributor

PR approved by anyone and no changes requested.

@hello-stephen
Copy link
Copy Markdown
Contributor

skip buildall

@airborne12 airborne12 merged commit f7af0aa into apache:master May 27, 2026
33 of 34 checks passed
@airborne12 airborne12 deleted the fix-md5-avx2-guard-macos branch May 27, 2026 06:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by one committer. reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants