build failure on OpenSolaris -- can't find gmp.h
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Python-Crypto |
Fix Released
|
Undecided
|
Thorsten Behrens | ||
Tahoe-LAFS |
New
|
Unknown
|
Bug Description
The build fails when we try the ticket1037 branch on David Abrahams's OpenSolaris builder: http://
It appears to fail due to the absence of gmp.h:
src/_fastmath.
Our options include:
1. remove OpenSolaris from the list of Supported Platforms to run Tahoe-LAFS
2. ask Dave Abrahams to manually install gmp.h and leave OpenSolaris listed as a Supported Platform
3. remove PyCrypto from the standard set of requirements and create an "SFTP"-specific set of requirements which are installed only if users specify that they need the "SFTP" feature of Tahoe-LAFS
4. try to help the PyCrypto maintainer, Dwayne Litzenberger patch his setup.py [*] and then wait for a new release of PyCrypto which has that patch.
5. Do option 1 or 2 now while simultaneously working on option 4. People will not then be able to actually install Tahoe-LAFS on OpenSolaris machines that are configured the same way that Dave's is, but they will be able to install Tahoe-LAFS on OpenSolaris machines that are configured differently (with libgmp headers installed), and once a new version of PyCrypto comes out that fixes this problem then they will be able to install on any platform.
6. ?
[*] It looks like to me that PyCrypto is intended to fallback to a pure-Python implementation (appropriately named "slowmath") when the _fastmath.c file can't be compiled. The fact that the build of PyCrypto fails on David's OpenSolaris machine appears to be a bug in PyCrypto's setup.py. I see from that file that it is checking whether there is a libgmp lib dir present and if so then relying on gmp.h. I infer that on David's OpenSolaris machine that there is a libgmp libdir but not the header files. This could be due to David having the library installed but not the headers installed, which is typical for a packaging system that offers a package of the library separate from the "-dev" package which has the headers. It could also just be a mistake on David's part or (more likely) on the part of the OpenSolaris maintainers. In any case, a more robust way to do this fall-back mechanism in your setup.py file is to attempt to compile the module that you need and then if you get an exception fallback to the pure-Python version. An example of that pattern is simplejson's setup.py. Perhaps the PyCrypto maintainers would like to switch to that pattern by copying the code from simplejson's setup.py. (By the way, this is an example of a more general pattern: Never look before you leap! Never check for good conditions and then proceed if conditions are good. Instead, attempt the thing and then handle failure if it fails. Never look before you leap! Instead just leap without looking and then handle failure gracefully. ;-) Okay so this rule applies better to build scripts than it does to, say, diving in a lake.) Here's a question: just how slow is the slowmath version? If it is too slow for the users of Tahoe-LAFS to rely on in the SFTP implementation, then the fact that PyCrypto does successfully fall back to slowmath on all other systems (that don't have libgmp installed) is a different issue for the Tahoe-LAFS packaging that we also need to deal with... I guess the next step is to write some simple benchmark of the relevant performance which we can run on the buildbots... I'll open a separate ticket for that issue.
Changed in tahoe-lafs: | |
status: | Unknown → New |
Changed in pycrypto: | |
status: | In Progress → Fix Committed |
Oh I see that when I cut and pasted some text from http:// tahoe-lafs. org/trac/ tahoe-lafs/ ticket/ 953#comment: 17 to here it lost some hyperlinks. In particular, see simplejson's setup.py:
http:// code.google. com/p/simplejso n/source/ browse/ trunk/setup. py?spec= svn231& r=230#sl_ svn230_ 63
which has code to fallback to a pure-Python version if a C version fails to compile for any reason. See also this Twisted ticket:
http:// twistedmatrix. com/trac/ ticket/ 3586
and this patch attached to that ticket:
http:// twistedmatrix. com/trac/ attachment/ ticket/ 3586/patch2. txt
Which does the same thing for Twisted.
Dwayne: is the next step for you to try adapting one of these patches to PyCrypto's setup.py? Or is there something else I can do to help?