Skip to content

Instantly share code, notes, and snippets.

@pich4ya
Last active March 26, 2020 11:58
Show Gist options
  • Save pich4ya/0b1ac9a7722d6d5957dc557655497e60 to your computer and use it in GitHub Desktop.
Save pich4ya/0b1ac9a7722d6d5957dc557655497e60 to your computer and use it in GitHub Desktop.
Fix PyCurl on MacOS + SSL problem
Problem:
$ pip install wfuzz
Collecting wfuzz
Using cached https://files.pythonhosted.org/packages/76/7a/6e3ee024a9a6edf9e9affbcff0c03e8538da03292514ff17b9204b71e650/wfuzz-2.3.1.tar.gz
Collecting pycurl (from wfuzz)
Using cached https://files.pythonhosted.org/packages/e8/e4/0dbb8735407189f00b33d84122b9be52c790c7c3b25286826f4e1bdb7bde/pycurl-7.43.0.2.tar.gz
Complete output from command python setup.py egg_info:
Using curl-config (libcurl 7.62.0)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/xv/2np77zzj18dfc6nw5qn6485w0000gn/T/pip-install-8KrWLs/pycurl/setup.py", line 913, in <module>
ext = get_extension(sys.argv, split_extension_source=split_extension_source)
File "/private/var/folders/xv/2np77zzj18dfc6nw5qn6485w0000gn/T/pip-install-8KrWLs/pycurl/setup.py", line 582, in get_extension
ext_config = ExtensionConfiguration(argv)
File "/private/var/folders/xv/2np77zzj18dfc6nw5qn6485w0000gn/T/pip-install-8KrWLs/pycurl/setup.py", line 99, in __init__
self.configure()
File "/private/var/folders/xv/2np77zzj18dfc6nw5qn6485w0000gn/T/pip-install-8KrWLs/pycurl/setup.py", line 316, in configure_unix
specify the SSL backend manually.''')
__main__.ConfigurationError: Curl is configured to use SSL, but we have not been able to determine which SSL backend it is using. Please see PycURL documentation for how to specify the SSL backend manually.
Solution:
$ export PYCURL_SSL_LIBRARY=openssl
$ export LDFLAGS=-L/usr/local/opt/openssl/lib;export CPPFLAGS=-I/usr/local/opt/openssl/include;
$ pip install wfuzz
Problem:
$ export PYCURL_SSL_LIBRARY=openssl
$ export LDFLAGS=-L/usr/local/opt/openssl/lib;export CPPFLAGS=-I/usr/local/opt/openssl/include;
$ brew install --force curl --with-openssl
==> Downloading https://curl.haxx.se/download/curl-7.63.0.tar.bz2
Already downloaded: /Users/pichaya/Library/Caches/Homebrew/downloads/4baa673c6a4a5e12cfab6c65dfd3c02ef5fcd8eac1d9ee9aa8aee9aef549be06--curl-7.63.0.tar.bz2
==> ./configure --disable-silent-rules --prefix=/usr/local/Cellar/curl/7.63.0 --with-ssl=/usr/local/opt/openssl --with-ca-bundle=/usr/local/etc/openssl/ce
Last 15 lines from /Users/pichaya/Library/Logs/Homebrew/curl/01.configure:
configure: WARNING: ## Report this to a suitable curl mailing list: https://curl.haxx.se/mail/ ##
configure: WARNING: ## ----------------------------------------------------------------------- ##
checking for ssl.h... no
checking err.h usability... no
checking err.h presence... yes
configure: WARNING: err.h: present but cannot be compiled
configure: WARNING: err.h: check for missing prerequisite headers?
configure: WARNING: err.h: see the Autoconf documentation
configure: WARNING: err.h: section "Present But Cannot Be Compiled"
configure: WARNING: err.h: proceeding with the compiler's result
configure: WARNING: ## ----------------------------------------------------------------------- ##
configure: WARNING: ## Report this to a suitable curl mailing list: https://curl.haxx.se/mail/ ##
configure: WARNING: ## ----------------------------------------------------------------------- ##
checking for err.h... no
configure: error: OpenSSL libs and/or directories were not found where specified!
READ THIS: https://docs.brew.sh/Troubleshooting
Solution:
chown -R `id -u -n`:staff /usr/local/Cellar/
brew unlink pkg-config
brew reinstall pkg-config
pip uninstall pycurl
brew install openssl
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PYCURL_SSL_LIBRARY=openssl
pip install --install-option="--with-openssl" pycurl
-- Solution Tested on March 13, 2019
; correct the lib versions
export LDFLAGS="-L/usr/local/Cellar/rtmpdump/2.4+20151223/lib -L/usr/local/opt/openssl/lib -L/usr/local/Cellar/c-ares/1.15.0/lib -L/usr/local/Cellar/brotli/1.0.7/lib -L/usr/local/Cellar/nghttp2/1.36.0/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
export PKG_CONFIG_PATH="/usr/local/opt/curl-openssl/lib/pkgconfig"
export PYCURL_SSL_LIBRARY=openssl
pip install --install-option="--with-openssl" --no-cache-dir pycurl
@arieroos
Copy link

This worked well, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment