Skip to content

Support compilation w/ clang 23 - #4694

Merged
d-torrance merged 5 commits into
Macaulay2:developmentfrom
d-torrance:clang-23
Sep 16, 2026
Merged

d-torrance merged 5 commits into
Macaulay2:developmentfrom
d-torrance:clang-23

Conversation

@d-torrance

@d-torrance d-torrance commented Sep 15, 2026 •

Copy link
Copy Markdown
Member

Clang 23 requires including some more headers explicitly, e.g., <iterator> for std::back_inserter.

We had a couple issues in Macaulay2, as well as mathic and fflas-ffpack.

🤖 AI Disclosure 🤖

No AI used! I ended up using Claude for some cmake things I couldn't figure out

@d-torrance d-torrance added the build issue platform specific issues involving compiling M2, generating examples, or running tests label Sep 15, 2026
d-torrance and others added 2 commits September 15, 2026 22:48
The patch step's stamp lives in the build directory, but SOURCE_DIR was
the submodule checkout shared by every build directory, so a second
configure re-ran the patch on an already patched tree.  GNU patch's
--batch assumes such a patch is reversed and silently reverts it, which
brings back the clang 23 failure with nothing pointing at the cause.
fflas_ffpack was the only external project that both used a submodule as
its source and patched it.

Stage the submodule into libraries/fflas_ffpack/source instead, as the
autotools build does (UNTARCMD in libraries/Makefile.library.in), so the
stamp and the tree it guards are created together.  This also keeps
autogen.sh from writing into the submodule.

Checkouts that have already built this branch have a patched submodule;
run "git -C M2/submodules/fflas_ffpack checkout -- ." once before
rebuilding, or the copy inherits the patch and it gets reverted.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
M2_HOST_PREFIX/include was passed through add_compile_options, so it
landed in CMake's FLAGS slot as a plain -I.  Imported targets --
PkgConfig::FFLAS_FFPACK, TBB::tbb -- contribute their includes to the
INCLUDES slot as -isystem, and our own prefix arrives there too, by way
of the fflas-ffpack.pc we install under usr-host.  A -I naming a
directory that is also given as -isystem is discarded, so our prefix
kept whatever position it held in the -isystem chain, which on a
Homebrew machine is behind /opt/homebrew/include.  M2-engine then
compiled against Homebrew's fflas-ffpack rather than the copy we had
just built and installed.

Use include_directories(BEFORE SYSTEM ...) so our prefix leads the
-isystem chain instead.  Both keywords are needed: SYSTEM without BEFORE
still loses to an earlier -isystem, and BEFORE without SYSTEM leaves the
-I to be discarded as a duplicate.  Marking it SYSTEM is accurate, since
that directory holds third-party dependency headers rather than ours,
and pkg-config already presents them that way.

Directory scope covers d/, bin/ and the unit tests, not just the engine.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@mikestillman

Copy link
Copy Markdown
Member

This version now works for me (fflas_ffpack patches, doesn't appear to re-patch, although I'm not sure I tested that well...).

@mikestillman mikestillman left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

How does the mathic update work? Does that need to be done separately?

Otherwise this looks good!

@d-torrance

Copy link
Copy Markdown
Member Author

I merged the mathic update on the mathic repo (Macaulay2/mathic#28) before updating the submodule on the M2 side, so it's all set.

@d-torrance
d-torrance merged commit d1f83b3 into Macaulay2:development Sep 16, 2026
5 checks passed
@d-torrance d-torrance mentioned this pull request Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build issue platform specific issues involving compiling M2, generating examples, or running tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants