Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql 8.0.33 causes issues when building mysqlclient Python package #130258

Closed
4 tasks done
vbarbaresi opened this issue May 5, 2023 · 26 comments · Fixed by #131207
Closed
4 tasks done

mysql 8.0.33 causes issues when building mysqlclient Python package #130258

vbarbaresi opened this issue May 5, 2023 · 26 comments · Fixed by #131207
Labels
outdated PR was locked due to age upstream issue An upstream issue report is needed

Comments

@vbarbaresi
Copy link

vbarbaresi commented May 5, 2023

brew gist-logs <formula> link OR brew config AND brew doctor output

brew config
HOMEBREW_VERSION: 4.0.16-41-g8c059bb
brew ORIGIN: https://github.com/Homebrew/brew
HEAD: 8c059bba279f4b72b783fca91746d14b6286e6fc
Last commit: 81 minutes ago
Core tap origin: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 482f27271966a2712680195430ca58c37717c765
dCore tap last commit: 3 months ago
Core tap branch: master
Core tap JSON: 05 May 15:55 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: ["--require-sha"]
HOMEBREW_MAKE_JOBS: 10
HOMEBREW_NO_INSECURE_REDIRECT: set
Homebrew Ruby: 2.6.10 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: 10-core 64-bit arm_firestorm_icestorm
Clang: 14.0.0 build 1400
Git: 2.40.0 => /opt/homebrew/bin/git
oCurl: 7.87.0 => /usr/bin/curl
macOS: 12.6.5-arm64
CLT: 14.2.0.0.1.1668646533
Xcode: N/A
Rosetta 2: false
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: Putting non-prefixed coreutils in your path can cause GMP builds to fail.

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  virtualenv

Verification

  • My "brew doctor output" says Your system is ready to brew. and am still able to reproduce my issue.
  • I ran brew update and am still able to reproduce my issue.
  • I have resolved all warnings from brew doctor and that did not fix my problem.
  • I searched for recent similar issues at https://github.com/Homebrew/homebrew-core/issues?q=is%3Aissue and found no duplicates.

What were you trying to do (and why)?

Trying to install mysqlclient Python package after upgrading mysql brew package to 8.0.33
pip install mysqlclient

What happened (include all command output)?

pip install mysqlclient
Collecting mysqlclient
  Downloading mysqlclient-2.1.1.tar.gz (88 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 8.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mysqlclient (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]
      mysql_config --version
      ['8.0.33']
      mysql_config --libs
      ['-L/opt/homebrew/Cellar/mysql/8.0.33/lib', '-lmysqlclient', '-lzlib', '-lzstd', '-L/opt/homebrew/opt/openssl@1.1/lib', '-lssl', '-lcrypto', '-lresolv']
      mysql_config --cflags
      ['-I/opt/homebrew/Cellar/mysql/8.0.33/include/mysql']
      ext_options:
        library_dirs: ['/opt/homebrew/Cellar/mysql/8.0.33/lib', '/opt/homebrew/opt/openssl@1.1/lib']
        libraries: ['mysqlclient', 'zlib', 'resolv']
        extra_compile_args: ['-std=c99']
        extra_link_args: []
        include_dirs: ['/opt/homebrew/Cellar/mysql/8.0.33/include/mysql']
        extra_objects: []
        define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-12-arm64-cpython-39
      creating build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/__init__.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/_exceptions.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/connections.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/converters.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/cursors.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/release.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/times.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      creating build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/__init__.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/CR.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/ER.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/FLAG.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.macosx-12-arm64-cpython-39
      creating build/temp.macosx-12-arm64-cpython-39/MySQLdb
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/opt/homebrew/Cellar/mysql/8.0.33/include/mysql -I/private/tmp/mysql_test_venv/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-12-arm64-cpython-39/MySQLdb/_mysql.o -std=c99
      clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk build/temp.macosx-12-arm64-cpython-39/MySQLdb/_mysql.o -L/opt/homebrew/Cellar/mysql/8.0.33/lib -L/opt/homebrew/opt/openssl@1.1/lib -lmysqlclient -lzlib -lresolv -o build/lib.macosx-12-arm64-cpython-39/MySQLdb/_mysql.cpython-39-darwin.so
      ld: library not found for -lzlib
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient

What did you expect to happen?

I expected mysqlclient setup to be able to use mysql package (and zlib) with no issue

mysql_config --libs has changed its output between 8.0.32 and 8.0.33 following this commit: 9aaec7f

Now -lzlib is returned

Step-by-step reproduction instructions (by running brew commands)

mysql_config --libs
-L/opt/homebrew/Cellar/mysql/8.0.33/lib -lmysqlclient -lzlib  -lzstd -L/opt/homebrew/opt/openssl@1.1/lib -lssl -lcrypto -lresolv

Here you can see the added -lzlib flag

Now trying to install mysqlclient fails:

pip install mysqlclient
Collecting mysqlclient
  Downloading mysqlclient-2.1.1.tar.gz (88 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 88.1/88.1 kB 8.9 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: mysqlclient
  Building wheel for mysqlclient (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for mysqlclient (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [43 lines of output]
      mysql_config --version
      ['8.0.33']
      mysql_config --libs
      ['-L/opt/homebrew/Cellar/mysql/8.0.33/lib', '-lmysqlclient', '-lzlib', '-lzstd', '-L/opt/homebrew/opt/openssl@1.1/lib', '-lssl', '-lcrypto', '-lresolv']
      mysql_config --cflags
      ['-I/opt/homebrew/Cellar/mysql/8.0.33/include/mysql']
      ext_options:
        library_dirs: ['/opt/homebrew/Cellar/mysql/8.0.33/lib', '/opt/homebrew/opt/openssl@1.1/lib']
        libraries: ['mysqlclient', 'zlib', 'resolv']
        extra_compile_args: ['-std=c99']
        extra_link_args: []
        include_dirs: ['/opt/homebrew/Cellar/mysql/8.0.33/include/mysql']
        extra_objects: []
        define_macros: [('version_info', "(2,1,1,'final',0)"), ('__version__', '2.1.1')]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-12-arm64-cpython-39
      creating build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/__init__.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/_exceptions.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/connections.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/converters.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/cursors.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/release.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      copying MySQLdb/times.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb
      creating build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/__init__.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/CR.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/ER.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      copying MySQLdb/constants/FLAG.py -> build/lib.macosx-12-arm64-cpython-39/MySQLdb/constants
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.macosx-12-arm64-cpython-39
      creating build/temp.macosx-12-arm64-cpython-39/MySQLdb
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/opt/homebrew/Cellar/mysql/8.0.33/include/mysql -I/private/tmp/mysql_test_venv/include -I/opt/homebrew/opt/python@3.9/Frameworks/Python.framework/Versions/3.9/include/python3.9 -c MySQLdb/_mysql.c -o build/temp.macosx-12-arm64-cpython-39/MySQLdb/_mysql.o -std=c99
      clang -bundle -undefined dynamic_lookup -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk build/temp.macosx-12-arm64-cpython-39/MySQLdb/_mysql.o -L/opt/homebrew/Cellar/mysql/8.0.33/lib -L/opt/homebrew/opt/openssl@1.1/lib -lmysqlclient -lzlib -lresolv -o build/lib.macosx-12-arm64-cpython-39/MySQLdb/_mysql.cpython-39-darwin.so
      ld: library not found for -lzlib
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for mysqlclient
Failed to build mysqlclient

I have zlib installed though
I tried various combinations of LIBRARY_PATH, CFLAGS, LDFLAGS to try to have zlib found but with no success. Downgrading to mysql@5.7 solved the issue

@vbarbaresi vbarbaresi added the bug Reproducible Homebrew/homebrew-core bug label May 5, 2023
@randomradio

This comment was marked as duplicate.

@giuseppenovielli

This comment was marked as duplicate.

@azorius-mage

This comment was marked as duplicate.

@wsjgithub

This comment was marked as duplicate.

@so-so2456

This comment was marked as duplicate.

@ozquez
Copy link

ozquez commented May 7, 2023

This solve the issue

$ export MYSQLCLIENT_LDFLAGS=$(pkg-config --libs mysqlclient)
$ export MYSQLCLIENT_CFLAGS=$(pkg-config --cflags mysqlclient)
$ pip install mysqlclient

@SadieCat
Copy link
Contributor

SadieCat commented May 8, 2023

We are working around this bug for our GitHub Actions workflow with:

      - name: Work around Homebrew MySQL being broken
        run: |
          brew install zlib
          ln -sv $(brew --prefix zlib)/lib/libz.dylib $(brew --prefix)/lib/libzlib.dylib

@naquiroz
Copy link

naquiroz commented May 8, 2023

ln -sv $(brew --prefix zlib)/lib/libz.dylib $(brew --prefix)/lib/libzlib.dylib

Can confirm this works locally too in MacOS with 13.3.1 M1 Pro

@MasterOdin
Copy link
Contributor

MasterOdin commented May 8, 2023

This is also causing issues in installing the mysql2 gem for a Ruby project. Rolling back to mysql@5.7 worked for me, though doing the ln -sv did not.

@giuseppenovielli
Copy link

if you get this error -> zsh: command not found: pkg-config
Follow these steps:

mac os global environment run: ->
brew install pkg-config

in your virtualenv or other environment ->

export MYSQLCLIENT_LDFLAGS=$(pkg-config --libs mysqlclient)
export MYSQLCLIENT_CFLAGS=$(pkg-config --cflags mysqlclient)
pip install mysqlclient

@carlocab
Copy link
Member

carlocab commented May 9, 2023

This looks like an upstream issue to me. Has anyone checked if the same problem cannot be reproduced when installing mysqlclient using a non-Homebrew mysql 8.0.33?

@carlocab
Copy link
Member

carlocab commented May 9, 2023

Also, an alternative workaround might be to do

/usr/bin/sed -i .bak -e 's/\-lzlib/-lz/' "$(brew --prefix mysql)/bin/mysql_config"

@gromgit
Copy link
Member

gromgit commented May 9, 2023

The problem is that most (all?) other platforms with 8.0.33 deployed seem to do so with the MySQL-bundled zlib rather than an external library, and so mysql_config doesn't reference zlib at all:

ubuntu-22.10$ mysql_config --libs
-L/home/linuxbrew/.linuxbrew/Cellar/mysql/8.0.33/lib -lmysqlclient -lzlib  -lzstd -lssl -lcrypto -lresolv -lm

ubuntu-22.10$ /usr/bin/mysql_config --libs
-L/usr/lib/x86_64-linux-gnu -lmysqlclient -lzstd -lssl -lcrypto -lresolv -lm

@carlocab
Copy link
Member

carlocab commented May 9, 2023

The problem is that most (all?) other platforms with 8.0.33 deployed seem to do so with the MySQL-bundled zlib

Probably because MySQL insists on a very new version of Zlib, which is why we don't even use the one that ships with macOS.

@ytyng
Copy link

ytyng commented May 11, 2023

My solution is:

BREW_PREFIX=$(brew --prefix)
export LDFLAGS="-L${BREW_PREFIX}/opt/openssl/lib -L${BREW_PREFIX}/lib"
export CPPFLAGS="-I${BREW_PREFIX}/opt/openssl/include -I${BREW_PREFIX}/include"
export MYSQLCLIENT_LDFLAGS="${LDFLAGS} -L${BREW_PREFIX}/opt/zlib/lib"
export MYSQLCLIENT_CFLAGS="${CPPFLAGS} -I${BREW_PREFIX}/opt/zlib/include"
% pip install mysqlclient
Collecting mysqlclient
  Using cached mysqlclient-2.1.1-cp310-cp310-macosx_13_0_arm64.whl
Installing collected packages: mysqlclient
Successfully installed mysqlclient-2.1.1

(Mac m2)

@DuncSmith
Copy link

We're having similar issues with the ruby mysql2 gem, this solved it for us on macOS

gem install mysql2 -- --with-mysql-dir=$(brew --prefix mysql)

or if you're using bundler

bundle config --local build.mysql2 --with-mysql-dir=$(brew --prefix mysql)
bundle install

@eduardohferreiras
Copy link

@ytyng, tks for your solution!

It helped me, but now I'm getting a new error while trying to install mysqlclient:

MySQLdb/_mysql.c:29:10: fatal error: 'mysql.h' file not found
#include "mysql.h"
^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

Do you know something I can try?

Full error:

Courtesy Notice: Pipenv found itself running within a virtual environment, so it will automatically use that environment, instead of creating its own for any project. You can set PIPENV_IGNORE_VIRTUALENVS=1 to force pipenv to ignore that environment and create its own instead. You can set PIPENV_VERBOSITY=-1 to suppress this warning.
Installing mysql...
Resolving mysql...
Installing...
⠏ Installing mysql...[31m[1mError: [0m An error occurred while installing [32mmysql[0m!
Error text: Collecting mysql (from -r /var/folders/9b/w2649lps6vlbs1cytwslbj4c0000gn/T/pipenv-05h3b26l-requirements/pipenv-if_cc2ib-requirement.txt (line 1))
Using cached mysql-0.0.3-py3-none-any.whl (1.2 kB)
Collecting mysqlclient (from mysql->-r /var/folders/9b/w2649lps6vlbs1cytwslbj4c0000gn/T/pipenv-05h3b26l-requirements/pipenv-if_cc2ib-requirement.txt (line 1))
Using cached mysqlclient-2.1.1.tar.gz (88 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: mysqlclient
Building wheel for mysqlclient (setup.py): started
Building wheel for mysqlclient (setup.py): finished with status 'error'
Running setup.py clean for mysqlclient
Failed to build mysqlclient

[36m error: subprocess-exited-with-error

× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [42 lines of output]
mysql_config --version
['8.0.33']
ext_options:
library_dirs: ['/opt/homebrew/opt/openssl/lib', '/opt/homebrew/lib', '/opt/homebrew/opt/zlib/lib']
libraries: []
extra_compile_args: ['-std=c99']
extra_link_args: []
include_dirs: ['/opt/homebrew/opt/openssl/include', '/opt/homebrew/include', '/opt/homebrew/opt/zlib/include']
extra_objects: []
define_macros: [('version_info', "(2,1,1,'final',0)"), ('version', '2.1.1')]
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-13-arm64-cpython-311
creating build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/init.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/_exceptions.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/connections.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/converters.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/cursors.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/release.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
copying MySQLdb/times.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb
creating build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/init.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/CR.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/ER.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
copying MySQLdb/constants/FLAG.py -> build/lib.macosx-13-arm64-cpython-311/MySQLdb/constants
warning: build_py: byte-compiling is disabled, skipping.

  running build_ext
  building 'MySQLdb._mysql' extension
  creating build/temp.macosx-13-arm64-cpython-311
  creating build/temp.macosx-13-arm64-cpython-311/MySQLdb
  clang -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX13.sdk

-I/opt/homebrew/opt/openssl/include -I/opt/homebrew/include -Dversion_info=(2,1,1,'final',0) -D__version__=2.1.1 -I/opt/homebrew/opt/openssl/include
-I/opt/homebrew/include -I/opt/homebrew/opt/zlib/include -I/Users/eduardohenriqueferreirasilva/.local/share/virtualenvs/APIv1-nk1HYmIO/include
-I/opt/homebrew/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11 -c MySQLdb/_mysql.c -o
build/temp.macosx-13-arm64-cpython-311/MySQLdb/_mysql.o -std=c99
MySQLdb/_mysql.c:29:10: fatal error: 'mysql.h' file not found
#include "mysql.h"
^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for mysqlclient
ERROR: Could not build wheels for mysqlclient, which is required to install pyproject.toml-based projects
[0m
✘ Installation Failed

@dgholz
Copy link

dgholz commented May 11, 2023

I have zlib installed though

The zlib project is a bit unusual, and the library they provide is actually called libz. That's the value that should be passed to the linker's -l flag, not zlib.

I suspect the recently-added patch taken from https://bugs.mysql.com/bug.php?id=110745 (which MySQL haven't released yet) had changed how the value for that flag gets set.

@carlocab
Copy link
Member

carlocab commented May 11, 2023

TL;DR: This is an upstream bug. Can someone report this upstream please?

Looking at their build scripts, the linker flags come from the CMake variable CONFIG_CLIENT_LIBS

libs="$libs -l@LIBMYSQL_OS_OUTPUT_NAME@ @CONFIG_CLIENT_LIBS@"

which is set here

SET(CONFIG_CLIENT_LIBS "${CLIENT_LIBS}")

while CLIENT_LIBS seems to come from this macro call

EXTRACT_LINK_LIBRARIES(mysqlclient CLIENT_LIBS)

with the EXTRACT_LINK_LIBRARIES macro defined here.

Their scripts call Zlib ext::zlib which isn't handled properly by the EXTRACT_LINK_LIBRARIES macro

      ELSEIF (lib MATCHES "^ext::")
        STRING(REGEX MATCH "ext::([a-z]+)" MATCH_LIB "${lib}")
        SET(SYSTEM_LIB ${CMAKE_MATCH_1})
        SET(${var} "${${var}} -l${SYSTEM_LIB} ")

For reference, other libraries are called ext::zstd for libzstd or ext::curl for libcurl.

Maybe the fix is just to replace ext::zlib with ext::z everywhere?

Alternatively, ext::zlib could be special-cased in the EXTRACT_LINK_LIBRARIES macro.

@carlocab carlocab added upstream issue An upstream issue report is needed and removed bug Reproducible Homebrew/homebrew-core bug labels May 11, 2023
@carlocab
Copy link
Member

Once we have an upstream bug report I'm happy to apply a workaround directly to the formula.

@gromgit
Copy link
Member

gromgit commented May 12, 2023

Done: https://bugs.mysql.com/bug.php?id=111011

cazfi added a commit to cazfi/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
cazfi added a commit to cazfi/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
cazfi added a commit to freeciv/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
cazfi added a commit to cazfi/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
cazfi added a commit to freeciv/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
cazfi added a commit to freeciv/freeciv that referenced this issue May 12, 2023
Current version has issues
( Homebrew/homebrew-core#130258 )

Also adjust openssl paths as older version (1.1) of that
is the dependency for the 5.7 mysql-client

See osdn #48016

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
@kungfucop
Copy link

this works for me. thanks a lot.

@whg517
Copy link

whg517 commented May 17, 2023

This solve the issue

$ export MYSQLCLIENT_LDFLAGS=$(pkg-config --libs mysqlclient)
$ export MYSQLCLIENT_CFLAGS=$(pkg-config --cflags mysqlclient)
$ pip install mysqlclient

Ok, this is work for me !

os version: macOS Ventura 13.3.1(a)
mysql client version: 8.0.33
python mysqlclient version: 2.1.1

@tharzeez

This comment was marked as outdated.

@jkrauska
Copy link
Contributor

This also appears to be impacting the percona-xtrabackup Formula when it tries to build DBD:mysql.

@codecando-x
Copy link

This got me going on ubuntu:

sudo apt install libmysqlclient-dev

@github-actions github-actions bot added the outdated PR was locked due to age label Jul 26, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 26, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age upstream issue An upstream issue report is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.