Skip to content

pip install cliquematch fails on macOS against Eigen 3.4+ because setup.py forces -std=c++11 #2

@dave-doty

Description

@dave-doty

I encountered this using MacOS; not sure if it is also an issue on Windows/Linux. I also asked Claude Code to write this issue for me since it discovered this discrepancy while trying to install cliquematch. Hopefully it is accurate.

Summary

On macOS, pip install cliquematch (v3.0.1) fails to compile against the currently-shipping version of Eigen (3.4.x, which is what Homebrew installs via brew install eigen). The build dies with:

error: Eigen requires at least c++14 support.
error: constexpr function's return type 'void' is not a literal type
error: no member named 'remove_const_t' in namespace 'std'
error: no member named 'enable_if_t' in namespace 'std'
...

Root cause

setup.py passes -std=c++11 as a hardcoded compile flag:

clang++ ... -Wall -Wpedantic -Wno-unused-result -std=c++11 -stdlib=libc++ ...

Since Eigen ≥ 3.4 requires C++14, compilation fails.

Why CXXFLAGS doesn't rescue it

The natural workaround is to set CXXFLAGS="-std=c++14", but setuptools prepends CXXFLAGS before the flags added by the extension's build command, so the invocation becomes:

clang++ -std=c++14 ... -std=c++11 ...

clang (and gcc) use the last -std= flag on the command line, so -std=c++11 still wins and the build still fails.

Workaround

Downgrade to Eigen 3.3.x (the version named in the project README). That branch supports C++11, so the hardcoded flag is fine:

mkdir -p ~/.cache/cm-eigen && cd ~/.cache/cm-eigen
curl -sL https://gitlab.com/libeigen/eigen/-/archive/3.3.9/eigen-3.3.9.tar.gz | tar xz
EIGEN_DIR=$HOME/.cache/cm-eigen/eigen-3.3.9 pip install cliquematch

With this change, v3.0.1 builds cleanly on macOS (Python 3.14, Apple clang).

Suggested fixes (any one would unblock Homebrew Eigen users)

  1. Bump the default standard to C++14 in setup.py:

    extra_compile_args = ['-Wall', '-Wpedantic', '-Wno-unused-result', '-std=c++14', '-stdlib=libc++']

    Eigen 3.3.x is happy with C++14 too, so this is backwards-compatible.

  2. Honor CXXFLAGS by appending it last — e.g. read os.environ.get('CXXFLAGS', '').split() and put those flags at the end of extra_compile_args, so a user's CXXFLAGS="-std=c++17" wins.

  3. Document the Eigen 3.3.x requirement more prominently in the install docs and pin a compatible version in the error message when the build fails — the current Could not find Eigen hint only fires when Eigen is absent, not when it's present but too new.

Environment

  • macOS 26 (Darwin 25.4.0), Apple Silicon
  • Python 3.14.3 (Homebrew)
  • Apple clang (Xcode command-line tools)
  • cliquematch 3.0.1 from PyPI
  • Homebrew eigen = 3.4.x

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions