[MacPorts] #65016: py-pytorch @1.8.1: error: variable 'sigma_gn' set but not used [-Werror, -Wunused-but-set-variable] (was: py-pytorch: builds now failing for 10.12 and 10.13)

MacPorts noreply at macports.org
Sun Apr 17 04:12:52 UTC 2022


#65016: py-pytorch @1.8.1: error: variable 'sigma_gn' set but not used [-Werror
,-Wunused-but-set-variable]
-------------------------+----------------------------------------
  Reporter:  mascguy     |      Owner:  mascguy
      Type:  defect      |     Status:  assigned
  Priority:  Normal      |  Milestone:
 Component:  ports       |    Version:  2.7.2
Resolution:              |   Keywords:  sierra highsierra haspatch
      Port:  py-pytorch  |
-------------------------+----------------------------------------
Changes (by ryandesign):

 * keywords:   => sierra highsierra haspatch


Comment:

 It's using MacPorts clang 13 now. The previous build of this port on 10.13
 used MacPorts clang 12 because it occurred on February 16, which predated
 [changeset:f89f5bff12588323fdcdbdb55a94e5b11f06777c/macports-ports the
 February 24 change] that made MacPorts choose MacPorts clang 13 in
 preference to MacPorts clang 12.

 MacPorts clang 13 introduces this new `unused-but-set-variable` warning.
 It's not enabled by default, however it is enabled if you request all
 warnings with `-Wall` which this project does do and which is fairly
 common.

 Normally it would just be a warning but it's clearly being treated as an
 error here and in another port in #65013. I'm not sure why. In #65013 it's
 because that project is requesting that all warnings be treated as errors
 with `-Werror` (which we don't recommend) but pytorch doesn't appear to be
 doing that. If I try to compile a sample program that has this problem I
 only get a warning. Maybe some additional flags are being used by pytorch
 that we're not seeing. It's difficult to tell because this port uses
 silent build rules. (Silent rules should be disabled so that we can see
 the exact commands used to compile each object.)

 A workaround would be to add `-Wno-error=unused-but-set-variable` with
 clang 13 or later. The better solution would be to fix the code for
 example by removing the unused variable. It's an upstream bug, of course,
 so consultation with the developers is recommended. In this case, such
 consultation has already occurred. Here is their bug report:

 https://github.com/google/benchmark/issues/1172

 And their fix which we should apply to the port:

 https://github.com/google/benchmark/commit/e991355c02b93fe17713efe04cbc2e278e00fdbd

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


More information about the macports-tickets mailing list