Installing Reportlab on Mac OS X 10.5

I’ve decided to implement printable reports across my webapps. The first step was finding a good way to generate pdf files from Python and then integrating that with Django. I chose reportlab because it is pretty slick and integrates with Django for pdf views.

Install

On Ubuntu this was extremely simple. I activated my virtualenv and:

pip install reportlab

Unfortunately this didn’t work for me on OS X 10.5. I received an error:

ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libstdc++.6.dylib, file is not of required architecture for architecture ppc

I couldn’t find anyone else on Google with this specific problem but a few people with related issues turned me on to the solution. First, you don’t really want to build the ppc architecture stuff. Second, you should try to compile with the libstdc++.X.dylib that you have in /usr/lib. You can do all of this by downloading reportlab and running:

tar xzvf reportlab-tar.tar.gz
cd reportlab-folder/
ARCHFLAGS='-arch i386' LDFLAGS="-L. -L/usr/lib/" python setup.py install

Joy! Now that I’ve got things installed I can knock out these printable reports easily.

Leave a Reply

Your email address will not be published. Required fields are marked *