Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating brew install command to avoid pkg-config warning #891

Merged
merged 3 commits into from
Jun 11, 2022

Conversation

izumiberat
Copy link
Contributor

@izumiberat izumiberat commented Jun 9, 2022

I am using Mac OS Catalina 10.15.7.
To avoid getting the following warning :
configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.
brew install pkg-config needs to be run.

Issue number: python/cpython#93658

I am using Mac OS Catalina 10.15.7.
To avoid getting the following warning : 
$ configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.
$ brew install pkg-config 
needs to be run.
@cpython-cla-bot
Copy link

cpython-cla-bot bot commented Jun 9, 2022

All commit authors signed the Contributor License Agreement.
CLA signed

@izumiberat izumiberat changed the title Updating brew install command to avoid warning Updating brew install command to avoid warning and allow build of optional modules Jun 9, 2022
I was getting the following message:
$ The necessary bits to build these optional modules were not found:
_hashlib              _ssl      
Updating the command line with:
$ brew install openssl@1.1    
resolved the issue.
Copy link
Contributor

@erlend-aasland erlend-aasland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

setup.rst Outdated
@@ -385,7 +385,7 @@ for the header and library files to your ``configure`` command. For example,

with **Homebrew**::

$ brew install openssl xz gdbm
$ brew install pkg-config openssl@1.1 xz gdbm
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which version of openssl gets installed if you don't specify the version number?
The error you mentioned in the issue says Python requires a OpenSSL 1.1.1 or newer and it seems odd to me that it would install an older version by default and require a pinned version to get a newer release. I wonder if that error is wrong 🤔

Copy link
Contributor Author

@izumiberat izumiberat Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezio-melotti that is a very good point. I uninstalled openssl brew uninstall openssl, and verified that I would get the same message when compiling:

The necessary bits to build these optional modules were not found:
_hashlib _ssl

as well as

Python requires a OpenSSL 1.1.1 or newer

I then ran brew install openssl. This time it worked, it installs openSSL@3 the latest version. The message above didn’t show. I am sure though (I can still see it on the terminal), that installing openssl the first time, and following the instructions, lead to the message above. I believe that even though I uninstalled openssl, the uninstallation didn't remove all the files that were created when installing openssl1.1. I am therefore making this pull request purely about the warning issue and not the ssl module. I updated the related issue accordingly. If you think it is not out of the scope of the documentation, I will create a new issue and pull request, updating the documentation by adding a note saying that user might need to specify the latest version of openssl to be able to build the ssl module successfully. Let me know what you think.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you check which version of openssl gets installed by default (you can use openssl version to check)? FWIW on Linux I have OpenSSL 3.0.2 15 Mar 2022 (1.1.1 is from 2018-09-11 and 3.0.0 from 2021-09-07).
You could also try to run make clean or make distclean and then run ./configure and make again to start fresh and see if anything changes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python/cpython#91357 (comment) might also be relevant -- maybe you were missing the libssl-dev package before? (cc @tiran)

Copy link
Contributor Author

@izumiberat izumiberat Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezio-melotti It might be related but I have no quick way to check for sure now that I can't reproduce my issue in the first place! libssl-dev appears nowhere in my terminal. If I do a search on my laptop, I can find libssl.1.1.dylib and libssl.3.dylib but they were created a month ago, so not related. I am using brew and not pip so the part of the documentation that needs updating would be different in any case.

Once this PR is committed I will create a new issue and PR as I suggested. And yes, I did run make clean and ./configure before make for each of my attempts. Thanks for suggesting it.

Copy link
Contributor Author

@izumiberat izumiberat Jun 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezio-melotti regarding the openssl version, it returns LibreSSL 2.8.3. This is why I believe the documentation says to run ./configure --with-pydebug --with-openssl=$(brew --prefix openssl).
If I run brew info openssl , I get:

openssl@3: stable 3.0.3 (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/openssl@3/3.0.3 (6,441 files, 28.3MB)
Poured from bottle on 2022-06-10 at 10:37:27
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/openssl@3.rb
License: Apache-2.0
==> Dependencies
Required: ca-certificates ✔
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates, place .pem files in
/usr/local/etc/openssl@3/certs

and run
/usr/local/opt/openssl@3/bin/c_rehash

openssl@3 is keg-only, which means it was not symlinked into /usr/local,
because macOS provides LibreSSL.

If you need to have openssl@3 first in your PATH, run:
echo 'export PATH="/usr/local/opt/openssl@3/bin:$PATH"' >> ~/.zshrc

For compilers to find openssl@3 you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl@3/lib"
export CPPFLAGS="-I/usr/local/opt/openssl@3/include"

For pkg-config to find openssl@3 you may need to set:
export PKG_CONFIG_PATH="/usr/local/opt/openssl@3/lib/pkgconfig"

==> Analytics
install: 137,635 (30 days), 449,281 (90 days), 995,856 (365 days)
install-on-request: 113,094 (30 days), 363,685 (90 days), 791,601 (365 days)
build-error: 4,447 (30 days)

@JelleZijlstra JelleZijlstra requested a review from ned-deily June 9, 2022 22:48
@izumiberat izumiberat changed the title Updating brew install command to avoid warning and allow build of optional modules Updating brew install command to avoid pkg-confi warning Jun 10, 2022
@izumiberat izumiberat changed the title Updating brew install command to avoid pkg-confi warning Updating brew install command to avoid pkg-config warning Jun 10, 2022
@ezio-melotti
Copy link
Member

I'm going to merge this since it fixes the pkg-config warning (see also related #750). We can continue the discussion about openssl in a different issue/PR.

@ezio-melotti ezio-melotti self-assigned this Jun 11, 2022
@ezio-melotti ezio-melotti merged commit 85e189d into python:main Jun 11, 2022
@izumiberat izumiberat deleted the patch-1 branch June 11, 2022 09:09
AA-Turner pushed a commit to AA-Turner/devguide that referenced this pull request Jun 17, 2022
* Updating brew install command to avoid warning

I am using Mac OS Catalina 10.15.7.
To avoid getting the following warning : 
$ configure: WARNING: pkg-config is missing. Some dependencies may not be detected correctly.
$ brew install pkg-config 
needs to be run.

* Allowing build of additional modules

I was getting the following message:
$ The necessary bits to build these optional modules were not found:
_hashlib              _ssl      
Updating the command line with:
$ brew install openssl@1.1    
resolved the issue.

* making this PR only about removing warning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants