Repository: spack/spack

Issue:
Installation issue: mysql
### Steps to reproduce the issue

```console
$ spack spec mysql
...
-   mysql@8.0.29%gcc@11.2.0~client_only~ipo build_system=cmake build_type=Release cxxstd=14 generator=make arch=linux-centos7-haswell
[+]      ^bison@3.8.2%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]          ^diffutils@3.9%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]          ^gettext@0.22.3%gcc@11.2.0+bzip2+curses+git~libunistring+libxml2+pic+shared+tar+xz build_system=autotools arch=linux-centos7-haswell
[+]              ^libxml2@2.10.3%gcc@11.2.0+pic~python+shared build_system=autotools arch=linux-centos7-haswell
[+]              ^tar@1.34%gcc@11.2.0 build_system=autotools zip=pigz arch=linux-centos7-haswell
[+]                  ^pigz@2.7%gcc@11.2.0 build_system=makefile arch=linux-centos7-haswell
[+]          ^m4@1.4.19%gcc@11.2.0+sigsegv build_system=autotools patches=9dc5fbd,bfdffa7 arch=linux-centos7-haswell
[+]              ^libsigsegv@2.14%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]          ^perl@5.38.0%gcc@11.2.0+cpanm+opcode+open+shared+threads build_system=generic patches=714e4d1 arch=linux-centos7-haswell
[+]              ^berkeley-db@18.1.40%gcc@11.2.0+cxx~docs+stl build_system=autotools patches=26090f4,b231fcc arch=linux-centos7-haswell
[+]              ^gdbm@1.23%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]      ^boost@1.77.0%gcc@11.2.0+atomic+chrono~clanglibcpp~container~context~contract~coroutine+date_time~debug+exception~fiber+filesystem+graph~
graph_parallel~icu+iostreams~json+locale+log+math~mpi+multithreaded~nowide~numpy~pic+program_options~python+random+regex+serialization+shared+sign
als~singlethreaded~stacktrace+system~taggedlayout+test+thread+timer~type_erasure~versionedlayout+wave build_system=generic cxxstd=14 patches=48496
71,a440f96 visibility=hidden arch=linux-centos7-haswell
[+]          ^bzip2@1.0.8%gcc@11.2.0~debug~pic+shared build_system=generic arch=linux-centos7-haswell
[+]          ^xz@5.4.1%gcc@11.2.0~pic build_system=autotools libs=shared,static arch=linux-centos7-haswell
[+]          ^zlib-ng@2.1.4%gcc@11.2.0+compat+opt build_system=autotools arch=linux-centos7-haswell
[+]          ^zstd@1.5.5%gcc@11.2.0+programs build_system=makefile compression=none libs=shared,static arch=linux-centos7-haswell
[+]      ^cmake@3.27.7%gcc@11.2.0~doc+ncurses+ownlibs build_system=generic build_type=Release arch=linux-centos7-haswell
[+]          ^curl@8.4.0%gcc@11.2.0~gssapi~ldap~libidn2~librtmp~libssh~libssh2+nghttp2 build_system=autotools libs=shared,static tls=openssl arch=
linux-centos7-haswell
[+]              ^nghttp2@1.57.0%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]      ^doxygen@1.9.6%gcc@11.2.0~graphviz~ipo~mscgen build_system=cmake build_type=Release generator=make arch=linux-centos7-haswell
[+]          ^flex@2.6.3%gcc@11.2.0+lex~nls build_system=autotools arch=linux-centos7-haswell
[+]              ^findutils@4.9.0%gcc@11.2.0 build_system=autotools patches=440b954 arch=linux-centos7-haswell
[+]          ^libiconv@1.17%gcc@11.2.0 build_system=autotools libs=shared,static arch=linux-centos7-haswell
[+]          ^python@3.11.6%gcc@11.2.0+bz2+crypt+ctypes+dbm~debug+libxml2+lzma~nis~optimizations+pic+pyexpat+pythoncmd+readline+shared+sqlite3+ssl
~tkinter+uuid+zlib build_system=generic patches=13fa8bf,b0615b2,ebdca64,f2fd060 arch=linux-centos7-haswell
[+]              ^expat@2.5.0%gcc@11.2.0+libbsd build_system=autotools arch=linux-centos7-haswell
[+]                  ^libbsd@0.11.7%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]                      ^libmd@1.0.4%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]              ^libffi@3.4.4%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]              ^libxcrypt@4.4.35%gcc@11.2.0~obsolete_api build_system=autotools patches=4885da3 arch=linux-centos7-haswell
[+]              ^readline@8.2%gcc@11.2.0 build_system=autotools patches=bbf97f1 arch=linux-centos7-haswell
[+]              ^sqlite@3.43.2%gcc@11.2.0+column_metadata+dynamic_extensions+fts~functions+rtree build_system=autotools arch=linux-centos7-haswel
l
[+]              ^util-linux-uuid@2.38.1%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]      ^gmake@4.4.1%gcc@11.2.0~guile build_system=generic arch=linux-centos7-haswell
[+]      ^libedit@3.1-20210216%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]      ^libtirpc@1.3.3%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]          ^krb5@1.20.1%gcc@11.2.0+shared build_system=autotools arch=linux-centos7-haswell
[+]      ^ncurses@6.4%gcc@11.2.0~symlinks+termlib abi=none build_system=autotools arch=linux-centos7-haswell
[+]      ^openssl@3.1.3%gcc@11.2.0~docs+shared build_system=generic certs=mozilla arch=linux-centos7-haswell
[+]          ^ca-certificates-mozilla@2023-05-30%gcc@11.2.0 build_system=generic arch=linux-centos7-haswell
[+]      ^pkgconf@1.9.5%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
[+]      ^rpcsvc-proto@1.4.3%gcc@11.2.0 build_system=autotools arch=linux-centos7-haswell
```


