This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: openssl version detection doesn't work properly when using OSX SDK
Type: compile error Stage: resolved
Components: Build, Distutils Versions: Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tarek Nosy List: pitrou, ronaldoussoren, tarek
Priority: critical Keywords:

Created on 2010-04-18 20:44 by ronaldoussoren, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg103526 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-18 20:44
setup.py detects the version of openssl by looking for openssl headers on a deduced search path. That path is not guaranteed to be equal to the real compiler search path, in particular not when building using the OSX 10.4 SDK on MacOSX 10.6: in that situation the compiler will use a header file with the following definition:

#define OPENSSL_VERSION_NUMBER  0x009070cfL

While setup.py reads the header file in /usr/include which contains this definition:

#define OPENSSL_VERSION_NUMBER  0x009080cfL

The actual version is below the sha256 cutoff in setup.py, while setup.py detects a newer version that is above that cutoff. That results in a tree where setup.py tries to build _sha256 using OpenSSL, but fails. That in turn results in a build of hashlib that doesn't work.


Note that this is a specific instance of Issue7724, but fixing this particular issue is probably easier than fixing the generic issue.
msg103529 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-18 20:52
On recent trunk and py3k you can get the real version number:
http://docs.python.org/dev/library/ssl.html#ssl.OPENSSL_VERSION

So perhaps you can first build the _ssl module, then import it to get that information.
Of course it would be much better to build against the proper headers.
msg103754 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-20 20:51
I've attached a patch that fixes this issue to issue 7724.
msg103763 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-04-20 21:05
Looks like you forgot your patch.
msg103767 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-04-20 21:10
The patch is attached to issue 7724. As that issue notes the current version of setup.py ignores OSX SDKs during builds, the patch in that issue makes sure that setup.py looks in the SDK when looking for files (The patch also modifies distutils.unixccompiler to do the same when looking for library files).
msg105270 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2010-05-08 08:46
Closing because the patch in issue 7724 fixes this problem.
History
Date User Action Args
2022-04-11 14:57:00adminsetgithub: 52691
2010-05-08 08:46:47ronaldoussorensetstatus: open -> closed
resolution: fixed
messages: + msg105270

stage: needs patch -> resolved
2010-04-20 21:10:59ronaldoussorensetmessages: + msg103767
2010-04-20 21:05:50pitrousetmessages: + msg103763
2010-04-20 20:51:48ronaldoussorensetmessages: + msg103754
2010-04-18 20:52:07pitrousetnosy: + pitrou
messages: + msg103529
2010-04-18 20:44:08ronaldoussorencreate