Generated *-config.h headers bundled in PECL package cause build failures on machines with different feature flags

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Blocker - P1
    • 2.3.3
    • Affects Version/s: 2.3.2
    • Component/s: None
    • None
    • None
    • PHP Drivers
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • 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.

            Assignee:
            Jérôme Tamarelle
            Reporter:
            Jérôme Tamarelle
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: