Ld: library not found for -lssl while installing mysql2 gem. If MySQL libraries are not in path mysql2 may not load - - Setting libpath to /usr/local/opt. 教程需要安装mysqlclient,我执行 pip3 install mysqlclient会有许多报错,如下: ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'gcc' failed with exit status 1 但是我执行pip3 install mysql-client就能安装成功: Collecting mysql-client.
Excuse me while I vent for a while. I've just spent an age trying to get Python talking to MySQL via MySQL for Python. Which for unknown reasons seems to be a pain in the backside if you're on a Mac.
Ld Library Not Found For Lssl Mac Mysql Download
- If you get the following errer while installing the mysql2 gem on Mac OS Mojave, make sure you have open ssl installed on your machine (`brew install openssl`) and retry installing the gem with:
- `gem install mysql2 -v '0.5.2' -- --with-ldflags=-L$(brew --prefix openssl)/lib --with-cppflags=-I$(brew --prefix openssl)/include`
- The stack trace line saying `ld: library not found for -lssl` will give you the hint about what information is missing (ssl lib not found).
- ```
- Building native extensions with: '--with-mysql-config=/usr/local/opt/mysql/bin/mysql_config'
- ERROR: Error installing mysql2:
- current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
- /Users/r.wrede/.rbenv/versions/2.4.6/bin/ruby -r ./siteconf20190618-2638-etjqij.rb extconf.rb --with-mysql-config=/usr/local/opt/mysql/bin/mysql_config
- checking for rb_absint_singlebit_p()... yes
- -----
- Using mysql_config at /usr/local/opt/mysql/bin/mysql_config
- checking for mysql.h... yes
- checking for SSL_MODE_DISABLED in mysql.h... yes
- checking for SSL_MODE_REQUIRED in mysql.h... yes
- checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
- checking for MYSQL.net.pvio in mysql.h... no
- checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
- checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
- checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
- checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
- checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
- checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
- -----
- Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
- -----
- -----
- current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
- current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
- compiling client.c
- compiling mysql2_ext.c
- compiling statement.c
- ld: library not found for -lssl
- clang: error: linker command failed with exit code 1 (use -v to see invocation)
- Gem files will remain installed in /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2 for inspection.
- Results logged to /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-18/2.4.0-static/mysql2-0.5.2/gem_make.out

I was trying to get a fresh Django 1.10 project setup on macOS Sierra using MySQL and Python 3.5 in a venv but pip install mysqlclient
was failing with the error:
As is often the case after some searching I came into the solution on Stack Overflow. mysqlclient
needs to link against the homebrew version of openssl I have installed:
Ld Library Not Found For Lssl Mac Mysql Tutorial
The solution post also mentions that installing the xcode command line tools via:
Mac Library Not Found For Lssl
will provide the required ssl libs for the system installed version of python (2.7 on Sierra), it will not work for python in a virtual environment.