Skip to content

Conversation

d-torrance
Copy link
Member

We add various homebrew package directories to the appropriate flags so that we can detect them at the beginning of the build without needing to set any variables ahead of time. The cmake build was already doing a pretty good job of this (it was just missing openmp), and we bring autotools in line with it.

This is on top of #3984 so that the macOS builds will actually work.

Cc: @mikestillman

# TODO: replace gdbm, see https://github.com/Macaulay2/M2/issues/594
find_package(GDBM REQUIRED QUIET) # See FindGDBM.cmake

list(APPEND CMAKE_PREFIX_PATH "$(brew --prefix libomp)")
Copy link
Member

Choose a reason for hiding this comment

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

I didn't read what you're doing in the autotools build but this should certainly not be hardcoded. It's up to the user to add brew directories to the path or not, and further there's a reason keg-only bottles are keg-only! e.g this may break depending on whether you build with GCC or clang.

Copy link
Member Author

Choose a reason for hiding this comment

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

My goal was to make it simpler for the user with a reasonable set of default search paths so that the build should work out of the box most of the time on common systems without fiddling with flags. And we're already hardcoding several other brew paths in the cmake build: 50ea574

Copy link
Member

Choose a reason for hiding this comment

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

Those are hints for standard libraries without multiple implementations, which are used only if a library wasn't found elsewhere on the path. Appending the prefix directory of libomp can determine whether the compiler uses libomp or libgomp.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, that makes sense -- I'll remove the cmake changes

Copy link
Member Author

Choose a reason for hiding this comment

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

Side note -- do we even need to deal with OpenMP on most builds? According to a comment in configure.ac:

This is required for building the library csdp and good for building the library normaliz

Most of the time, we'll be using existing system packages for these.

Copy link
Member

Choose a reason for hiding this comment

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

fflas-ffpack, which is a header-only library, uses it, and if it's not found correctly you get a warning when building M2:

#warning "openmp was not detected correctly at configure time, please report this bug"

Fixing this on all homebrew builds was quite a headache, and I think at some point all cmake builds here were also working correctly but I see that the ubuntu one is failing now.

@d-torrance d-torrance force-pushed the homebrew branch 3 times, most recently from 306b151 to c6884a1 Compare October 3, 2025 12:48
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.

2 participants