-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Blocker - P1
-
Affects Version/s: 2.3.2
-
Component/s: None
-
None
-
None
-
PHP Drivers
-
Not Needed
-
-
None
-
None
-
None
-
None
-
None
-
None
Problem
When building the PECL package via make package, the bin/prep-release.php script uses glob patterns ({{*.
{c,h}}}) to enumerate source files. These patterns inadvertently include generated feature-detection headers:
- src/libmongoc/src/common/src/common-config.h
- src/libmongoc/src/libbson/src/bson/bson-config.h
- src/libmongoc/src/libmongoc/src/mongoc/mongoc-config.h
- src/libmongocrypt/src/mongocrypt-config.h
These headers are generated by configure on the developer's machine and reflect that machine's feature flags (e.g. #define MONGOC_ENABLE_COMPRESSION_ZSTD 1 when zstd is present).
Impact
When the PECL package is installed on a machine that does not have the same optional libraries (e.g. no zstd), the stale bundled config header is found first in the include path (source dir precedes build dir), so the correctly-generated header in the build directory is never used. The compiler then tries to include a missing header and the build fails:
src/libmongoc/src/libmongoc/src/mongoc/mongoc-compression.c:34:10: fatal error: zstd.h: No such file or directory
Root Cause
The prep-release.php glob patterns pick up generated output files that should never be shipped. The .h.in template files are correct to bundle (they are configure inputs), but the generated output headers must not be included.
Fix
Exclude the four generated config headers from the file list in bin/prep-release.php.