Fix macOS CI build by ensuring environment variables are available to cargo build#2
Merged
Merged
Conversation
…build step Co-authored-by: keaz <8468375+keaz@users.noreply.github.com>
Co-authored-by: keaz <8468375+keaz@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix build issue for macOS in ci.yml
Fix macOS CI build by ensuring environment variables are available to cargo build
Oct 10, 2025
keaz
approved these changes
Oct 10, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The GitHub Actions CI workflow was failing when building for macOS. The rdkafka crate's native dependencies (rdkafka-sys and openssl-sys) require specific environment variables to locate OpenSSL and librdkafka during compilation, but these weren't being properly propagated to the cargo build process.
Root Cause
While the "Install dependencies on macOS" step correctly installed dependencies via Homebrew and added environment variables (
OPENSSL_DIR,PKG_CONFIG_PATH,LDFLAGS,CPPFLAGS) to$GITHUB_ENV, these variables needed to be explicitly declared in the cargo build step to ensure they're available to all subprocesses, including the build scripts that compile native dependencies.Solution
Added an explicit
env:block to the "Build with Cargo" step that declares the required environment variables:This ensures:
OPENSSL_DIRpoints to the OpenSSL@3 installation (required by openssl-sys)PKG_CONFIG_PATHtells pkg-config where to find .pc files for OpenSSL, librdkafka, zstd, and lz4LDFLAGStells the linker where to find the shared librariesCPPFLAGStells the C compiler where to find header filesAdditional Changes
CI_MACOS_FIX.mddocumentation explaining the fixTesting
The fix should be validated by the CI workflow running successfully on macOS runners. The debug output will confirm that environment variables are properly set before the cargo build executes.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.