Search code examples
pythongraphicsaggdraw

How can I install aggdraw after this error?


I am trying to install the aggdraw python library to create high quality graphics but I keep getting this error:

agg22/include/agg_array.h: In member function `agg::int8u*

What is the workaround for this? How can I install it?


Solution

  • You should follow the instructions in http://www.pocketuniverse.ca/archive/2008/december/11/pil-and-aggdraw/ to patch AGG rather than just have the compiler allow the 64-bit incompatible code to compile.

    Here's one way you could do it in the shell:

    cd /tmp
    svn co http://svn.effbot.org/public/tags/aggdraw-1.2a3-20060212
    cd aggdraw-1.2a3-20060212
    patch -p0 <<EOF
    Index: agg2/include/agg_array.h
    ===================================================================
    --- agg2/include/agg_array.h    (revision 532)
    +++ agg2/include/agg_array.h    (working copy)
    @@ -520,7 +520,7 @@
                     int8u* ptr = m_buf_ptr;
                     if(alignment > 1)
                     {
    -                    unsigned align = (alignment - unsigned(ptr) % alignment) % alignment;
    +                    unsigned align = (alignment - (unsigned long)(ptr) % alignment) % alignment;
                         size += align;
                         ptr += align;
                         if(size <= m_rest)
    EOF
    
    python setup.py build_ext -i
    python selftest.py
    sudo python setup.py install