Repository: spack/spack

Issue:
flux-sched@0.22.0 %gcc@9.4.0 build fails: reapi_cli_impl.hpp:597:15: comparison of integer expressions of different signedness
### Steps to reproduce the issue

`flux-sched@0.22.0` build fails using:
* `spack/develop` (250d5d2c00ad9d6a747499b1160bc4a460266fae from `Wed May 4 13:30:15 2022 -0400`)
* Ubuntu 20.04, X86_64
* GCC 9.4.0

Concrete spec: [flux-sched-aypqq4i.spec.json.txt](https://github.com/spack/spack/files/8626251/flux-sched-aypqq4i.spec.json.txt)

Quickly reproducible using cached dependency binaries and Docker container image:
* `ecpe4s/ubuntu20.04-runner-x86_64:2022-05-01`

```
$> git clone https://github.com/spack/spack
$> (cd spack && git checkout 250d5d2c0)
$> . spack/share/spack/setup-env.sh

$> spack mirror add E4S https://cache.e4s.io
$> spack buildcache keys -it

$> spack install --cache-only --include-build-deps --only dependencies -f ./flux-sched-aypqq4i.spec.json

$> spack install --no-cache -f ./flux-sched-aypqq4i.spec.json
...
# SEE ERROR MESSAGE BELOW
```


### Error message

<details><summary>Error message</summary><pre>
==> Installing flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r
==> Fetching https://mirror.spack.io/_source-cache/archive/33/33cab21b667eeccd5665c5f139293b7b3e17cd3847e5fb2633c0dbacb33c611f.tar.gz
==> No patches needed for flux-sched
==> flux-sched: Executing phase: 'autoreconf'
==> flux-sched: Executing phase: 'configure'
==> flux-sched: Executing phase: 'build'
...
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'V=1'

7 errors found in build log:
     551    libtool: link: ar cru .libs/libreapi_module.a .libs/reapi_module.o
     552    ar: `u' modifier ignored since `D' is the default (see `U')
     553    libtool: link: ranlib .libs/libreapi_module.a
     554    libtool: link: ( cd ".libs" && rm -f "libreapi_module.la" && ln -s "../libreapi_module.la" "libreapi_module.la" )
     555    In file included from /tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/resource/hlapi/bindings/c/reapi_cli.cp
            p:23:
     556    /tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/resource/hlapi/bindings/c++/reapi_cli_impl.hpp: In member fu
            nction 'int Flux::resource_model::detail::resource_query_t::remove_job(uint64_t)':
  >> 557    /tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/resource/hlapi/bindings/c++/reapi_cli_impl.hpp:597:15: error
            : comparison of integer expressions of different signedness: 'const uint64_t' {aka 'const long unsigned int'} and 'long int' [-Werror=sign-compare]
     558      597 |     if (jobid > std::numeric_limits<int64_t>::max ()) {
     559          |         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     560    cc1plus: all warnings being treated as errors
  >> 561    make[5]: *** [Makefile:510: reapi_cli.lo] Error 1
     562    make[5]: Leaving directory '/tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/spack-build/resource/hlapi/bindi
            ngs/c'
  >> 563    make[4]: *** [Makefile:440: all-recursive] Error 1
     564    make[4]: Leaving directory '/tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/spack-build/resource/hlapi/bindi
            ngs'
  >> 565    make[3]: *** [Makefile:440: all-recursive] Error 1
     566    make[3]: Leaving directory '/tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/spack-build/resource/hlapi'
  >> 567    make[2]: *** [Makefile:1043: all-recursive] Error 1
     568    make[2]: Leaving directory '/tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/spack-build/resource'
  >> 569    make[1]: *** [Makefile:507: all-recursive] Error 1
     570    make[1]: Leaving directory '/tmp/root/spack-stage/spack-stage-flux-sched-0.22.0-aypqq4isbwz5wpmgdpbyz66j6mygr24r/spack-src/spack-build'
  >> 571    make: *** [Makefile:439: all] Error 2
...
</pre></details>


### Information on your system

* **Spack:** 0.18.0.dev0 (250d5d2c00ad9d6a747499b1160bc4a460266fae)
* **Python:** 3.8.10
* **Platform:** linux-ubuntu20.04-cascadelake
* **Concretizer:** clingo

### Additional information

[spack-build-env.txt](https://github.com/spack/spack/files/8626275/spack-build-env.txt)
[spack-build-out.txt](https://github.com/spack/spack/files/8626276/spack-build-out.txt)

@grondo @wspear

### General information

- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform
- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers
- [X] I have uploaded the build log and environment files
- [X] I have searched the issues of this repo and believe this is not a duplicate


Discussion:
Upstream issue opened flux-framework/flux-sched#936


Resolving patch:
diff --git a/var/spack/repos/builtin/packages/flux-sched/package.py b/var/spack/repos/builtin/packages/flux-sched/package.py
--- a/var/spack/repos/builtin/packages/flux-sched/package.py
+++ b/var/spack/repos/builtin/packages/flux-sched/package.py
@@ -75,6 +75,7 @@ class FluxSched(AutotoolsPackage):
     # Disable t5000-valgrind.t by default due to false positives not yet
     # in the suppressions file. (This patch will be in v0.21.0)
     patch('no-valgrind.patch', when='@:0.20.0')
+    patch('jobid-sign-compare-fix.patch', when='@:0.22.0')
 
     def url_for_version(self, version):
         '''


Test patch: