Skip to content

[VL] Backport Flex lexer compatibility for macOS - #13665

Closed
felipepessoto wants to merge 3 commits into
apache:mainfrom
felipepessoto:felipepessoto-macos-flex-compatibility
Closed

felipepessoto wants to merge 3 commits into
apache:mainfrom
felipepessoto:felipepessoto-macos-flex-compatibility

Conversation

@felipepessoto

@felipepessoto felipepessoto commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

Fix the macOS native link failure undefined yyFlexLexer::yyread(char*, unsigned long) reported by the weekly ARM64 job. Flex 2.6.5 added this virtual method to FlexLexer.h; newer Homebrew Flex releases expose the missing definition in Velox's shim.

Check in the two lexer changes only from facebookincubator/velox#20420, pinned to upstream head 842e138e5cc09e23fa62ffb68a9ab0c076b194f9:

  • Inspect the installed Flex header in CMake and set VELOX_FLEX_LEXER_HAS_YYREAD through velox_compile_definitions, which also handles mono-library builds.
  • Define the missing virtual in YyFlexLexerShim.cpp only when the header declares it, preserving Flex 2.6.4 compatibility.
  • Apply the local patch during source preparation, including --run_setup_script=OFF. A reverse applicability check skips an already-applied patch; partial application or incompatible source changes fail explicitly.

The Velox pin remains IBM/velox dft-2026_11_10 / 67fa1bbee62e9f8752b3c34cc92f179022cd2ac6. There is no moving PR download, dependency upgrade, Flex downgrade, or workflow change. The upstream update_brew workflow hunk is intentionally excluded.

How was this patch tested?

  • weekly-build-on-ubuntu is expected to fail. It is fixed by [VL] Fix GCC 11 compilation of S3 bucket config parsing #13664
  • Verified clean patch application against the exact pinned source blobs. Both resulting lexer files match the upstream PR head byte-for-byte.
  • Exercised the actual source-preparation script with setup disabled and an existing checkout, including repeat invocation. Also checked helper paths containing spaces and explicit, atomic failure for partial patches and incompatible source drift.
  • Ran an isolated Ubuntu 22.04 / GCC 11.4 CMake compile, shared-link (--no-undefined), and library-load matrix using the real release headers and actual pinned shim, base CMake file, and velox_compile_definitions helper. The harness isolates the shim target and substitutes its unrelated exception dependency; it is not a full Velox build.

Both mono-library and modular configurations produced these results (16 baseline/patched cases):

Flex header Unpatched shim Backported shim
2.6.4 Pass Pass
2.6.5 Missing yyFlexLexer::yyread at link Pass
2.6.15 Missing yyFlexLexer::yyread at link Pass
2.6.16 Missing yyFlexLexer::yyread at link Pass

Also passed bash -n, git diff --check, the repository C++ formatter on a clean source snapshot, and a direct clang-format-15 check of the patched shim using Gluten's style. Ran the repository license-header command; it excludes ep/build-velox paths. No Java/Scala runtime behavior changes.

Limitation: a real macOS libvelox.dylib link was not run from this Windows host. A dummy, comment-only change to build/mvn now triggers the existing weekly matrix through its PR path filter (new run); macOS native validation is still required.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: GitHub Copilot 1.0.106-8.unstable.r43566476370.g869eef3 (GPT-6 Astra)

Backport the lexer-only changes from facebookincubator/velox#20420 at
842e138e5cc09e23fa62ffb68a9ab0c076b194f9 without changing the Velox pin.
Apply the checked-in patch during source preparation, including when
dependency setup is skipped, and skip it only when already applied.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 17, 2026 23:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Relative --velox_home paths cause the new git -C commands to target a nonexistent nested checkout, terminating source preparation under set -e.

1 open issue
What changed in this PR

Backports Velox lexer compatibility changes to address the macOS native link failure with newer Flex headers, without changing Gluten’s pinned Velox dependency.

Changes:

  • Detects yyread in the installed Flex header and conditionally defines the missing virtual method.
  • Applies the checked-in patch during source preparation, including when setup is disabled, and skips it when already applied.
  • Limits the backport to lexer changes; no workflow or dependency upgrades are included.
File Description
ep/​build-velox/​src/​get-velox.sh Applies the compatibility patch during source preparation.
ep/​build-velox/​src/​flex-lexer-yyread.patch Adds header detection and a conditional yyread shim definition.

Review effort: Balanced

Comment thread ep/build-velox/src/get-velox.sh Resolved
Source preparation already changes into the Velox checkout. Apply the
lexer patch there rather than resolving a relative VELOX_HOME a second
time from inside the checkout.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 00:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Validation covers only an isolated Linux harness, and the changed paths do not trigger the macOS workflow, leaving the affected macOS ARM64 libvelox.dylib build/link unverified.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

Add a comment-only change to build/mvn so the existing weekly workflow
path filter selects this PR. Maven behavior is unchanged.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 00:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The macOS ARM64 libvelox.dylib link result still needs human verification because validation covers only an isolated Linux harness and the weekly CI run remains queued.

No open issues 🎉

Review effort: Balanced

@felipepessoto

Copy link
Copy Markdown
Contributor Author

@philo-he @rui-mo could you take a look, please?

Please let me know if I should leave or remove the dummy change to build/mvn. I did it to trigger CI

Comment thread ep/build-velox/src/get-velox.sh Resolved
@felipepessoto

felipepessoto commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

#13688 confirm we don’t need this PR. The Velox update will fix the issue

https://github.com/apache/gluten/actions/runs/44556810728/job/135674963347?pr=13688

image

@felipepessoto
felipepessoto deleted the felipepessoto-macos-flex-compatibility branch November 19, 2026 23:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants