Build warning for redefinition of _GNU_SOURCE

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 1.13.1
    • Affects Version/s: 1.12.0
    • Component/s: None
    • None
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      This was included in CDRIVER-5867, but actually pertains to libmongocrypt. When compiling PHPC on macOS Sequoia (15.2), I observed the following warnings:

      /Users/jmikola/workspace/phpc/src/libmongocrypt/src/mongocrypt-util.c:29:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
         29 | #define _GNU_SOURCE
            |         ^
      <command line>:2:9: note: previous definition is here
          2 | #define _GNU_SOURCE 1
            |         ^
      1 warning generated.
      mkdir: src/libmongocrypt/src/os_posix/.libs: File exists
      /Users/jmikola/workspace/phpc/src/libmongocrypt/src/os_posix/os_dll.c:13:9: warning: '_GNU_SOURCE' macro redefined [-Wmacro-redefined]
         13 | #define _GNU_SOURCE
            |         ^
      <command line>:2:9: note: previous definition is here
          2 | #define _GNU_SOURCE 1
            |         ^
      1 warning generated.
      

      It appears that _GNU_SOURCE is always defined by the configure script generated by phpize.m4. It'd be helpful if libmongocrypt first checked that it was not defined before attempting to do so.

      The existing logic in both libmongocrypt files above assumes that it will not be defined on macOS:

      !(defined(_GNU_SOURCE) || defined(_DARWIN_C_SOURCE))
      

              Assignee:
              Kevin Albertson
              Reporter:
              Jeremy Mikola
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: