Bug #115421 cmake files hard coded to homebrew on macOS/Apple platforms
Submitted: 24 Jun 23:07 Modified: 28 Jun 10:21
Reporter: John Hoyt Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:8.2, 8.3, 8.4 OS:MacOS (any)
Assigned to: CPU Architecture:Any
Tags: macports

[24 Jun 23:07] John Hoyt
Description:
Recent updates to mysql8 added logic to the cmake files for building on Apple platforms.  Unfortunately, the logic is hard-coded for homebrew users and does not work for non-homebrew users such as those who use macports as their package manager.

See the following for the bug report: https://trac.macports.org/ticket/70001
See the following for the bandaid resolution: https://github.com/macports/macports-ports/pull/24615

How to repeat:
compile on a mac using macports instead of homebrew

Suggested fix:
update the cmake files to include logic for generic apple installs and macports

Patch files for cmake (untested on homebrew) can be provided, alternatively, they can be found on the macports PR: https://github.com/macports/macports-ports/pull/24615#issuecomment-2187257435
[25 Jun 10:11] MySQL Verification Team
Hi Mr. Hoyt,

Thank you for your bug report.

However, your report lacks lot's of information ......

We build our MacOS binaries with cmake command line options using latest stable clang compiler.

We also use lot's of external libraries and utilities, but you have not reported what you are using, at all.

You have not described your problem fulyl, so we can not try to repeat it ......

We are waiting on your full feedback.

Can't repeat.
[25 Jun 11:37] Tor Didriksen
Hi John
Are you able to do cmake -DWITH_SSL=<path to macports installation>

I am quite reluctant to implementing an alternative "system" SSL for MacOS.
[25 Jun 11:51] MySQL Verification Team
Thank you, Tor.
[25 Jun 23:36] John Hoyt
here is the cmake output from the compiler.

The crux of the problem is that two cmake cfiles (copy_openssl_binary.cmake and ssl.cmake) are currently hard coded to use the homebrew path for libraries (/opt/homebrew/lib and /opt/homebrew/opt/openssl on arm or /usr/local/lib or /usr/local/opt/openssl on intel).

This doesn't work for users installing libraries from macports which stores libraries in /opt/local/lib and /opt/local/libexec/openssl3 

To reproduce, you will need to install libraries in a way that does not use homebrew
[25 Jun 23:37] John Hoyt
cmake output from patched compiler uploaded.
[25 Jun 23:38] John Hoyt
@Tor Didriksen - macports does build using the -DWITH_SSL=<path to macports installation> flag.

That's the issue, the cmake files are hard-coded to ignore this getting overridden by the homebrew based paths for all apple installs.
[25 Jun 23:41] John Hoyt
here's the cmake command:

/opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=/opt/local/libexec/openssl3 -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_opt_mports_macports-ports_databases_mysql8/mysql8/work/mysql-8.4.0 
DEBUG: system:  cd "/opt/local/var/macports/build/_opt_mports_macports-ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_PREFIX_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=/opt/local/libexec/openssl3 -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_opt_mports_macports-ports_databases_mysql8/mysql8/work/mysql-8.4.0
[26 Jun 8:34] Tor Didriksen
How about
cmake -DCMAKE_PREFIX_PATH=</path/to/custom/openssl> -DWITH_SSL="system"

Your SSL libraries should be treated as "system" and should *not* be copied.
[26 Jun 10:13] John Hoyt
Sadly, forcing -DCMAKE_PREFIX_PATH did not work on my first attempt.  The portfile (used in macports to setup the environment) may be over-riding something, so I'll keep digging.

Also, my apologies, I misrepresented the problem.  Everything compiles fine, it the link of the ssl dylibs that causes issues here.  In particular the use or rel paths for the libs.

At any rate, there's still a fundamental issue that hard-coded things to the homebrew way in the cmake files is not a good thing.  There are at least 4 packages managers on macOS (fink, homebre, nix, and macports).  Putting in hard-codes for just one for all Apple platforms is asking for trouble.  This can be automated with the search for the brew command or port command (and whatever the fink and nix teams use...).

cmake commands from the macport build process (patches removed):
Executing:  cd "/opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DCMAKE_PREFIX_PATH="/opt/local/libexec/openssl3" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/mysql-8.4.0 
DEBUG: system:  cd "/opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DCMAKE_PREFIX_PATH="/opt/local/libexec/openssl3" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/mysql-8.4.0
[26 Jun 10:21] MySQL Verification Team
Hi Mr. Hoyt,

You have not answered a question from our Mr. Didriksen about the alternative SSL library.

We will not change the SSL library , not the make nor the version.

Thank you.
[26 Jun 10:41] John Hoyt
"You have not answered a question from our Mr. Didriksen about the alternative SSL library."

What question did I miss?  I tried the suggested cmake flags with the system flag.  Both of these flags are present in the cmake commands listed. 

  -DCMAKE_PREFIX_PATH="${prefix}/libexec/openssl3"
  -DWITH_SSL=system
[26 Jun 10:54] MySQL Verification Team
Hi Mr. Hoyt,

You have filed this report as a bug.

However, it is not a bug, since the scripts are hard coded for homebrew installations.

Hence, your report could, at best, be considered as a feature request.

Would you consider that option ???

Also, currently supported versions are 8.0 and 8.4.
[26 Jun 11:40] Tor Didriksen
This is indeed a feature request, and a relevant one.

The problem is that our Mac resources are quite scarce.
The homebrew solution was implemented because we have a handful of developers on Mac, and I wanted to make their lives slightly simpler (we have hundreds of devs on Linux)

Internally, we only build with -DWITH_SSL=<some path to a standalone package>
because we do not want to ship MySQL software which depend on any external package managers. The SSL libraries are in this case copied into the build directory, and all binaries are linked with the copied files. For "system" libraries, we should *not* copy the libs, but rather link directly with the libraries provided.

cmake -DCMAKE_PREFIX_PATH=</path/to/custom/openssl> -DWITH_SSL="system"

*should* work for your case, unless macports has some weird layout of headers/libraries.

Could you re-try that, and skip all the other cmake arguments, let the cmake code pick defaults, which will be the "bundled" version of things.

A *lot* of those third party libs depend on libcrypto, and it is important that we  build/link with the same SSL libs everywhere.

I haven't tried the -DCMAKE_PREFIX_PATH trick with anything else than SSL, so it probably does not work.
[26 Jun 22:37] John Hoyt
"*should* work for your case, unless macports has some weird layout of
headers/libraries."

Alas, it does in many cases.  Most are in /opt/local/, others are in /opt/local/libexec due to multiple version conflicts (think openssl1.1 vs openssl3 which both go in libexec).  Unlike homebrew, macports doesn't play the symlink game to the preferred version.

Also, macports prefers ports to build off their openssl / libcrytpo libraries, so many of the support libraries do in fact build off the macports versions.

I've attempted to trim the cmake flags down to -DWITH_SSL=system and -DCMAKE_PREFIX_PATH, but the macports build process still adds a ton of flags. The result still performed the copy of the openssl / libcrypto files.

These are the ones added.  I can force remove some of them in the portfile, if you see any you'd suggest removing please let me know.  I'll keep hacking at the portfile to see I can get it to use the macports "system" openssl libraries without copying them.  I'm beginning to wonder if the homebrew copy workaround was implemented due to similar issues.

Executing:  cd "/opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DCMAKE_PREFIX_PATH="/opt/local/libexec/openssl3" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/mysql-8.4.0 
DEBUG: system:  cd "/opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/build" && /opt/local/bin/cmake -G "CodeBlocks - Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/opt/local" -DCMAKE_INSTALL_NAME_DIR="/opt/local/lib" -DCMAKE_SYSTEM_PREFIX_PATH="/opt/local;/usr" -DCMAKE_C_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_Fortran_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_OBJCXX_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_ISPC_COMPILER_LAUNCHER=/opt/local/bin/ccache -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_OBJC_COMPILER="$CC" -DCMAKE_OBJCXX_COMPILER="$CXX" -DCMAKE_POLICY_DEFAULT_CMP0025=NEW -DCMAKE_POLICY_DEFAULT_CMP0060=NEW -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_COLOR_MAKEFILE=ON -DCMAKE_FIND_FRAMEWORK=LAST -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_MAKE_PROGRAM=/usr/bin/make -DCMAKE_MODULE_PATH="/opt/local/share/cmake/Modules" -DCMAKE_INSTALL_RPATH=";/opt/local/lib" -Wno-dev -DWITH_DEBUG=OFF -DWITH_UNIT_TESTS=OFF -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF -DCMAKE_INSTALL_NAME_DIR:PATH="/opt/local/lib/mysql8/mysql" -DCMAKE_PREFIX_PATH="/opt/local/libexec/openssl3" -DBISON_EXECUTABLE="/opt/local/bin/bison" -DFORCE_UNSUPPORTED_COMPILER=ON -DINSTALL_LAYOUT:STRING=MACPORTS -DMYSQL_DATADIR:PATH="/opt/local/var/db/mysql8" -DMYSQL_UNIX_ADDR:PATH="/opt/local/var/run/mysql8/mysqld.sock" -DSYSCONFDIR:PATH="/opt/local/etc/mysql8" -DWITH_UNIT_TESTS=OFF -DWITH_CURL=system -DWITH_EDITLINE=system -DWITH_FIDO=system -DWITH_ICU=system -DWITH_LDAP=system -DWITH_LZ4=system -DWITH_PROTOBUF=system -DWITH_SASL=system -DWITH_SSL=system -DWITH_ZLIB=system -DWITH_ZSTD=system -DWITH_ROUTER:BOOL=OFF -DOPENSSL_ROOT_DIR=/opt/local/libexec/openssl3 -DOPENSSL_INCLUDE_DIR=/opt/local/libexec/openssl3/include -DWITH_SSL=/opt/local/libexec/openssl3 -DCMAKE_OSX_ARCHITECTURES="arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET="14.0" -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk" /opt/local/var/macports/build/_Users_jhoyt_macports_ports_databases_mysql8/mysql8/work/mysql-8.4.0
[26 Jun 22:50] John Hoyt
It appears that the macports build environment is automatically adding 
-DWITH_SSL=/opt/local/libexec/openssl3 to the cmake command.

I'll try to remove this flag and see if that gets us to the system ssl based build.

BTW Tor - Thank you for the help on this.
[26 Jun 23:41] John Hoyt
I think I got it working with the "system" openssl.  I had to make sure to remove these three cmake configure lines:
  -DOPENSSL_ROOT_DIR=[openssl::install_area]
  -DOPENSSL_INCLUDE_DIR=[openssl::include_dir]
  -DWITH_SSL=[openssl::install_area]

I believe this resolves the issue I was hoping to address in a fashion.

I would still encourage the mysql8 team to take a hard look at the comments and implementation if the ssl cmake files to remove homebrew hard codes as these will cause others confusion if they attempt to use the copy mechanism like the macports team did.
[26 Jun 23:41] John Hoyt
@Tor - thank you once again for your help, support, and professionalism.
[27 Jun 10:18] MySQL Verification Team
Thank you Mr. Hoyt, 

For your effort and your kind words .....
[28 Jun 7:43] Tor Didriksen
good to hear that you finally got things working.

Another tip: you can try "system" ICU and protobuf as well,
it will save you some build time (and disk space).
I haven't tried it myself, but it is builtin cmake functionality, so it should work.

The other bundled libraries are fairly small, so they won't make much of a difference.
[28 Jun 10:21] John Hoyt
Thank you for the tip!

The "system" trick seems to be working for icu, protobuf and editline.

Is there a way to point the build to the macports "system" library header files? I think cmake is finding them, but it never hurts to explicitly set the values.
[28 Jun 10:42] Tor Didriksen
You shouldn't set include directives for system headers, cmake should have set it up correctly for you. Do a 'make VERBOSE=1' (I use make rather than ninja) and see what include flags are given to the compiler.

If it doesn't build, I guess you can do cmake 
-DCMAKE_C_FLAGS="-isystem <some path>"
similarly for CMAKE_CXX_FLAGS