pythonbrew
pythonbrew copied to clipboard
Python 2.6.5's SSL Module fails to build on Ubuntu 11.10+
To Reproduce
- Install pythonbrew on Ubuntu 11.10 or later (in my case 12.04).
- Build Python 2.6.5 with:
pythonbrew install 2.6.5
Expected Result
- Python 2.6.5 should be built.
- Python 2.6.5 should include SSL support.
Actual Result
- Python 2.6.5 is built.
- Python 2.6.5 does not include SSL support.
Notes
This is likely due to Ubuntu 11.10 and later excluding SSL2 support from the OpenSSL package per this discussion on stackoverflow.
Test
To test this bug, run the Python 2.6.5 SSL Unit Test Suite: Python-2.6.5/Lib/test/test_ssl.py or lib/python2.6/test/test_ssl.py.
Test results before fix
Traceback (most recent call last):
File "/home/gba/.pythonbrew/pythons/Python-2.6.5/lib/python2.6/test/test_ssl.py", line 1203, in <module>
test_main()
File "/home/gba/.pythonbrew/pythons/Python-2.6.5/lib/python2.6/test/test_ssl.py", line 1170, in test_main
raise test_support.TestSkipped("No SSL support")
test.test_support.TestSkipped: No SSL support
Test results after fix
testCrucialConstants (__main__.BasicTests) ... ok
testDERtoPEM (__main__.BasicTests) ... ok
testParseCert (__main__.BasicTests) ...
{'notAfter': 'Feb 16 16:54:50 2013 GMT',
'subject': ((('countryName', u'US'),),
(('stateOrProvinceName', u'Delaware'),),
(('localityName', u'Wilmington'),),
(('organizationName', u'Python Software Foundation'),),
(('organizationalUnitName', u'SSL'),),
(('commonName', u'somemachine.python.org'),))}
ok
testRAND (__main__.BasicTests) ...
RAND_status is 1 (sufficient randomness)
ok
testSSLconnect (__main__.BasicTests) ... ok
----------------------------------------------------------------------
Ran 5 tests in 0.011s
OK
Build Log
building '_ssl' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/gba/.pythonbrew/build/Python-2.6.5/./Include -I/home/gba/.pythonbrew/pythons/Python-2.6.5/include -I. -IInclude -I./Include -I/usr/include/x86_64-linux-gnu -I/usr/local/include -I/home/gba/.pythonbrew/build/Python-2.6.5/Include -I/home/gba/.pythonbrew/build/Python-2.6.5 -c /home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c -o build/temp.linux-x86_64-2.6/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.o
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c: In function ‘newPySSLObject’:
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c:304:3: warning: implicit declaration of function ‘SSLv2_method’ [-Wimplicit-function-declaration]
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c:304:3: warning: passing argument 1 of ‘SSL_CTX_new’ makes pointer from integer without a cast [enabled by default]
/usr/include/openssl/ssl.h:1659:10: note: expected ‘const struct SSL_METHOD *’ but argument is of type ‘int’
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c: In function ‘_get_peer_alt_names’:
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c:690:15: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c: In function ‘PySSL_cipher’:
/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.c:1026:10: warning: assignment discards ‘const’ qualifier from pointer target type [enabled by default]
gcc -pthread -shared build/temp.linux-x86_64-2.6/home/gba/.pythonbrew/build/Python-2.6.5/Modules/_ssl.o -L/home/gba/.pythonbrew/pythons/Python-2.6.5/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/lib -lssl -lcrypto -o build/lib.linux-x86_64-2.6/_ssl.so
*** WARNING: renaming "_ssl" since importing it failed: build/lib.linux-x86_64-2.6/_ssl.so: undefined symbol: SSLv2_method