Repository: spack/spack

Issue:
Installation issue: proj
### Steps to reproduce the issue

```console
$ spack install proj@8.1.0
```


### Error message

<details>

<pre>
In file included from /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:34:
  >> 302    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:42:14: error: 'int64_t' in namespace 'std' does not name a type
     303       42 | typedef std::int64_t GIntBig;
     304          |              ^~~~~~~
  >> 305    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:43:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
     306       43 | typedef std::uint64_t GUInt64;
     307          |              ^~~~~~~~
     308          |              wint_t
  >> 309    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:93:14: error: 'GIntBig' has not been declared
     310       93 |     void Add(GIntBig nVal);
     311          |              ^~~~~~~
  >> 312    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:93:10: error: 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)' cannot be overloaded with 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)'
     313       93 |     void Add(GIntBig nVal);
     314          |          ^~~
     315    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:91:10: note: previous declaration 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)'
     316       91 |     void Add(int nVal) { Add(static_cast<GIntBig>(nVal)); }
     317          |          ^~~
  >> 318    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:94:14: error: 'GUInt64' has not been declared
     319       94 |     void Add(GUInt64 nVal);
     320          |              ^~~~~~~
  >> 321    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:94:10: error: 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)' cannot be overloaded with 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)'
     322       94 |     void Add(GUInt64 nVal);
     323          |          ^~~
     324    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:91:10: note: previous declaration 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)'
     325       91 |     void Add(int nVal) { Add(static_cast<GIntBig>(nVal)); }
     326          |          ^~~
     327    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp: In member function 'void osgeo::proj::CPLJSonStreamingWriter::Add(int)':
  >> 328    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:91:42: error: 'GIntBig' does not name a type
     329       91 |     void Add(int nVal) { Add(static_cast<GIntBig>(nVal)); }
     330          |                                          ^~~~~~~
     331    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp: In member function 'void osgeo::proj::CPLJSonStreamingWriter::Add(unsigned int)':
  >> 332    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.hpp:92:51: error: 'GIntBig' does not name a type
     333       92 |     void Add(unsigned int nVal) { Add(static_cast<GIntBig>(nVal)); }
     334          |                                                   ^~~~~~~
     335    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp: At global scope:
  >> 336    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:45:14: error: 'uint64_t' in namespace 'std' does not name a type; did you mean 'wint_t'?
     337       45 | typedef std::uint64_t GUIntBig;
     338          |              ^~~~~~~~
     339          |              wint_t
  >> 340    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:238:6: error: variable or field 'Add' declared void
     341      238 | void CPLJSonStreamingWriter::Add(GIntBig nVal)
     342          |      ^~~~~~~~~~~~~~~~~~~~~~
  >> 343    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:238:34: error: 'GIntBig' was not declared in this scope
     344      238 | void CPLJSonStreamingWriter::Add(GIntBig nVal)
     345          |                                  ^~~~~~~
  >> 346    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:244:6: error: variable or field 'Add' declared void
     347      244 | void CPLJSonStreamingWriter::Add(GUInt64 nVal)
     348          |      ^~~~~~~~~~~~~~~~~~~~~~
  >> 349    /tmp/untereiner/spack-stage/spack-stage-proj-8.1.0-k3nyk3jostq6qezq6dynfgoglk3qegov/spack-src/src/proj_json_streaming_writer.cpp:244:34: error: 'GUInt64' was not declared in this scope
     350      244 | void CPLJSonStreamingWriter::Add(GUInt64 nVal)
     351          |                                  ^~~~~~~
  >> 352    make[2]: *** [src/CMakeFiles/proj.dir/build.make:695: src/CMakeFiles/proj.dir/proj_json_streaming_writer.cpp.o] Error 1

</pre>
</details>


### Information on your system

* **Spack:** 0.21.1 (e30fedab102f9281a220fb4fae82e3f8c43a82ac)
* **Python:** 3.11.6
* **Platform:** linux-manjaro23-skylake
* **Concretizer:** clingo


### Additional information

Hello @danlipsa, @kwryankrattiger and @vicentebolea
Is it possible to update proj to 9.1.1 to get the fix : "Add missing <cstdint> includes (#3459)"
I believe gcc 13.2.1 is a bit tougher.

### 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:

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/proj/package.py b/var/spack/repos/builtin/packages/proj/package.py
--- a/var/spack/repos/builtin/packages/proj/package.py
+++ b/var/spack/repos/builtin/packages/proj/package.py
@@ -84,7 +84,7 @@ class Proj(CMakePackage, AutotoolsPackage):
     patch(
         "https://github.com/OSGeo/PROJ/commit/3f38a67a354a3a1e5cca97793b9a43860c380d95.patch?full_index=1",
         sha256="dc620ff1bbcc0ef4130d53a40a8693a1e2e72ebf83bd6289f1139d0f1aad2a40",
-        when="@7:7.2.1",
+        when="@6.2:9.1",
     )
 
     patch("proj.cmakelists.5.0.patch", when="@5.0")


Test patch: