Both Python and Zope 2 require a C compiler to build from source. So let us take a minute to explore the available options. Regardless of the packaging, each of the following software provides some version of the GNU Compiler Collection (GCC) and libraries (http://gcc.gnu.org/gcc-4.3/).
Before you can compile C code on Mac OS X, you must install XCode (http://developer.apple.com/technologies/tools/xcode.html).
Check your Mac OS X installation DVD or Apple Developer Connection (http://developer.apple.com/) for the latest version.
Before you can compile C code on Windows, you must install MinGW (or Microsoft's Visual Studio, but that approach is not covered in this book).
To download MinGW with Internet Explorer:
Browse to http://mingw.org.
Click on Downloads | View all files | Automated MinGW Installer | MinGW-5.1.6.exe.
Save the file.
Run the installer.
Windows will present a series of dialogues you can answer based on the following suggestions:
Select the current package
Select g++ and check options in addition to the base tools
Select the default location
Now that a C compiler is installed, we would like to be able to easily run the gcc
command from the Command Prompt. To accomplish this, perform the following steps:
Select Start | Computer System Properties | Advanced system settings | Environment Variables.
Under System variables, scroll down to Path.
Select Edit.
Add the following separated by a semicolon:
C:\MinGW\bin
Click on Save.
You should see:
To verify that your C compiler works, select Start | All Programs | Accessories | Command Prompt and type:
$ gcc
You should see:
We have just demonstrated how to install and test a C compiler on Windows.
Later, when you try to compile Zope 2, your Buildout may fail with a Visual Studio error like this:
To avoid this error, you can configure Distribute to use MinGW's C compiler. Just create a file called C:\Python\Lib\Distutils\distutils.cfg
, and include the following contents:
[build] compiler=mingw32
Visit http://plone.org/documentation/kb/using-buildout-on-windows/ for more information.
Before you can compile C code on Ubuntu Linux, you must install the build-essential package (http://packages.ubuntu.com/lucid/build-essential):
$ sudo aptitude install build-essential
You should see: