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

openssl version detection doesn't work properly when using OSX SDK #52691

Closed
ronaldoussoren opened this issue Apr 18, 2010 · 6 comments
Closed
Assignees
Labels
build The build process and cross-build stdlib Python modules in the Lib dir

Comments

@ronaldoussoren
Copy link
Contributor

BPO 8444
Nosy @ronaldoussoren, @pitrou, @tarekziade

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/tarekziade'
closed_at = <Date 2010-05-08.08:46:47.252>
created_at = <Date 2010-04-18.20:44:08.743>
labels = ['build', 'library']
title = "openssl version detection doesn't work properly when using OSX SDK"
updated_at = <Date 2010-05-08.08:46:47.251>
user = 'https://github.com/ronaldoussoren'

bugs.python.org fields:

activity = <Date 2010-05-08.08:46:47.251>
actor = 'ronaldoussoren'
assignee = 'tarek'
closed = True
closed_date = <Date 2010-05-08.08:46:47.252>
closer = 'ronaldoussoren'
components = ['Build', 'Distutils']
creation = <Date 2010-04-18.20:44:08.743>
creator = 'ronaldoussoren'
dependencies = []
files = []
hgrepos = []
issue_num = 8444
keywords = []
message_count = 6.0
messages = ['103526', '103529', '103754', '103763', '103767', '105270']
nosy_count = 3.0
nosy_names = ['ronaldoussoren', 'pitrou', 'tarek']
pr_nums = []
priority = 'critical'
resolution = 'fixed'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'compile error'
url = 'https://bugs.python.org/issue8444'
versions = ['Python 2.7', 'Python 3.2']

@ronaldoussoren
Copy link
Contributor Author

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 bpo-7724, but fixing this particular issue is probably easier than fixing the generic issue.

@ronaldoussoren ronaldoussoren added build The build process and cross-build stdlib Python modules in the Lib dir labels Apr 18, 2010
@pitrou
Copy link
Member

pitrou commented Apr 18, 2010

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.

@ronaldoussoren
Copy link
Contributor Author

I've attached a patch that fixes this issue to bpo-7724.

@pitrou
Copy link
Member

pitrou commented Apr 20, 2010

Looks like you forgot your patch.

@ronaldoussoren
Copy link
Contributor Author

The patch is attached to bpo-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).

@ronaldoussoren
Copy link
Contributor Author

Closing because the patch in bpo-7724 fixes this problem.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build stdlib Python modules in the Lib dir
Projects
None yet
Development

No branches or pull requests

2 participants