mmdb2: fix size_t error#2182
Conversation
Co-authored-by: Copilot <copilot@github.com>
There was a problem hiding this comment.
Pull request overview
Updates the mmdb2 Homebrew formula to apply an in-tree header edit during installation to resolve a macOS build failure related to size_t.
Changes:
- Adds a macOS-only
inreplaceto inject a missing standard header include intommdb_machine_.h.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Fix error: unknown type name 'size_t'; | ||
| # https://github.com/brewsci/homebrew-bio/issues/2181 | ||
| inreplace "mmdb2/mmdb_machine_.h", "#include \"mmdb_mattype.h\"", | ||
| "#include <cstddef>\n#include \"mmdb_mattype.h\"" |
There was a problem hiding this comment.
The injected header uses #include <cstddef>, which is a C++ header and may not compile if mmdb_machine_.h is included from a C translation unit (common for .h headers). Also, <cstddef> primarily guarantees std::size_t, while this codebase likely uses unqualified size_t.
Consider switching the inserted include to <stddef.h> (works for both C and C++ and defines size_t in the global namespace), or guard the C++ include with #ifdef __cplusplus and provide a C fallback.
| "#include <cstddef>\n#include \"mmdb_mattype.h\"" | |
| "#include <stddef.h>\n#include \"mmdb_mattype.h\"" |
| def install | ||
| if OS.mac? | ||
| # Fix error: unknown type name 'size_t'; | ||
| # https://github.com/brewsci/homebrew-bio/issues/2181 | ||
| inreplace "mmdb2/mmdb_machine_.h", "#include \"mmdb_mattype.h\"", | ||
| "#include <cstddef>\n#include \"mmdb_mattype.h\"" | ||
| end |
There was a problem hiding this comment.
This change alters the installed headers (and therefore the build output) without changing the upstream version. In this tap, similar formula-only fixes typically bump the formula revision so users can receive the updated build via brew upgrade.
Consider adding a revision bump to the formula alongside this patch, rather than leaving the package version unchanged.
HOMEBREW_DEVELOPER=1 HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source --verbose --keep-tmp ./Formula/<FORMULA>.rb, whereFORMULAis the name of the formula you're submitting?brew style /path/to/formula.rb?brew audit --formula brewsci/bio/<FORMULA> --online --git --skip-style?brew linkage --cached --test --strict brewsci/bio/<FORMULA>after manual installation?