### Error message

<details><summary>Error message</summary>

<pre>
...
</pre></details>
==> Error: ProcessError: Command exited with status 1:
...
1 error found in build log:
     377    Make sure you have specified a supported SSL version.
     378    Valid options are :
     379    system (use the OS openssl library),
     380    yes (synonym for system),
     381    </path/to/custom/openssl/installation>
     382    
  >> 383    CMake Error at cmake/ssl.cmake:73 (MESSAGE):
     384      Please install the appropriate openssl developer package.
     385    
     386    Call Stack (most recent call first):
     387      cmake/ssl.cmake:331 (FATAL_SSL_NOT_FOUND_ERROR)
     388      CMakeLists.txt:1688 (MYSQL_CHECK_SSL)

### Information on your system

* **Spack:** 0.21.0.dev0
* **Python:** 3.11.6
* **Platform:** linux-centos7-haswell
* **Concretizer:** clingo

### Additional information


  cmake/boost.cmake:206 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:1467 (INCLUDE)
-- Configuring incomplete, errors occurred!
(py3.11) -bash-4.2$tail -n35 /tmp/nma8kk/spack-stage/spack-stage-mysql-8.0.29-fv3qxkcg5zwkzet36mfmkdaaqmxadrpz/spack-build-out.txt
-- Performing Test C_LD_LLD_RESULT
-- Performing Test C_LD_LLD_RESULT - Failed
-- Performing Test CXX_LD_LLD_RESULT
-- Performing Test CXX_LD_LLD_RESULT - Failed
-- Performing Test C_LD_GOLD_RESULT
-- Performing Test C_LD_GOLD_RESULT - Success
-- Performing Test CXX_LD_GOLD_RESULT
-- Performing Test CXX_LD_GOLD_RESULT - Success
-- WITH_BOOST=/sfs/qumulo/qhome/nma8kk/libs/spack/opt/spack/linux-centos7-haswell/gcc-11.2.0/boost-1.77.0-gbxkmzaet4guf3ynw3bsunzqiqub5epr
-- BOOST_INCLUDE_DIR 
-- LOCAL_BOOST_DIR LOCAL_BOOST_DIR-NOTFOUND
-- LOCAL_BOOST_ZIP LOCAL_BOOST_ZIP-NOTFOUND
-- Could not find (the correct version of) boost.
-- MySQL currently requires boost_1_77_0
CMake Error at cmake/boost.cmake:108 (MESSAGE):
  You can download it with -DDOWNLOAD_BOOST=1 -DWITH_BOOST=<directory>
  This CMake script will look for boost in <directory>.  If it is not there,
  it will download and unpack it (in that directory) for you.
  You can also download boost manually, from
  https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2
  If you are inside a firewall, you may need to use an https proxy:
  export https_proxy=http://example.com:80
Call Stack (most recent call first):
  cmake/boost.cmake:206 (COULD_NOT_FIND_BOOST)
  CMakeLists.txt:1467 (INCLUDE)
-- Configuring incomplete, errors occurred!

### 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:
There is a trivial fix:
`options.append("-DBOOST_ROOT={0}".format(spec["boost"].prefix))`
should be changed to 
`options.append("-DLOCAL_BOOST_DIR={0}".format(spec["boost"].prefix))`
in the cmake_args function in `package.py`
Thank you for pointing out the fix. 
However, once it's happy with boost, it complains about SSL.

>  -- ZSTD_INCLUDE_DIR /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-oxctlg3art3lpnhirqisa2jmrqz3zltx/spack-src/extra/zstd/zstd-1.5.0/lib
-- ZSTD_LIBRARY zstd
-- OPENSSL_INCLUDE_DIR = /mrltools/spack/opt/linux-rocky8-x86_64/gcc-13.2.0/openssl/3.1.3-lzpftsskiru6hzb4jaclv7lqrexwgxd3/include
-- OPENSSL_LIBRARY = /mrltools/spack/opt/linux-rocky8-x86_64/gcc-13.2.0/openssl/3.1.3-lzpftsskiru6hzb4jaclv7lqrexwgxd3/lib64/libssl.so
-- CRYPTO_LIBRARY = /mrltools/spack/opt/linux-rocky8-x86_64/gcc-13.2.0/openssl/3.1.3-lzpftsskiru6hzb4jaclv7lqrexwgxd3/lib64/libcrypto.so
-- OPENSSL_MAJOR_VERSION = 
-- OPENSSL_MINOR_VERSION = 
-- OPENSSL_FIX_VERSION = 
-- Looking for SHA512_DIGEST_LENGTH
-- Looking for SHA512_DIGEST_LENGTH - found
 -- 
Cannot find appropriate system libraries for WITH_SSL=system.
Make sure you have specified a supported SSL version. 
Valid options are : 
system (use the OS openssl library), 
yes (synonym for system), 
</path/to/custom/openssl/installation>

> CMake Error at cmake/ssl.cmake:73 (MESSAGE):
  Please install the appropriate openssl developer package.

> Call Stack (most recent call first):
  cmake/ssl.cmake:331 (FATAL_SSL_NOT_FOUND_ERROR)
  CMakeLists.txt:1688 (MYSQL_CHECK_SSL)


* **Spack:** 0.21.0 (65d3221a9c436e77af9e802e543c71bd702ff4e2)
* **Python:** 3.6.8
* **Platform:** linux-rocky8-x86_64
* **Concretizer:** clingo

This happens with both mysql@8.0.29 and 8.0.19 (I haven't tried any other)

(sorry for the bad formatting)
Solved this using a very old (1.1.1k) version of openssl i have in the system.
May work with newer ones as well.
Both remaining **non-deprecated** versions fail in the same way.
Now i'm stuck with this.

```console
     1667    [ 51%] Building CXX object libbinlogevents/src/CMakeFiles/binlogevents_static.dir/gtids/gtid.cpp.o
     1668    cd /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-build-uqvgoij/libbinlogevents/src && /mrltools/spack/0.21.0/lib/spack/env/gcc/g++ -DHAVE_CONFIG_H -DHAVE_TLSv13 -DLZ4_DISABLE_DEPRECATE_WARNINGS -DRAPIDJSON_NO_SIZETYPEDEF
             INE -DRAPIDJSON_SCHEMA_USE_INTERNALREGEX=0 -DRAPIDJSON_SCHEMA_USE_STDREGEX=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE -D_USE_MATH_DEFINES -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p
             /spack-build-uqvgoij -I/cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-build-uqvgoij/include -I/cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src -I/cfdbuild/cfdapps/spack-sta
             ge/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/include -I/cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/libbinlogevents/include -isystem /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-u
             qvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/extra/rapidjson/include -isystem /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/extra/lz4/lz4-1.9.3 -isystem /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf
             5sp2ks3qgvamcfnbacs6p/spack-src/extra/zstd/zstd-1.5.0/lib -isystem /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-build-uqvgoij/extra/zlib -isystem /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3
             qgvamcfnbacs6p/spack-src/extra/zlib -isystem /mrltools/spack/opt/linux-rocky8-x86_64/gcc-13.2.0/libedit/3.1-20210216-aiymojzmd6s7becniq7v2alzvsqmzjfn/include/editline -std=c++17 -fno-omit-frame-pointer -ftls-model=initial-exec -std=c++17 -Wno-deprecated-declarations -
             Wno-error=register -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Woverloaded-virtual -Wcast-qual -Wimplicit-fallthrough=5 -Wstringop-truncation -Wsuggest-override -Wmissing-include-dirs -Wextra-semi -Wlogical-op -ffunction-sections -fdata-s
             ections -O3 -DNDEBUG -fPIC -Wshadow=local  -Wno-missing-profile -MD -MT libbinlogevents/src/CMakeFiles/binlogevents_static.dir/gtids/gtid.cpp.o -MF CMakeFiles/binlogevents_static.dir/gtids/gtid.cpp.o.d -o CMakeFiles/binlogevents_static.dir/gtids/gtid.cpp.o -c /cfdbuil
             d/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/libbinlogevents/src/gtids/gtid.cpp
     1669    In file included from /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/libbinlogevents/include/gtids/gtid.h:29,
     1670                     from /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/libbinlogevents/src/gtids/gtid.cpp:23:
  >> 1671    /cfdbuild/cfdapps/spack-stage/spack-stage-mysql-8.0.29-uqvgoijslbf5sp2ks3qgvamcfnbacs6p/spack-src/libbinlogevents/include/gtids/global.h:32:14: error: 'int64_t' in namespace 'std' does not name a type
     1672       32 | typedef std::int64_t gno_t;
     1673          |              ^~~~~~~

```

I'm trying to compile with gcc@13.2.0
I also ran into those issues with SSL but there was an old version on the system (1.1.2s)  that worked.

I eventually got MySQL to compile with `spack install -v mysql cxxstd=17`.
Thanks for confirming.

What compiler are you using?
I managed to compile `mysql@8.0.29%gcc@12.3.0 cxxstd=17`  but fails with `%gcc@13.2.0`  
Here is the output from `spack find`, in case there are other relevant dependencies. I am using gcc 11.2.0.
```
-- linux-centos7-haswell / gcc@11.2.0 ---------------------------
berkeley-db@18.1.40  diffutils@3.9    gettext@0.22.3        libiconv@1.17     m4@1.4.19            pigz@2.7            tar@1.34
bison@3.8.2          doxygen@1.9.6    gmake@4.4.1           libmd@1.0.4       mysql@8.0.29         pkgconf@1.9.5       util-linux-uuid@2.38.1
boost@1.77.0         expat@2.5.0      krb5@1.20.1           libsigsegv@2.14   ncurses@6.4          python@3.11.6       xz@5.4.1
bzip2@1.0.8          findutils@4.9.0  libbsd@0.11.7         libtirpc@1.3.3    openssl@1.0.2k-fips  readline@8.2        zlib-ng@2.1.4
cmake@3.27.7         flex@2.6.3       libedit@3.1-20210216  libxcrypt@4.4.35  openssl@1.1.2s       rpcsvc-proto@1.4.3  zstd@1.5.5
curl@8.4.0           gdbm@1.23        libffi@3.4.4          libxml2@2.10.3    perl@5.38.0          sqlite@3.43.2
```
Managed to fix for version `8.0.29` it with this patch:
```diff
diff --git a/libbinlogevents/include/gtids/global.h b/libbinlogevents/include/gtids/global.h
index dd1c4d5..1e60f45 100644
--- a/libbinlogevents/include/gtids/global.h
+++ b/libbinlogevents/include/gtids/global.h
@@ -25,6 +25,7 @@

 #include <set>
 #include <sstream>
+#include <cstdint>
 #include "libbinlogevents/include/uuid.h"

 namespace binary_log::gtids {
```
In the MySQL release notes, they mention supporting cxxstd=17:
https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-27.html
I think they broke the builds for cxxstd < 17 somewhere around there.

I put this into my package.py:
```
    requires("cxxstd=17", when="@8.0.29:")

    # Each version of MySQL requires a specific version of boost
    # See BOOST_PACKAGE_NAME in cmake/boost.cmake
    # 8.0.29 - 8.0.33
    depends_on("boost@1.77.0 cxxstd=17", type="build", when="@8.0.29: cxxstd=17")
```

Not sure if it's better to constrain this or patch the source, though.
Works for me, I use gcc 12.3.0 .
I'm on v0.20 and did not touch the "BOOST_ROOT" or SSL.
I am on mysql 8.0.32 and 8.0.33 though.
@EbiArnie  I think it used to work in v0.20 just requiring cxxstd=17 for @8.0.29 (i had done it in my packages.yaml) but good idea to add it the package.

Not sure about the BOOST_ROOT issue either. I'm pretty sure i was able to install mysql@8.0.29%gcc@11.3.0 cxxstd=17 without issues in spack v0.20. Perhaps a change in Cmake going from 3.26.3 to 3.27.7?

Not sure what changed on the openssl side between v0.20 and v0.21.
Probably something to do with the deprecation of the 1.1.1 series of openssl version in spack v0.21, but this is just me speculating.
I had an external 1.1.1k defined in my packages.yaml that is no longer picked up in v0.21 because deprecated.

The issue i solved with the patch is for gcc@13 ( https://gcc.gnu.org/gcc-13/porting_to.html )

Regarding OpenSSL:
OpenSSL has deprecated everything below 3 for a long while, ([see here](https://www.openssl.org/blog/blog/2023/03/28/1.1.1-EOL/)). Spack has also deprecated these versions starting with v0.21.
To build MySQL, either use a new MySQL (you'd have to put new version into the package.py plus respective boost) - or you have to allow the concretizer to use deprecated versions.
[8.0.34](https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-34.html) seems to be the first one to compile with OpenSSL 3.

This works for me for 8.0.29:
Edit package.py like:
`depends_on("openssl@:2")`

then do:
`spack -e yourenv -c "config:deprecated:true" concretize -f -U`
Yes, that's what i realised by doing a lot of experiments (I should have read the mysql release notes probably :) ). 

I solved the SSL issue by putting in packages.yaml:
```yaml
mysql:
 requires: "@8.0.29: ^openssl@:1 cxxstd=17"
 ```
 (cxxstd=17 we said it's needed only from 8.0.29 onwards but i'm not building anything below that version so it's fine for me to enforce it like that)
And i set my config.yaml to allow the use of deprecated versions
8.0.35 is currently building, seems to work with this (on v0.21, OpenSSL 3):

```

# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

import os
import tempfile

from spack.package import *
from spack.pkg.builtin.boost import Boost


class Mysql(CMakePackage):
    """MySQL is an open source relational database management system."""

    homepage = "https://www.mysql.com/"
    url = "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.35.tar.gz"

    version("8.0.35", sha256="917c5ed38704e99211185ce4be24e33a8c19c91241ed73af4181a6f38d1574c2")
    version("8.0.34", sha256="e65d03a3c42618b5fbf99042aed33209402e9b27aa62c7c8743ffd4788d8db1d")
    version("8.0.33", sha256="962002f5d906f42f40b277a39d2db93931248c1f07ff8f4312c288e63803dd12")
    version("8.0.32", sha256="1f0d92a237898244716dd581f799356e073c2da63c3b2e4a01e1032cbed50e28")
    version("8.0.31", sha256="67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa")
    version("8.0.30", sha256="c988d5c6ba9a56692a6cd6e9813465b5fc9368ed4b461df97059a2fc160c8b84")
    version("8.0.29", sha256="512170fa6f78a694d6f18d197e999d2716ee68dc541d7644dd922a3663407266")
    version("8.0.19", sha256="a62786d67b5e267eef928003967b4ccfe362d604b80f4523578e0688f5b9f834")
    version("8.0.18", sha256="4cb39a315298eb243c25c53c184b3682b49c2a907a1d8432ba0620534806ade8")
    version("8.0.17", sha256="c6e3f38199a77bfd8a4925ca00b252d3b6159b90e4980c7232f1c58d6ca759d6")
    version("8.0.16", sha256="8d9fe89920dc8bbbde2857b7b877ad2fa5ec2f231c68e941d484f3b72735eaea")
    version("8.0.15", sha256="bb1bca2dc2f23ee9dd395cc4db93b64561d4ac20b53be5d1dae563f7be64825e")
    version("8.0.14", sha256="bc53f4c914fb39650289700d144529121d71f38399d2d24a0f5c76e5a8abd204")
    version("8.0.13", sha256="d85eb7f98b6aa3e2c6fe38263bf40b22acb444a4ce1f4668473e9e59fb98d62e")
    version("8.0.12", sha256="69f16e20834dbc60cb28d6df7351deda323330b9de685d22415f135bcedd1b20")
    version("8.0.11", sha256="3bde3e30d5d4afcedfc6db9eed5c984237ac7db9480a9cc3bddc026d50700bf9")
    version("5.7.27", sha256="f8b65872a358d6f5957de86715c0a3ef733b60451dad8d64a8fd1a92bf091bba")
    version("5.7.26", sha256="5f01d579a20199e06fcbc28f0801c3cb545a54a2863ed8634f17fe526480b9f1")
    version("5.7.25", sha256="53751c6243806103114567c1a8b6a3ec27f23c0e132f377a13ce1eb56c63723f")
    version("5.7.24", sha256="05bf0c92c6a97cf85b67fff1ac83ca7b3467aea2bf306374d727fa4f18431f87")
    version("5.7.23", sha256="0730f2d5520bfac359e9272da6c989d0006682eacfdc086a139886c0741f6c65")
    version("5.7.22", sha256="4eb8405b0a9acb0381eae94c1741b2850dfc6467742b24b676e62b566409cff2")
    version("5.7.21", sha256="fa205079c27a39c24f3485e7498dd0906a6e0b379b4f99ebc0ec38a9ec5b09b7")
    version("5.7.20", sha256="5397549bb7c238f396c123db2df4cad2191b11adf8986de7fe63bff8e2786487")
    version("5.7.19", sha256="3e51e76f93179ca7b165a7008a6cc14d56195b3aef35d26d3ac194333d291eb1")
    version("5.7.18", sha256="0b5d71ed608656cd8181d3bb0434d3e36bac192899038dbdddf5a7594aaea1a2")
    version("5.7.17", sha256="cebf23e858aee11e354c57d30de7a079754bdc2ef85eb684782458332a4b9651")
    version("5.7.16", sha256="4935b59974edb275629f6724a0fcf72265a5845faf1e30eeb50ed4b6528318a5")
    version("5.7.15", sha256="9085353143bfda59c90aa959e79a35622a22aa592e710993416e193b37eb9956")
    version("5.7.14", sha256="f7415bdac2ca8bbccd77d4f22d8a0bdd7280b065bd646a71a506b77c7a8bd169")
    version("5.7.13", sha256="50bf1a1635a61235fc43fd4876df2f77163de109372679e29c1ff8dbc38a0b87")
    version("5.7.12", sha256="32843cb6d22ab22cd2340262b53c0d6009b5bd41b1fa4102beda19635a5c1c87")
    version("5.7.11", sha256="54f8c7af87d3d8084419bde2b9f0d8970b3dada0757b015981b02f35a3681f0e")
    version("5.7.10", sha256="1ea1644884d086a23eafd8ccb04d517fbd43da3a6a06036f23c5c3a111e25c74")
    version("5.7.9", sha256="315342f5bee1179548cecad2d776cd7758092fd2854024e60a3a5007feba34e0")
    version("5.6.44", sha256="c031c92c3f226856b09bf929d8a26b0cd8600036cb9db4e0fdf6b6f032ced336")
    version("5.6.43", sha256="1c95800bf0e1b7a19a37d37fbc5023af85c6bc0b41532433b3a886263a1673ef")
    version("5.5.62", sha256="b1e7853bc1f04aabf6771e0ad947f35ac8d237f4b35d0706d1095c9526ff99d7")

    variant("client_only", default=False, description="Build and install client only.")
    variant(
        "cxxstd",
        default="17",
        values=("98", "11", "14", "17"),
        multi=False,
        description="Use the specified C++ standard when building.",
    )

    # 5.7.X cannot be compiled client-only.
    conflicts("+client_only", when="@5.7.0:5.7")
    # Server code has a macro 'byte', which conflicts with C++17's
    # std::byte.
    conflicts("cxxstd=17", when="@8.0.0:8.0.19~client_only")
    requires("cxxstd=17", when="@8.0.29:")

    provides("mysql-client")

    # https://dev.mysql.com/doc/refman/8.0/en/source-installation.html

    # See CMAKE_MINIMUM_REQUIRED in CMakeLists.txt
    depends_on("cmake@3.1.0:", type="build", when="@5.7.0:5.7 platform=win32")
    depends_on("cmake@3.8.0:", type="build", when="@8.0.0: platform=win32")
    depends_on("cmake@3.9.2:", type="build", when="@8.0.0: platform=darwin")
    depends_on("cmake@3.4.0:", type="build", when="@8.0.0: platform=solaris")
    depends_on("cmake@2.6:", type="build", when="@:5.6")
    depends_on("cmake@2.8.9:", type="build", when="@5.7.0:5.7")
    depends_on("cmake@2.8.12:", type="build", when="@8.0.0:")

    depends_on("gmake@3.75:", type="build")
    depends_on("pkgconfig", type="build", when="@5.7.0:")
    depends_on("doxygen", type="build", when="@8.0.0:")

    # Each version of MySQL requires a specific version of boost
    # See BOOST_PACKAGE_NAME in cmake/boost.cmake
    # 8.0.29+
    depends_on("boost@1.77.0 cxxstd=17", type="build", when="@8.0.29: cxxstd=17")
    # 8.0.19
    depends_on("boost@1.70.0 cxxstd=98", type="build", when="@8.0.19 cxxstd=98")
    depends_on("boost@1.70.0 cxxstd=11", type="build", when="@8.0.19 cxxstd=11")
    depends_on("boost@1.70.0 cxxstd=14", type="build", when="@8.0.19 cxxstd=14")
    depends_on("boost@1.70.0 cxxstd=17", type="build", when="@8.0.19 cxxstd=17")
    # 8.0.16--8.0.18
    depends_on("boost@1.69.0 cxxstd=98", type="build", when="@8.0.16:8.0.18 cxxstd=98")
    depends_on("boost@1.69.0 cxxstd=11", type="build", when="@8.0.16:8.0.18 cxxstd=11")
    depends_on("boost@1.69.0 cxxstd=14", type="build", when="@8.0.16:8.0.18 cxxstd=14")
    depends_on("boost@1.69.0 cxxstd=17", type="build", when="@8.0.16:8.0.18 cxxstd=17")
    # 8.0.14--8.0.15
    depends_on("boost@1.68.0 cxxstd=98", type="build", when="@8.0.14:8.0.15 cxxstd=98")
    depends_on("boost@1.68.0 cxxstd=11", type="build", when="@8.0.14:8.0.15 cxxstd=11")
    depends_on("boost@1.68.0 cxxstd=14", type="build", when="@8.0.14:8.0.15 cxxstd=14")
    depends_on("boost@1.68.0 cxxstd=17", type="build", when="@8.0.14:8.0.15 cxxstd=17")
    # 8.0.12--8.0.13
    depends_on("boost@1.67.0 cxxstd=98", type="build", when="@8.0.12:8.0.13 cxxstd=98")
    depends_on("boost@1.67.0 cxxstd=11", type="build", when="@8.0.12:8.0.13 cxxstd=11")
    depends_on("boost@1.67.0 cxxstd=14", type="build", when="@8.0.12:8.0.13 cxxstd=14")
    depends_on("boost@1.67.0 cxxstd=17", type="build", when="@8.0.12:8.0.13 cxxstd=17")
    # 8.0.11
    depends_on("boost@1.66.0 cxxstd=98", type="build", when="@8.0.11 cxxstd=98")
    depends_on("boost@1.66.0 cxxstd=11", type="build", when="@8.0.11 cxxstd=11")
    depends_on("boost@1.66.0 cxxstd=14", type="build", when="@8.0.11 cxxstd=14")
    depends_on("boost@1.66.0 cxxstd=17", type="build", when="@8.0.11 cxxstd=17")
    # 5.7.X
    depends_on("boost@1.59.0 cxxstd=98", when="@5.7.0:5.7 cxxstd=98")
    depends_on("boost@1.59.0 cxxstd=11", when="@5.7.0:5.7 cxxstd=11")
    depends_on("boost@1.59.0 cxxstd=14", when="@5.7.0:5.7 cxxstd=14")
    depends_on("boost@1.59.0 cxxstd=17", when="@5.7.0:5.7 cxxstd=17")

    # TODO: replace this with an explicit list of components of Boost,
    # for instance depends_on('boost +filesystem')
    # See https://github.com/spack/spack/pull/22303 for reference
    depends_on(Boost.with_default_variants, when="@5.7:")

    depends_on("rpcsvc-proto")
    depends_on("ncurses")
    depends_on("openssl@3:", when="@8.0.34:")
    depends_on("openssl@:2", when="@:8.0.34")
    depends_on("libtirpc", when="@5.7.0: platform=linux")
    depends_on("libedit", type=["build", "run"])
    depends_on("perl", type=["build", "test"], when="@:7")
    depends_on("bison@2.1:", type="build")
    depends_on("m4", type="build", when="@develop platform=solaris")
    depends_on("cyrus-sasl", when="@:5.7")

    patch("fix-no-server-5.5.patch", level=1, when="@5.5.0:5.5")

    @property
    def command(self):
        return Executable(self.prefix.bin.mysql_config)

    @property
    def libs(self):
        return find_libraries("libmysqlclient", root=self.prefix, recursive=True)

    def url_for_version(self, version):
        url = "https://dev.mysql.com/get/Downloads/MySQL-{0}/mysql-{1}.tar.gz"
        return url.format(version.up_to(2), version)

    def cmake_args(self):
        spec = self.spec
        options = []
        if "boost" in spec:
            options.append("-DBOOST_ROOT={0}".format(spec["boost"].prefix))
            options.append("-DLOCAL_BOOST_DIR={0}".format(spec["boost"].prefix))
        if "+client_only" in self.spec:
            options.append("-DWITHOUT_SERVER:BOOL=ON")
        options.append("-DWITH_EDITLINE=system")
        options.append("-Dlibedit_INCLUDE_DIR={0}".format(spec["libedit"].prefix.include))
        options.append("-Dlibedit_LIBRARY={0}".format(spec["libedit"].libs.directories[0]))
        return options

    def _fix_dtrace_shebang(self, env):
        # dtrace may cause build to fail because it uses
        # '/usr/bin/python' in the shebang. To work around that we copy
        # the original script into a temporary folder, and change the
        # shebang to '/usr/bin/env python'. Treatment adapted from that
        # used in glib recipe per M. Culpo @b2822b258.
        dtrace = which("dtrace").path
        dtrace_copy_path = os.path.join(tempfile.mkdtemp(), "dtrace-copy")
        dtrace_copy = os.path.join(dtrace_copy_path, "dtrace")
        mkdirp(dtrace_copy_path)
        copy(dtrace, dtrace_copy)
        filter_file(
            "^#!/usr/bin/python",
            "#!/usr/bin/env {0}".format(os.path.basename(self.spec["python"].command)),
            dtrace_copy,
        )
        # To have our own copy of dtrace in PATH, we need to
        # prepend to PATH the temporary folder where it resides.
        env.prepend_path("PATH", dtrace_copy_path)

    def setup_build_environment(self, env):
        cxxstd = self.spec.variants["cxxstd"].value
        flag = getattr(self.compiler, "cxx{0}_flag".format(cxxstd))
        if flag:
            env.append_flags("CXXFLAGS", flag)
        if cxxstd != "98":
            if int(cxxstd) > 11:
                env.append_flags("CXXFLAGS", "-Wno-deprecated-declarations")
            if int(cxxstd) > 14:
                env.append_flags("CXXFLAGS", "-Wno-error=register")
                
```
Thanks! Hopefully new versions above 8.0.29 will be integrated in the next spack version (together with all other fixes)
I think there is another issue related to OpenSSL 3, which appears if you try to build py-sqlalchemy backend=pymysql,mysql (of which mysql is a dependency) but i can't remember which other dependency it is right now, and i've had so many issues that i'm not even sure of anything right now :)
The build finished OK.
This was Spack v0.21, MySQL 8.0.35 on linux-ubuntu22.04-x86_64_v3/gcc-11.4.0 built with ^openssl@3.1.3.

Resolving patch:
diff --git a/var/spack/repos/builtin/packages/mysql/package.py b/var/spack/repos/builtin/packages/mysql/package.py
--- a/var/spack/repos/builtin/packages/mysql/package.py
+++ b/var/spack/repos/builtin/packages/mysql/package.py
@@ -16,6 +16,7 @@ class Mysql(CMakePackage):
     homepage = "https://www.mysql.com/"
     url = "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15.tar.gz"
 
+    version("8.0.35", sha256="917c5ed38704e99211185ce4be24e33a8c19c91241ed73af4181a6f38d1574c2")
     version("8.0.29", sha256="512170fa6f78a694d6f18d197e999d2716ee68dc541d7644dd922a3663407266")
     version("8.0.19", sha256="a62786d67b5e267eef928003967b4ccfe362d604b80f4523578e0688f5b9f834")
     version("8.0.18", sha256="4cb39a315298eb243c25c53c184b3682b49c2a907a1d8432ba0620534806ade8")
@@ -52,7 +53,7 @@ class Mysql(CMakePackage):
     variant("client_only", default=False, description="Build and install client only.")
     variant(
         "cxxstd",
-        default="14",
+        default="17",
         values=("98", "11", "14", "17"),
         multi=False,
         description="Use the specified C++ standard when building.",
@@ -67,6 +68,7 @@ class Mysql(CMakePackage):
     provides("mysql-client")
 
     # https://dev.mysql.com/doc/refman/8.0/en/source-installation.html
+    # https://dev.mysql.com/doc/refman/8.0/en/source-configuration-options.html
 
     # See CMAKE_MINIMUM_REQUIRED in CMakeLists.txt
     depends_on("cmake@3.1.0:", type="build", when="@5.7.0:5.7 platform=win32")
@@ -83,6 +85,8 @@ class Mysql(CMakePackage):
 
     # Each version of MySQL requires a specific version of boost
     # See BOOST_PACKAGE_NAME in cmake/boost.cmake
+    # 8.0.35
+    depends_on("boost@1.77.0 cxxstd=17", type="build", when="@8.0.35 cxxstd=17")
     # 8.0.29
     depends_on("boost@1.77.0 cxxstd=98", type="build", when="@8.0.29 cxxstd=98")
     depends_on("boost@1.77.0 cxxstd=11", type="build", when="@8.0.29 cxxstd=11")
@@ -124,9 +128,21 @@ class Mysql(CMakePackage):
     # See https://github.com/spack/spack/pull/22303 for reference
     depends_on(Boost.with_default_variants, when="@5.7:")
 
+    with when("@8.0.35:"):
+        depends_on("openssl@3:")
+        requires("cxxstd=17")
+
+    depends_on("zstd", when="@8.0.18:")
+
+    depends_on("patchelf", type="build")
+    depends_on("curl")
+    depends_on("zlib-api")
+    depends_on("libevent")
+    depends_on("lz4")
+
     depends_on("rpcsvc-proto")
     depends_on("ncurses")
-    depends_on("openssl")
+    depends_on("openssl@:2", when="@:8.0.29")
     depends_on("libtirpc", when="@5.7.0: platform=linux")
     depends_on("libedit", type=["build", "run"])
     depends_on("perl", type=["build", "test"], when="@:7")
@@ -150,14 +166,28 @@ def url_for_version(self, version):
 
     def cmake_args(self):
         spec = self.spec
-        options = []
-        if "boost" in spec:
-            options.append("-DBOOST_ROOT={0}".format(spec["boost"].prefix))
-        if "+client_only" in self.spec:
-            options.append("-DWITHOUT_SERVER:BOOL=ON")
-        options.append("-DWITH_EDITLINE=system")
-        options.append("-Dlibedit_INCLUDE_DIR={0}".format(spec["libedit"].prefix.include))
-        options.append("-Dlibedit_LIBRARY={0}".format(spec["libedit"].libs.directories[0]))
+        options = [
+            self.define("REPRODUCIBLE_BUILD", True),
+            self.define("WITH_CURL", spec["curl"].prefix),
+            self.define("WITH_EDITLINE", "system"),
+            self.define("WITH_LIBEVENT", "system"),
+            self.define("WITH_LZ4", "system"),
+            self.define("WITH_SSL", spec["openssl"].prefix),
+            self.define("WITH_ZLIB", "system"),
+            self.define_from_variant("WITHOUT_SERVER", "client_only"),
+        ]
+
+        if spec.satisfies("@5.7:"):
+            options.extend(
+                [
+                    self.define("WITH_BOOST", spec["boost"].prefix),
+                    self.define("LOCAL_BOOST_DIR", spec["boost"].prefix),
+                ]
+            )
+
+        if spec.satisfies("@8.0.18:"):
+            options.extend([self.define("WITH_ZSTD", "system")])
+
         return options
 
     def _fix_dtrace_shebang(self, env):


Test patch: