Ld Library Not Found For Lssl Mac Mysql

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.

Jun 29th, 2019

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.

Never
Not a member of Pastebin yet?Sign Up, it unlocks many cool features!

Ld Library Not Found For Lssl Mac Mysql Download

  1. 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:
  2. `gem install mysql2 -v '0.5.2' -- --with-ldflags=-L$(brew --prefix openssl)/lib --with-cppflags=-I$(brew --prefix openssl)/include`
  3. 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).
  4. ```
  5. Building native extensions with: '--with-mysql-config=/usr/local/opt/mysql/bin/mysql_config'
  6. ERROR: Error installing mysql2:
  7. current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
  8. /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
  9. checking for rb_absint_singlebit_p()... yes
  10. -----
  11. Using mysql_config at /usr/local/opt/mysql/bin/mysql_config
  12. checking for mysql.h... yes
  13. checking for SSL_MODE_DISABLED in mysql.h... yes
  14. checking for SSL_MODE_REQUIRED in mysql.h... yes
  15. checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
  16. checking for MYSQL.net.pvio in mysql.h... no
  17. checking for MYSQL_ENABLE_CLEARTEXT_PLUGIN in mysql.h... yes
  18. checking for SERVER_QUERY_NO_GOOD_INDEX_USED in mysql.h... yes
  19. checking for SERVER_QUERY_NO_INDEX_USED in mysql.h... yes
  20. checking for SERVER_QUERY_WAS_SLOW in mysql.h... yes
  21. checking for MYSQL_OPTION_MULTI_STATEMENTS_ON in mysql.h... yes
  22. checking for MYSQL_OPTION_MULTI_STATEMENTS_OFF in mysql.h... yes
  23. -----
  24. Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
  25. -----
  26. -----
  27. current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
  28. current directory: /Users/r.wrede/.rbenv/versions/2.4.6/lib/ruby/gems/2.4.0/gems/mysql2-0.5.2/ext/mysql2
  29. compiling client.c
  30. compiling mysql2_ext.c
  31. compiling statement.c
  32. ld: library not found for -lssl
  33. clang: error: linker command failed with exit code 1 (use -v to see invocation)
  34. 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.
  35. 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
Ld library not found for lssl mac mysql tutorialLd Library Not Found For Lssl Mac Mysql

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.