mysqlclient-sys icon indicating copy to clipboard operation
mysqlclient-sys copied to clipboard

use mysql_config to generate linker args

Open nerdrew opened this issue 7 years ago • 7 comments

This adds support for percona-server.

nerdrew avatar Mar 22 '17 06:03 nerdrew

Bump (I just updated and ran into it again).

nerdrew avatar Sep 28 '17 05:09 nerdrew

@sgrif Can this get merged? I ran into it again. Hard to remember how to fix it every time :)

nerdrew avatar Aug 02 '18 03:08 nerdrew

Can you explain more what this does and why it's needed? The current behavior already uses mysql_config as its fallback case.

sgrif avatar Aug 02 '18 20:08 sgrif

I get this error:

% cargo install diesel_cli
...
Compiling diesel_cli v1.3.1
error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-m64" " ... "-framework" "Security" "-lsqlite3" "-lpq" "-lmysqlclient" "-lSystem" "-lresolv" "-lpthread" "-lc" "-lm"
  = note: ld: warning: text-based stub file /System/Library/Frameworks//Security.framework/Security.tbd and library file /System/Library/Frameworks//Security.framework/Security are out of sync. Falling back to library file for linking.
          ld: library not found for -lmysqlclient
          clang: error: linker command failed with exit code 1 (use -v to see invocation)


error: aborting due to previous error

It installs ok if with my change. I'm on a mac and use homebrew. I don't have mysql installed, but I do have percona-server installed (https://github.com/Homebrew/homebrew-core/blob/master/Formula/percona-server.rb). It provides the same binaries, but the libraries have different names.

My output:

% mysql_config --libs
-L/usr/local/Cellar/percona-server/5.6.37-82.2/lib  -lperconaserverclient  -lz -lssl -lcrypto

Am I doing something wrong so I don't use mysql_config in the existing release? Do I need a flag / config to use it?

nerdrew avatar Aug 03 '18 16:08 nerdrew

Thoughts on merging this?

nerdrew avatar Sep 24 '18 16:09 nerdrew

@nerdrew I'm facing the same issue, and I've found an easy work-around that seems to do the trick.

brew install mysql-client # keg-only, so it won't conflict with percona binaries
export PKG_CONFIG_PATH="/usr/local/opt/mysql-client/lib/pkgconfig"
cargo install diesel_cli --no-default-features --features=mysql

mortenscheel avatar Dec 29 '19 11:12 mortenscheel

@sgrif I'm running into this as well. The issue here is that the percona-server package in homebrew does not install a link for libmysqlclient.dylib -> libperconaserverclient.dylib. The percona-server implementation is a complete replacement for the mysqlclient implementation and should be totally safe to merge.

klieth avatar Apr 13 '20 23:04 klieth

Closed as this is implemented by #40

weiznich avatar May 11 '24 07:05 weiznich