[pycrypto] setup.py fails to find gmp on Debian/Ubuntu
Legrandin
gooksankoo at hoiptorrow.mailexpire.com
Sun Sep 25 14:48:04 CST 2011
> Debian and Ubuntu recently started to implement Multiarch [1]. Because of this,
> libgmp.so has been moved from /usr/lib/ to /usr/lib/<host-triplet>/ and setup.py
> cannot find it anymore.
>
> I was able to circumvent this problem by asking gcc for its library search path
> (see the attached patch). I don't know if that is the best way to fix this issue
> but I would be glad if you'd consider the patch or fix the issue differently.
> [1] https://wiki.ubuntu.com/MultiarchSpec
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.
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.
Mind that I have only tried it with Python 2.7 on Linux.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: multiarch2.patch
Type: text/x-diff
Size: 3084 bytes
Desc: not available
Url : http://lists.dlitz.net/pipermail/pycrypto/attachments/20110925/006d4129/attachment.patch
More information about the pycrypto
mailing list