[pycrypto] setup.py fails to find gmp on Debian/Ubuntu

Sebastian Ramacher sebastian+lists at ramacher.at
Mon Sep 26 15:51:58 CST 2011


Hi,

On 09/25/2011 10:48 PM, Legrandin wrote:
> Hi Sebastian, all,
> 
> I think the problem is more deep rooted.
> 
> Searching the file system for the gmp library file is not very
> reliable, in that one has to make a lot of assumptions about how the
> linker works.
> Moreover, we don't know if the file we find is actually in the right
> binary format or not.
> 
> I suggest a different approach. We get rid of the searching logic
> altogether, and we simply try to compile a dummy C file that requires
> libgmp. If it compiles, we know that the library is somehow reachable,
> but we don't need to investigate where it actually is.

I like your approach even more.

> That is what has_function() in distutils is supposed to do, but I find
> it very limited: the sought function can only be one that does not
> take any argument, whereas ALL functions in libgmp I know of take at
> least one.
> 
> See attached patch.

I've added a call to customize_compiler to your patch. Then CFLAGS and LDFLAGS
will be honored (as they are during the build). Hence if libgmp is not installed
in a standard location, the paths can be passed with CFLAGS and LDFLAGS. I've
also added calls to delete the files that are generated during the test build.
See the attach patch.

Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multiarch3.patch
Type: text/x-diff
Size: 3220 bytes
Desc: not available
Url : http://lists.dlitz.net/pipermail/pycrypto/attachments/20110926/cbc2b92a/attachment.patch 


More information about the pycrypto mailing list