[MacPorts] #62642: cmake 1.1 portgroup sets -DDEBUG for the +debug variant

MacPorts noreply at macports.org
Wed Apr 7 05:33:27 UTC 2021


#62642: cmake 1.1 portgroup sets -DDEBUG for the +debug variant
-----------------------+--------------------
  Reporter:  szhorvat  |      Owner:  (none)
      Type:  defect    |     Status:  new
  Priority:  Normal    |  Milestone:
 Component:  ports     |    Version:  2.6.4
Resolution:            |   Keywords:
      Port:            |
-----------------------+--------------------

Old description:

> The cmake 1.1 portgroup automatically creates the `+debug` variant, and
> will use the compiler option `-DDEBUG`.  As far as I can tell, this is a
> completely arbitrary choice. Unlike `NDEBUG`, `DEBUG` is not a standard
> macro name, and should not be used for all ports.
>
> In fact, this breaks the `+debug` variant of the igraph port. This was
> completely unexpected to the igraph project: we simply did not anticipate
> that anyone would try to compile the library with `-DDEBUG`. There is
> some borrowed code within igraph which had some broken `printf`s fenced
> by `#ifdef DEBUG`s, which caused the failure. I will fix this within
> igraph, but regardless of that, MacPorts's behaviour seems unjustified
> here.
>
> I suggest simply not using `-DDEBUG` by default. If a port needs it for
> its debug mode, it should include it explicitly, not the reverse (i.e.
> having to remove it explicitly).
>
> This behaviour was originally added here: https://github.com/macports
> /macports-ports/commit/e8f9c3dbe31f1b604b076a8753b3ea26d265e276

New description:

 The cmake 1.1 portgroup automatically creates the `+debug` variant, and
 will use the compiler option `-DDEBUG`.  As far as I can tell, this is a
 completely arbitrary choice. Unlike `NDEBUG`, `DEBUG` is not a standard
 macro name, and should not be used for all ports.

 In fact, this breaks the `+debug` variant of the igraph port. This was
 completely unexpected to the igraph project: we simply did not anticipate
 that anyone would try to compile the library with `-DDEBUG`. There is some
 borrowed code within igraph which had some broken `printf`s fenced by
 `#ifdef DEBUG`s, which caused the failure. I will fix this within igraph,
 but regardless of that, MacPorts's behaviour seems unjustified here.

 I suggest simply not using `-DDEBUG` by default. If a port needs it for
 its debug mode, it should include it explicitly, not the reverse (i.e.
 having to remove it explicitly).

 This behaviour was originally added here:
 [e8f9c3dbe31f1b604b076a8753b3ea26d265e276/macports-ports]

--

Comment (by ryandesign):

 Now that this matter has been brought to our attention, yes, it seems
 reasonable that the portgroup should not add `-DDEBUG` by default.
 However, there are over 500 ports already using this portgroup. Who agrees
 to audit all of these ports to determine whether this change in the
 portgroup changes how those ports build with the +debug variant?

-- 
Ticket URL: <https://trac.macports.org/ticket/62642#comment:6>
MacPorts <https://www.macports.org/>
Ports system for macOS


More information about the macports-tickets mailing list