stackless python 2.7.9 and openssl-1.1.1g

Barry Scott barry at barrys-emacs.org
Tue Sep 29 10:27:45 EDT 2020



> On 29 Sep 2020, at 13:13, bhashkar prakash Singh <singh.bhashkar at gmail.com> wrote:
> 
> >Get the source of python.org <http://python.org/> python 2.7.18 and you will find that builds without patches >against OpenSSL 1.1.1g.
> >I would then diff the C files that do not compile in stackless to look for the required fixes.
> 
> Thanks Barry. Some warnings were left in code after patching cpython files. After fixing them, all those errors are gone.
> 
> Now I have another issue. now the threading module in python is not found. 
> I don't see this is anyway related to openssl upgrade but this issue is not occurred where openssl has not been upgraded.

When working on a project like this I tend to write a shell script that automates the build so that I repeat the build in the future.

Example (untested)

rm -rf tmp.build
mkdir tmp.build
cd tmp.build
tar xf ../Python-xxx.tar.gz
./configure --with-openssl=...
make

Then I can prove to myself that just changing the openssl changes the build.
And I run that script and create a log of the build output

$ ./do-build 2>&1 | tee build.log

Then I can go back and check what happened.

> 
>  File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in <module>
>     from ._abnf import *
>   File "/usr/lib/python2.7/site-packages/websocket/_abnf.py", line 30, in <module>
>     from threading import Lock
>   File "threading.py", line 6, in <module>
>     import thread
> ImportError: No module named thread
>  
> Could you give any clue on this ?

The cool thing about open source is that you have the source.

When hitting a problem like this I tend to search the sources for where, in
this case, thread might be.

That lead me the Python/thread.c in cpython. Is that the same in stackless?
Does the build compile that file? It seems that if you are missing
pthreads then its not going to work.

When you ran configure did it find pthread.h?
Are there any "not found" reports in configure output?

Barry


> 
> Thanks & Regards,
> Bhashkar
> 
> On Fri, Sep 25, 2020 at 12:43 PM Barry <barry at barrys-emacs.org <mailto:barry at barrys-emacs.org>> wrote:
> 
> 
>> On 25 Sep 2020, at 03:28, bhashkar prakash Singh <singh.bhashkar at gmail.com <mailto:singh.bhashkar at gmail.com>> wrote:
>> 
>> 
>> Hi Barry,
>> 
>> Thanks for your response.
>> 
>> I am not an expert in python code. Could you please elaborate a bit more on this.  Which cpython code are you referring to?
>> did you modify other files also apart from   _hashopenssl.c and _ssl.c to work with openssl-1.1.1g ?
> 
> Get the source of python.org <http://python.org/> python 2.7.18 and you will find that builds without patches against OpenSSL 1.1.1g.
> 
> I would then diff the C files that do not compile in stackless to look for the required fixes.
> 
> Barry
> 
>> 
>> Regards,
>> Bhashkar
>> 
>> On Fri, Sep 25, 2020 at 2:40 AM Barry Scott <barry at barrys-emacs.org <mailto:barry at barrys-emacs.org>> wrote:
>> 
>> 
>> > On 24 Sep 2020, at 19:21, bhashkar prakash Singh <singh.bhashkar at gmail.com <mailto:singh.bhashkar at gmail.com>> wrote:
>> > 
>> > Hi,
>> > 
>> > I am using stackless Python 2.7.9 in my project and openssl-1.0.2q.
>> > I just upgraded the Openssl  version to 1.1.1g, due to which python
>> > compilation started failing. So, I patched  _hashopenssl.c and _ssl.c file
>> > in Python Modules as per new openssl  to make compilation successful.
>> > But when I run my image on  target HW,  I am getting below errors.  It
>> > looks like Openssl 1.1.1g libraries are not linked to Python.
>> > I am struggling with this issue since many days. Looks like something I
>> > missed in my patching. Could someone please help on this.
>> 
>> I recently built python 2.7.18 against openssl 1.1.1g without issue.
>> Maybe look see what is in the cpython code that works fine.
>> 
>> Barry
>> > Thanks & Regards,
>> > Bhashkar
>> > -- 
>> > https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>
>> > 
>> 



More information about the Python-list mailing list