Re: added feature to setup.py

Matthew Rodriguez DSD staff <[email protected]>
Newsgroups gmane.comp.python.cryptography
Message-ID <[email protected]>
Guido van Rossum wrote:

>On 11/7/05, Matthew Rodriguez DSD staff <[email protected]> wrote:
>  
>
>>I added a feature to setup.py in m2crypto, so that it would take an
>>--openssl argument.
>>This would point to the prefix of the openssl installation. This is
>>useful for me, because I'm compiling against openssl-0.9.8a libraries
>>which are installed in a non standard location.
>>
>>I'm using the 0.15 branch.
>>    
>>
>
>I forwarded this to a local user who's been dealing with the same
>issue. His comments:
>
>"""
>Actually I think he missed the the -I argument that gets passed to swig,
>since the .i file has an include directive for one of the openssl
>headers.  Either the build has changed since the 0.15 release so that
>this is no longer required or he didn't realize that this was necessary
>because he has an openssl in /usr, just not the version he's trying to
>build against.
>"""
>
>What's your response to that?
>
>--
>--Guido van Rossum (home page: http://www.python.org/~guido/)
>  
>
Here is what gets passed to swig
swig -python -ISWIG -o SWIG/_m2crypto.c SWIG/_m2crypto.i.

So the SWIG directory is included. I believe that is the only directory 
that needs to
be included. If I need to pass anything else to swig, let me know.

My patch does not affect what arguments are passed to swig, it only 
affects the arguments
for building the extension specifically the -I argument for the library 
headers and -L to link
in the libraries.

Here's how gcc builds the extension.

gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -march=i586 -mcpu=i686 
-fmessage-length=0 -Wall -fPIC 
-I/home/portnoy/u5/mateo/Python/M2Crypto/branches/0.15/SWIG 
-I/home/dsd/openssl/openssl-0.9.8a/include -I/usr/include/python2.3 -c 
SWIG/_m2crypto.c -o build/temp.linux-i686-2.3/SWIG/_m2crypto.o -DTHREADING
SWIG/_m2crypto.c:1422: warning: `RCS_id' defined but not used
gcc -pthread -shared build/temp.linux-i686-2.3/SWIG/_m2crypto.o 
-L/home/dsd/openssl/openssl-0.9.8a/lib -lssl -lcrypto -o 
build/lib.linux-i686-2.3/M2Crypto/__m2crypto.so

I know this is building against the openssl 0.9.8 libraries, because 
there are compiler errors when you build against 0.9.8 openssl using the 
latest subversion version of m2crypto. This is due to changes to the 
openssl API that added const to parameters of several functions. People 
have mentioned this on this list before. We need a solution so that 
m2crypto works
with 0.9.7 and 0.9.8 openssl.

I've got 2 ideas:

1. #ifdef,  Not elegant, and it will require more work each time a new 
version of openssl modifies its APIs.
2. use the %rename directive so that it doesn't include the function 
declaration. I've been able to get m2crypto
to compile against 0.9.7 and 0.9.8 openssl using this technique, but I 
haven't tested any of the functions that
I've renamed. So I'm not sure if this a good solution.


Matt Rodriguez
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.