Skip to content

build: make CXX overridable (CXX ?= g++) for clang builds#45

Merged
renecannao merged 1 commit into
mainfrom
fix/makefile-cxx-conditional
Jun 4, 2026
Merged

build: make CXX overridable (CXX ?= g++) for clang builds#45
renecannao merged 1 commit into
mainfrom
fix/makefile-cxx-conditional

Conversation

@renecannao
Copy link
Copy Markdown
Collaborator

@renecannao renecannao commented Jun 4, 2026

Summary

Makefile hardcoded CXX = g++. A CXX=clang++ make environment prefix does not override a Makefile = assignment, so downstream consumers that build ParserSQL with clang in containers shipping only clang/clang++ (no g++) failed with exit 127 (g++: command not found).

Changing to CXX ?= g++ lets the environment-provided compiler win while keeping g++ as the default.

Impact

Surfaced building ProxySQL 3.0.9/3.1.9 clang packages (16 distro variants failed). Cut as v1.0.9 and re-vendored into ProxySQL.

Test

CXX=clang++ make lib now compiles with clang++ (previously ignored).

Summary by CodeRabbit

  • Chores
    • Improved build system configuration to respect externally-provided C++ compiler settings. The build process now supports custom compiler selection via environment variables and command-line parameters, enabling greater flexibility for developers and automated build systems. This enhancement improves compatibility across different development environments.

The Makefile hardcoded `CXX = g++`, which a `CXX=clang++ make` environment
prefix does not override. Downstream (ProxySQL deps build) compiles this with
clang in containers that ship only clang/clang++ (no g++), so the build failed
with exit 127 (g++: command not found). Using `?=` lets the environment-provided
compiler win while keeping g++ as the default.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

The Makefile's C++ compiler variable assignment is updated from unconditional to conditional (CXX ?=), allowing external CXX values from environment variables or command-line arguments to override the default g++ instead of being forcibly replaced.

Changes

Build Configuration Flexibility

Layer / File(s) Summary
Conditional compiler variable default
Makefile
The CXX variable assignment is changed from CXX = g++ to CXX ?= g++, enabling external CXX environment or command-line overrides instead of forcing the default compiler.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A Makefile change, oh so slight,
One operator shift, a build-time delight!
From = to ?=, now external tools reign,
Compilers choose freely, no override pain!
Flex and compose, let builders decide. 🛠️

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly and accurately summarizes the main change: making the CXX variable overridable in the Makefile using conditional assignment, enabling clang builds.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/makefile-cxx-conditional

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@renecannao renecannao merged commit 3cfc581 into main Jun 4, 2026
3 of 8 checks passed
@renecannao renecannao deleted the fix/makefile-cxx-conditional branch June 4, 2026 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant