wiki:CompileError

Version 12 (modified by daira, at 2014-03-05T02:43:47Z) (diff)

source:git/ -> source:

See also wiki:Installation for pre-built packages for your operating system, wiki:FAQ for Frequently Asked Questions, and quickstart for how to run Tahoe-LAFS from source.

The Symptoms

Sometimes running python setup.py build results in an error message about a compile failure. This page will tell you how to get past that problem.

A typical error message when building on Windows is:

distutils.errors.DistutilsError: Setup script exited with error: Unable to find vcvarsall.bat

On Linux a typical error message is:

error: Python.h: No such file or directory

On Mac OS X a typical error message is:

unable to execute clang: No such file or directory

in brief

The short version, for people who don't want to read this whole page is: write to the tahoe-dev mailing list and ask if some volunteer will kindly build a binary package of the necessary library for your operating system and your version of Python. In your request, include: 1. the entire output from your attempt to build (which will include an error message like one of those above), 2. what operating system you are using, 3. what version of Python you are using (python -V), 4. some nice words like "please" and "thank you".

Why This Happens

First of all, the Tahoe-LAFS software itself is written in 100% pure Python and never gets compiled. However, Tahoe-LAFS uses several libraries which themselves contain native C or C++ code that needs to be compiled. Currently there are six such libraries that Tahoe-LAFS uses: Twisted, pyOpenSSL, pycrypto, pycryptopp, zfec, and zope.interface.

To understand why the compile failure happens and how to get past it, you have to understand that python setup.py build tries three different methods of satisfying Tahoe-LAFS' need for its libraries, and only if all three methods fail does it emit an error message like this.

  1. First, if a suitable version of the library is already installed in your system, then Tahoe-LAFS will use it. So for example if the compile failure is happening because it can't compile Twisted, and if you were to install Twisted into your operating system — such as by running sudo apt-get install python-twisted on Debian, or by downloading and running the MSI installer for Twisted from http://twistedmatrix.com/trac/ on Windows — then the compile failure would stop happening, because it would no longer attempt to compile Twisted, because it would use the installed Twisted on your system instead.
  1. Second, if a "Python egg" of the library for your platform and your version of Python is available from the library's page on http://pypi.python.org or from the collection of eggs hosted on https://tahoe-lafs.org, it will download and use that. In that case it will not attempt to compile the library at all. It will instead use the precompiled "egg" package of that library.
  1. Third, only if both of the two methods above failed then it downloads the source code of the library and tries to compile it. If you have a working compiler and all the needed header files then the compilation will succeed.

Only if all three of the above attempts fail will it emit an error message like the ones above and then stop the build.

What To Do

If you get an error message like this, then please look at the collection of eggs hosted on https://tahoe-lafs.org, look at the table for the version of Python you are using, and then look in the row of that table for your platform. To see what version of Python you are using, run python -V. To see what platform you are using, run python -c 'import distutils.util;print distutils.util.get_platform()'.

If there are any blank cells in your row of the table, then that's your problem. The problem is that one of those dependencies is not available in precompiled binary form. To get this fixed, please send an email to the tahoe-dev mailing list requesting that someone who has your platform build a precompiled binary of that dependency for you. Alternatively, find the egg-building ticket for your platform (or file a new ticket on the same pattern if there is no existing one) and comment on it giving the Python version, platform, and which egg was missing.

For Tahoe-LAFS developers and packagers

See also wiki:Packaging, wiki:OSPackages, wiki:Manual, and wiki:NewbieDeveloperSetup