We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Installation issue: nettle fails to build due to undocumented openssl dependency?
### Steps to reproduce the issue

```console
$ spack spec -I <spec>
Input spec
--------------------------------
 -   nettle

Concretized
--------------------------------
 -   nettle@3.9.1%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]      ^gmake@4.4.1%gcc@9.2.0~guile build_system=generic arch=linux-centos7-x86_64
[+]      ^gmp@6.2.1%gcc@9.2.0+cxx build_system=autotools libs=shared,static patches=69ad2e2 arch=linux-centos7-x86_64
[+]          ^autoconf@2.69%gcc@9.2.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-centos7-x86_64
[+]              ^perl@5.38.0%gcc@9.2.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-centos7-x86_64
[+]                  ^berkeley-db@18.1.40%gcc@9.2.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-centos7-x86_64
[+]                  ^bzip2@1.0.8%gcc@9.2.0~debug~pic+shared build_system=generic arch=linux-centos7-x86_64
[+]                  ^gdbm@1.23%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]                      ^readline@8.2%gcc@9.2.0 build_system=autotools patches=bbf97f1 arch=linux-centos7-x86_64
[+]                          ^ncurses@6.4%gcc@9.2.0~symlinks+termlib abi=none build_system=autotools arch=linux-centos7-x86_64
[+]                              ^pkgconf@1.9.5%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]                  ^zlib-ng@2.1.4%gcc@9.2.0+compat+opt build_system=autotools arch=linux-centos7-x86_64
[+]          ^automake@1.16.5%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]          ^libtool@2.4.7%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]      ^m4@1.4.19%gcc@9.2.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-centos7-x86_64
[+]          ^diffutils@3.9%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
[+]              ^libiconv@1.17%gcc@9.2.0 build_system=autotools libs=shared,static arch=linux-centos7-x86_64
[+]          ^libsigsegv@2.14%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64
```


### Error message

<details><summary>Error message</summary>

<pre>
==> nettle: Executing phase: 'build'
==> Error: ProcessError: Command exited with status 2:
    'make' '-j16' 'V=1'
...
     1151    nettle-openssl.o: In function `openssl_md5_init':
  >> 1152    /localData/000scratch/rowanw/spack-stage/spack-stage-nettle-3.9.1-bv6yy4efn7x73ybk5at6bly7tplvvul
             5/spack-src/examples/nettle-openssl.c:408: undefined reference to `EVP_MD_CTX_new'
     1153    nettle-openssl.o: In function `openssl_sha1_init':
  >> 1154    /localData/000scratch/rowanw/spack-stage/spack-stage-nettle-3.9.1-bv6yy4efn7x73ybk5at6bly7tplvvul
             5/spack-src/examples/nettle-openssl.c:409: undefined reference to `EVP_MD_CTX_new'
  >> 1155    collect2: error: ld returned 1 exit status
  >> 1156    make[1]: *** [Makefile:100: nettle-benchmark] Error 1
</pre></details>


### Information on your system

* **Spack:** 0.21.0 (c35700db51bfc673798643697df3ef0e8a5177f1)
* **Python:** 3.8.18
* **Platform:** linux-centos7-ivybridge
* **Concretizer:** clingo

### Additional information

