Missing mysqlclient library when installing Sphinx with Homebrew - mysql

I am trying to install Sphinx search engine on my Mac 10.8.1.
My MAMP environment is set up using MacPorts. Since Sphinx port is only at 0.9.9, I turn to Homebrew to install the latest stable version 2.0.5.
I ran into a few errors at first, like missing mysql_config (which was solved by making a link to mysql_config5). But now, when I try to install Sphinx, it tells me:
library not found for -lmysqlclient
But under /opt/local/lib/mysql5/mysql/, I found the following files:
libmysqlclient.16.dylib
libmysqlclient.a
libmysqlclient.dylib -> libmysqlclient.16.dylib
libmysqlclient.la
libmysqlclient_r.16.dylib
libmysqlclient_r.a
libmysqlclient_r.dylib -> libmysqlclient_r.16.dylib
libmysqlclient_r.la
What am I missing here?
Thanks,
Milo

Homebrew won't look under the /opt/local tree for libraries (neither will most compilers, unless explicitly told to do so). Make sure the MySQL libraries are installed or symlinked under /usr/local.

Related

Library not loaded: libssl.1.1.dylib (LoadError) when trying to run rails server and connect to mysql

Recently I updated my MacOS to Monterey 12.3 which included updates for xcode.
After that I am not able to run the rails application that I have been working on. I keep getting this error when I try to spin up the server.
I have tried installing and removing mysql different ways. Both using a brew install and DMG file from mysql website.
I am able to access the database instance through my command line but I think they issue is that it I can't connect from application. Anyone else having similar issues?
here is the full error
/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/activesupport-6.0.3.6/lib/active_support/dependencies.rb:324:in `require': dlopen(/Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle, 0x0009): Library not loaded: libssl.1.1.dylib (LoadError)
Referenced from: /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
Reason: tried: 'libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file), '/Users/gus/gus_project/Gus2021/libssl.1.1.dylib' (no such file), '/usr/local/lib/libssl.1.1.dylib' (no such file), '/usr/lib/libssl.1.1.dylib' (no such file) - /Users/gus/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/mysql2-0.5.3/lib/mysql2/mysql2.bundle
If anyone runs into this problem, this is what solved my issue.
paths to openssl needed to be updated.
gem install mysql2 -- --with-ldflags=-L/opt/homebrew/opt/openssl#1.1/lib --with-cppflags=-I/opt/homebrew/opt/openssl#1.1/include
bundle install
Obviously this is for openssl install with brew install version 1.1
I was able to get it working with this:
brew install openssl
bundle config build.mysql2 --
--with-ldflags=-L/opt/homebrew/opt/openssl#1.1/lib
--with-cppflags=-I/opt/homebrew/opt/openssl#1.1/include
brew install openssl#1.1
Do all the export path things, and make sure to link openssl#1.1
brew link openssl#1.1 --force
I had similar issue with postgresql, which raises error while running psql -d database:
Library not loaded: '/opt/homebrew/opt/openssl#1.1/lib/libssl.1.1.dylib'
In my case which I have openssl#3 and openssl# the solution is:
brew install openssl#1.1
brew link openssl#1.1 --force
Then reinstall postgresql with homebrew.
I also had my zshrc exporting the following ENV variable though I'm not quite sure if it's related:
export PATH="/opt/homebrew/opt/openssl#1.1/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/openssl#1.1/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl#1.1/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl#1.1/lib/pkgconfig"
For someone who runs into the same issue as mine!

Library not loaded: /usr/local/opt/mysql/lib/libmysqlclient.21.dylib error when it does not exist

I have looked at similar posts but could not find the solution to my problem. I had installed mySQL 8.0 version using homebrew on MacOS but then needed to downgrade it to mySql 5.6. I uninstalled the 8.0 version completely and deleted any left over files.I then installed the 5.6.1 using the native mySQL dmg package for Mac. On running my python project I get the Library not loaded error for /usr/local/opt/mysql/lib/libmysqlclient.21.dylib referenced from the _mysql.cpython-36m-darwin.so. I am not sure why this location is getting referenced as I have only libmysqlclient.18.dylib on my system under a different folder usr/local/mysql/lib . How can I fix the issue ?
My project with Python 3.6 was lookin for libmysqlclient.21.dylib.
I installed brew install mysql-client. It installed mysql-client 8.0. it has libmysqlclient.21.dylib. Where as i wanted to use mysql#5.6.
So I copied the libmysqlclient.21.dylib from /usr/local/Cellar/mysql-client/8.0.19/lib to /usr/local/lib/
sudo ln -s /usr/local/Cellar/mysql-client/8.0.19/lib/libmysqlclient.21.dylib /usr/local/lib/libmysqlclient.21.dylib

libtcl8.4.so is needed by python-2.7.10-1.ppc AIX 7.1

I'm trying to install apache on aix 7.1. I'm following : https://developer.ibm.com/articles/au-aix-install-config-apache-subversions/
but i'm stuck at rpm -ivh *.rpm because of dependencies.
Getting an error:
libtcl8.4.so is needed by python-2.7.10-1.ppc
libtk8.4.so is needed by python-2.7.10-1.ppc
I've tried installing tcl and tk packages and installed.
tcl-8.6.7-1.aix5.1.ppc.rp
tk-8.6.7-1.aix5.1.ppc.rpm
but i'm still getting the same error. How do i resolve this issue.
This problem can occur in other contexts, as well. I ran into it when trying to install yum on an AIX 7.1 system. It uses the same ancient versions of python and tk/tcl.
I found the answer here: https://www.djouxtech.net/posts/aix-yum-installation/
The libtcl and libtk libraries must be version 8.4.x, 8.6.x will not work.
They come not from another RPM, but are native to AIX. You have to install the packages tk.base and tcl.base from your AIX install media.
The command you need will be similar to this:
installp -a -d <location of your media> tk.base
installp -a -d <location of your media> tcl.base
Disclaimer: I have not yet tested this.

CommandT causing macvim to segv

Using ruby 2.0.0. mvim is built with ruby support enabled. Use the .vba approach to install the plugin. Now whenever I launch mvim it SEGVs. If I remove the CommandT plugin all is back to normal.
THe architecture flag is -arch x86_64 so I didn't override the arch flag to 32 bit when running make in the ./ruby/command-t directory.
Also tried to uninstall and install mvim but no luck.
Any ideas?
After some more googling found the link: http://arjanvandergaag.nl/blog/compiling-vim-with-ruby-support.html. So yes, vim and CommandT were compiled with different versions of ruby support.
Did the following:
brew edit macvim
Updated --with-ruby-command to point to rvm ruby path which CommandT was using.
brew uninstall macvim
brew install macvim
The original Formula had --with-ruby-command set to ${RUBY_PATH}. So my solution is a little hacky. What's the right way to get brew to follow rvm default ruby path?

libmysqlclient15-dev on macs?

Does OSX need an install of libmysqlclient15-dev? I'm trying to compile a gem that is failing and a lot of sources says to install "libmysqlclient15-dev" but I only see this for Linux, not OSX. Am I missing something here?
brew install mysql
fixed this for me
I know this is old, but google got me here. So let's say the solution in 2018 for python3 on OSX.
brew install mysql-client
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
pip install mysqlclient
I just had the same problem and only got a partial working solution.
Here are the steps I made to make it work:
brew install mysql-client
brew install mysql-connector-c
IF YOU HAVE ZSH:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
ELSE:
echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
Now for the installation itself:
LDFLAGS=-L< your openssl lib folder location > pip install mysqlclient==< version >
for example:
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient==1.3.12
If you are using the mysql dmg file to install mysql you will need to edit your ~/.bash_profile and include this:
export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH
brew install mysql
then
arch -x86_64 gem install mysql2 -v 0.5.3 -- --srcdir=/usr/local/mysql/include
Afterwards I was able to run bundle install.
Copied from Bragadeesh Jegannathan's blog post
Yes you will need to install this. For example if you are trying to install the mysql gem you will need the headers for the mysql library. This is because some gems need to compile native extensions, so they need the header files for any 3rd party libraries that the extensions uses.
On Mac OS X I recommend using MacPorts to manage the installation of these libraries/headers.
Those instructions are for Debian type Linuxes. The closest thing to Debian for OS X is Fink. After getting that installed and set up, you can say fink install mysql-unified-dev to get essentially the same thing as asking for libmysqlclient15-dev on a Debian or Ubuntu type system.
Beware that Fink installs its packages in /sw, and not all build scripts know to look there for libraries and headers. You might have to give custom build options to get it to figure this out.
A path that may be more successful is to simply download the MySQL 5.0 package for Mac OS X. That should include the same development files as libmysqlclient15-dev, and as a bonus will put them in places more likely to be found by your gem.
(Why 5.0, by the way? Because that's what corresponds to ABI version 15, which your package apparently requires. Maybe it will in fact work with 5.1, or 5.4, or 6.0, but that would be a risk you'd have to decide to take on your own.)