A [quick google](https://stackoverflow.com/questions/46768071/openssl-linking-undefined-reference-evp-md-ctx-new-and-fre) of the error message suggests this is due to linking against an old openssl version, which checks out as I'm running on centos 7 and the default system libcrypto does not include the missing symbol while a newer version does:

```
$ ls -al /lib64/libcrypto.so
lrwxrwxrwx 1 root root 19 Apr 11  2023 /lib64/libcrypto.so -> libcrypto.so.1.0.2k

$ nm --dynamic /lib64/libcrypto.so.1.0.2k |grep EVP_MD_CTX_new

$ nm --dynamic /lib64/libcrypto.so.1.1.1k |grep EVP_MD_CTX_new
000000000015be20 T EVP_MD_CTX_new
```

Obviously spack shouldn't be relying on the system library; the nettle package doesn't specify any kind of dependency on openssl so that seems like a bug.

### 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

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `var/spack/repos/builtin/packages/nettle/package.py`
Content:
```
1 # Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
2 # Spack Project Developers. See the top-level COPYRIGHT file for details.
3 #
4 # SPDX-License-Identifier: (Apache-2.0 OR MIT)
5 
6 from spack.package import *
7 
8 
9 class Nettle(AutotoolsPackage, GNUMirrorPackage):
10     """The Nettle package contains the low-level cryptographic library
11     that is designed to fit easily in many contexts."""
12 
13     homepage = "https://www.lysator.liu.se/~nisse/nettle/"
14     gnu_mirror_path = "nettle/nettle-3.3.tar.gz"
15 
16     license("GPL-2.0-or-later OR LGPL-3.0-or-later")
17 
18     version("3.9.1", sha256="ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3")
19     version("3.8.1", sha256="364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe")
20     version("3.4.1", sha256="f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad")
21     version("3.4", sha256="ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94")
22     version("3.3", sha256="46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e")
23     version("3.2", sha256="ea4283def236413edab5a4cf9cf32adf540c8df1b9b67641cfc2302fca849d97")
24     version("2.7.1", sha256="bc71ebd43435537d767799e414fce88e521b7278d48c860651216e1fc6555b40")
25     version("2.7", sha256="c294ea133c05382cc2effb1734d49f4abeb1ad8515543a333de49a11422cd4d6")
26 
27     depends_on("gmp")
28     depends_on("m4", type="build")
29     depends_on("openssl")
30 
31     def configure_args(self):
32         return ["CFLAGS={0}".format(self.compiler.c99_flag)]
33
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/var/spack/repos/builtin/packages/nettle/package.py b/var/spack/repos/builtin/packages/nettle/package.py
--- a/var/spack/repos/builtin/packages/nettle/package.py
+++ b/var/spack/repos/builtin/packages/nettle/package.py
@@ -26,7 +26,11 @@
 
     depends_on("gmp")
     depends_on("m4", type="build")
-    depends_on("openssl")
+
+    def flag_handler(self, name, flags):
+        if name == "cflags":
+            flags.append(self.compiler.c99_flag)
+        return (flags, None, None)
 
     def configure_args(self):
-        return ["CFLAGS={0}".format(self.compiler.c99_flag)]
+        return ["--disable-openssl"]

{"golden_diff": "diff --git a/var/spack/repos/builtin/packages/nettle/package.py b/var/spack/repos/builtin/packages/nettle/package.py\n--- a/var/spack/repos/builtin/packages/nettle/package.py\n+++ b/var/spack/repos/builtin/packages/nettle/package.py\n@@ -26,7 +26,11 @@\n \n     depends_on(\"gmp\")\n     depends_on(\"m4\", type=\"build\")\n-    depends_on(\"openssl\")\n+\n+    def flag_handler(self, name, flags):\n+        if name == \"cflags\":\n+            flags.append(self.compiler.c99_flag)\n+        return (flags, None, None)\n \n     def configure_args(self):\n-        return [\"CFLAGS={0}\".format(self.compiler.c99_flag)]\n+        return [\"--disable-openssl\"]\n", "issue": "Installation issue: nettle fails to build due to undocumented openssl dependency?\n### Steps to reproduce the issue\n\n```console\r\n$ spack spec -I <spec>\r\nInput spec\r\n--------------------------------\r\n -   nettle\r\n\r\nConcretized\r\n--------------------------------\r\n -   nettle@3.9.1%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]      ^gmake@4.4.1%gcc@9.2.0~guile build_system=generic arch=linux-centos7-x86_64\r\n[+]      ^gmp@6.2.1%gcc@9.2.0+cxx build_system=autotools libs=shared,static patches=69ad2e2 arch=linux-centos7-x86_64\r\n[+]          ^autoconf@2.69%gcc@9.2.0 build_system=autotools patches=35c4492,7793209,a49dd5b arch=linux-centos7-x86_64\r\n[+]              ^perl@5.38.0%gcc@9.2.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-centos7-x86_64\r\n[+]                  ^berkeley-db@18.1.40%gcc@9.2.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-centos7-x86_64\r\n[+]                  ^bzip2@1.0.8%gcc@9.2.0~debug~pic+shared build_system=generic arch=linux-centos7-x86_64\r\n[+]                  ^gdbm@1.23%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]                      ^readline@8.2%gcc@9.2.0 build_system=autotools patches=bbf97f1 arch=linux-centos7-x86_64\r\n[+]                          ^ncurses@6.4%gcc@9.2.0~symlinks+termlib abi=none build_system=autotools arch=linux-centos7-x86_64\r\n[+]                              ^pkgconf@1.9.5%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]                  ^zlib-ng@2.1.4%gcc@9.2.0+compat+opt build_system=autotools arch=linux-centos7-x86_64\r\n[+]          ^automake@1.16.5%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]          ^libtool@2.4.7%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]      ^m4@1.4.19%gcc@9.2.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-centos7-x86_64\r\n[+]          ^diffutils@3.9%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n[+]              ^libiconv@1.17%gcc@9.2.0 build_system=autotools libs=shared,static arch=linux-centos7-x86_64\r\n[+]          ^libsigsegv@2.14%gcc@9.2.0 build_system=autotools arch=linux-centos7-x86_64\r\n```\r\n\n\n### Error message\n\n<details><summary>Error message</summary>\r\n\r\n<pre>\r\n==> nettle: Executing phase: 'build'\r\n==> Error: ProcessError: Command exited with status 2:\r\n    'make' '-j16' 'V=1'\r\n...\r\n     1151    nettle-openssl.o: In function `openssl_md5_init':\r\n  >> 1152    /localData/000scratch/rowanw/spack-stage/spack-stage-nettle-3.9.1-bv6yy4efn7x73ybk5at6bly7tplvvul\r\n             5/spack-src/examples/nettle-openssl.c:408: undefined reference to `EVP_MD_CTX_new'\r\n     1153    nettle-openssl.o: In function `openssl_sha1_init':\r\n  >> 1154    /localData/000scratch/rowanw/spack-stage/spack-stage-nettle-3.9.1-bv6yy4efn7x73ybk5at6bly7tplvvul\r\n             5/spack-src/examples/nettle-openssl.c:409: undefined reference to `EVP_MD_CTX_new'\r\n  >> 1155    collect2: error: ld returned 1 exit status\r\n  >> 1156    make[1]: *** [Makefile:100: nettle-benchmark] Error 1\r\n</pre></details>\r\n\n\n### Information on your system\n\n* **Spack:** 0.21.0 (c35700db51bfc673798643697df3ef0e8a5177f1)\r\n* **Python:** 3.8.18\r\n* **Platform:** linux-centos7-ivybridge\r\n* **Concretizer:** clingo\n\n### Additional information\n\nA [quick google](https://stackoverflow.com/questions/46768071/openssl-linking-undefined-reference-evp-md-ctx-new-and-fre) of the error message suggests this is due to linking against an old openssl version, which checks out as I'm running on centos 7 and the default system libcrypto does not include the missing symbol while a newer version does:\r\n\r\n```\r\n$ ls -al /lib64/libcrypto.so\r\nlrwxrwxrwx 1 root root 19 Apr 11  2023 /lib64/libcrypto.so -> libcrypto.so.1.0.2k\r\n\r\n$ nm --dynamic /lib64/libcrypto.so.1.0.2k |grep EVP_MD_CTX_new\r\n\r\n$ nm --dynamic /lib64/libcrypto.so.1.1.1k |grep EVP_MD_CTX_new\r\n000000000015be20 T EVP_MD_CTX_new\r\n```\r\n\r\nObviously spack shouldn't be relying on the system library; the nettle package doesn't specify any kind of dependency on openssl so that seems like a bug.\n\n### General information\n\n- [X] I have run `spack debug report` and reported the version of Spack/Python/Platform\n- [X] I have run `spack maintainers <name-of-the-package>` and **@mentioned** any maintainers\n- [X] I have uploaded the build log and environment files\n- [X] I have searched the issues of this repo and believe this is not a duplicate\n", "before_files": [{"content": "# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack.package import *\n\n\nclass Nettle(AutotoolsPackage, GNUMirrorPackage):\n    \"\"\"The Nettle package contains the low-level cryptographic library\n    that is designed to fit easily in many contexts.\"\"\"\n\n    homepage = \"https://www.lysator.liu.se/~nisse/nettle/\"\n    gnu_mirror_path = \"nettle/nettle-3.3.tar.gz\"\n\n    license(\"GPL-2.0-or-later OR LGPL-3.0-or-later\")\n\n    version(\"3.9.1\", sha256=\"ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3\")\n    version(\"3.8.1\", sha256=\"364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe\")\n    version(\"3.4.1\", sha256=\"f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad\")\n    version(\"3.4\", sha256=\"ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94\")\n    version(\"3.3\", sha256=\"46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e\")\n    version(\"3.2\", sha256=\"ea4283def236413edab5a4cf9cf32adf540c8df1b9b67641cfc2302fca849d97\")\n    version(\"2.7.1\", sha256=\"bc71ebd43435537d767799e414fce88e521b7278d48c860651216e1fc6555b40\")\n    version(\"2.7\", sha256=\"c294ea133c05382cc2effb1734d49f4abeb1ad8515543a333de49a11422cd4d6\")\n\n    depends_on(\"gmp\")\n    depends_on(\"m4\", type=\"build\")\n    depends_on(\"openssl\")\n\n    def configure_args(self):\n        return [\"CFLAGS={0}\".format(self.compiler.c99_flag)]\n", "path": "var/spack/repos/builtin/packages/nettle/package.py"}], "after_files": [{"content": "# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other\n# Spack Project Developers. See the top-level COPYRIGHT file for details.\n#\n# SPDX-License-Identifier: (Apache-2.0 OR MIT)\n\nfrom spack.package import *\n\n\nclass Nettle(AutotoolsPackage, GNUMirrorPackage):\n    \"\"\"The Nettle package contains the low-level cryptographic library\n    that is designed to fit easily in many contexts.\"\"\"\n\n    homepage = \"https://www.lysator.liu.se/~nisse/nettle/\"\n    gnu_mirror_path = \"nettle/nettle-3.3.tar.gz\"\n\n    license(\"GPL-2.0-or-later OR LGPL-3.0-or-later\")\n\n    version(\"3.9.1\", sha256=\"ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3\")\n    version(\"3.8.1\", sha256=\"364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe\")\n    version(\"3.4.1\", sha256=\"f941cf1535cd5d1819be5ccae5babef01f6db611f9b5a777bae9c7604b8a92ad\")\n    version(\"3.4\", sha256=\"ae7a42df026550b85daca8389b6a60ba6313b0567f374392e54918588a411e94\")\n    version(\"3.3\", sha256=\"46942627d5d0ca11720fec18d81fc38f7ef837ea4197c1f630e71ce0d470b11e\")\n    version(\"3.2\", sha256=\"ea4283def236413edab5a4cf9cf32adf540c8df1b9b67641cfc2302fca849d97\")\n    version(\"2.7.1\", sha256=\"bc71ebd43435537d767799e414fce88e521b7278d48c860651216e1fc6555b40\")\n    version(\"2.7\", sha256=\"c294ea133c05382cc2effb1734d49f4abeb1ad8515543a333de49a11422cd4d6\")\n\n    depends_on(\"gmp\")\n    depends_on(\"m4\", type=\"build\")\n\n    def flag_handler(self, name, flags):\n        if name == \"cflags\":\n            flags.append(self.compiler.c99_flag)\n        return (flags, None, None)\n\n    def configure_args(self):\n        return [\"--disable-openssl\"]\n", "path": "var/spack/repos/builtin/packages/nettle/package.py"}]}