pytroll / aggdraw

Python package wrapping AGG2 drawing functionality

Home Page:https://aggdraw.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Had to set CFLAGS="-fpermissive" to build

stuaxo opened this issue · comments

Installing from pip dies, unless I set -fpermissive first

export CFLAGS="-fpermissive"

Not sure if these are real issues it is flagging in agg on 64 bit or can be safely ignored..

Here is what it the log when trying to install without -fpermissive:

$ pip install aggdraw --allow-external aggdraw --allow-unverified aggdraw
Downloading/unpacking aggdraw
  aggdraw is potentially insecure and unverifiable.
  Downloading aggdraw-1.1-20051010.zip (382kB): 382kB downloaded
  Running setup.py (path:/mnt/data/home/stu/.virtualenvs/t4/build/aggdraw/setup.py) egg_info for package aggdraw
    === freetype support disabled

Installing collected packages: aggdraw
  Running setup.py install for aggdraw
    === freetype support disabled
    building 'aggdraw' extension
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iagg2/include -I/usr/include/python2.7 -c aggdraw.cxx -o build/temp.linux-x86_64-2.7/aggdraw.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    In file included from agg2/include/agg_vertex_sequence.h:23:0,
                     from agg2/include/agg_vcgen_contour.h:20,
                     from agg2/include/agg_conv_contour.h:23,
                     from aggdraw.cxx:53:
    agg2/include/agg_array.h: In member function ‘agg::int8u* agg::pod_allocator::allocate(unsigned int, unsigned int)’:
    agg2/include/agg_array.h:523:63: error: cast from ‘agg::int8u* {aka unsigned char*}’ to ‘unsigned int’ loses precision [-fpermissive]
                         unsigned align = (alignment - unsigned(ptr) % alignment) % alignment;
                                                                   ^
    aggdraw.cxx: In function ‘PyObject* draw_new(PyObject*, PyObject*)’:
    aggdraw.cxx:504:71: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             PyObject* buffer = PyObject_CallMethod(image, "tostring", NULL);
                                                                           ^
    aggdraw.cxx:530:67: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             self->draw = new draw_adaptor<agg::pixfmt_gray8>(self, "L");
                                                                       ^
    aggdraw.cxx:533:69: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             self->draw = new draw_adaptor<agg::pixfmt_rgb24>(self, "RGB");
                                                                         ^
    aggdraw.cxx:536:69: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             self->draw = new draw_adaptor<agg::pixfmt_bgr24>(self, "BGR");
                                                                         ^
    aggdraw.cxx:539:71: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             self->draw = new draw_adaptor<agg::pixfmt_rgba32>(self, "RGBA");
                                                                           ^
    aggdraw.cxx: In function ‘agg::rgba8 getcolor(PyObject*, int)’:
    aggdraw.cxx:639:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
             result = PyObject_CallFunction(aggdraw_getcolor_obj, "O", color);
                                                                            ^
    aggdraw.cxx: In function ‘PyObject* draw_flush(DrawObject*, PyObject*)’:
    aggdraw.cxx:1059:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         result = PyObject_CallMethod(self->image, "fromstring", "N", buffer);
                                                                            ^
    aggdraw.cxx:1059:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx: In function ‘void draw_dealloc(DrawObject*)’:
    aggdraw.cxx:1114:18: warning: deleting object of abstract class type ‘draw_adaptor_base’ which has non-virtual destructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]
         delete self->draw;
                      ^
    aggdraw.cxx: In function ‘PyObject* pen_new(PyObject*, PyObject*, PyObject*)’:
    aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         static char* kwlist[] = { "color", "width", "opacity", NULL };
                                                                     ^
    aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx: In function ‘PyObject* brush_new(PyObject*, PyObject*, PyObject*)’:
    aggdraw.cxx:1164:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         static char* kwlist[] = { "color", "opacity", NULL };
                                                            ^
    aggdraw.cxx:1164:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx: In function ‘PyObject* font_new(PyObject*, PyObject*, PyObject*)’:
    aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
         static char* kwlist[] = { "color", "file", "size", "opacity", NULL };
                                                                            ^
    aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
    aggdraw.cxx: At global scope:
    aggdraw.cxx:169:21: warning: ‘FontType’ defined but not used [-Wunused-variable]
     static PyTypeObject FontType = {
                         ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /mnt/data/home/stu/.virtualenvs/t4/bin/python -c "import setuptools, tokenize;__file__='/mnt/data/home/stu/.virtualenvs/t4/build/aggdraw/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-QPxA_0-record/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/data/home/stu/.virtualenvs/t4/include/site/python2.7:
    === freetype support disabled

running install

running build

running build_ext

building 'aggdraw' extension

creating build

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/agg2

creating build/temp.linux-x86_64-2.7/agg2/src

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Iagg2/include -I/usr/include/python2.7 -c aggdraw.cxx -o build/temp.linux-x86_64-2.7/aggdraw.o

cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++

In file included from agg2/include/agg_vertex_sequence.h:23:0,

                 from agg2/include/agg_vcgen_contour.h:20,

                 from agg2/include/agg_conv_contour.h:23,

                 from aggdraw.cxx:53:

agg2/include/agg_array.h: In member function ‘agg::int8u* agg::pod_allocator::allocate(unsigned int, unsigned int)’:

agg2/include/agg_array.h:523:63: error: cast from ‘agg::int8u* {aka unsigned char*}’ to ‘unsigned int’ loses precision [-fpermissive]

                     unsigned align = (alignment - unsigned(ptr) % alignment) % alignment;

                                                               ^

aggdraw.cxx: In function ‘PyObject* draw_new(PyObject*, PyObject*)’:

aggdraw.cxx:504:71: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         PyObject* buffer = PyObject_CallMethod(image, "tostring", NULL);

                                                                       ^

aggdraw.cxx:530:67: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         self->draw = new draw_adaptor<agg::pixfmt_gray8>(self, "L");

                                                                   ^

aggdraw.cxx:533:69: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         self->draw = new draw_adaptor<agg::pixfmt_rgb24>(self, "RGB");

                                                                     ^

aggdraw.cxx:536:69: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         self->draw = new draw_adaptor<agg::pixfmt_bgr24>(self, "BGR");

                                                                     ^

aggdraw.cxx:539:71: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         self->draw = new draw_adaptor<agg::pixfmt_rgba32>(self, "RGBA");

                                                                       ^

aggdraw.cxx: In function ‘agg::rgba8 getcolor(PyObject*, int)’:

aggdraw.cxx:639:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

         result = PyObject_CallFunction(aggdraw_getcolor_obj, "O", color);

                                                                        ^

aggdraw.cxx: In function ‘PyObject* draw_flush(DrawObject*, PyObject*)’:

aggdraw.cxx:1059:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

     result = PyObject_CallMethod(self->image, "fromstring", "N", buffer);

                                                                        ^

aggdraw.cxx:1059:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx: In function ‘void draw_dealloc(DrawObject*)’:

aggdraw.cxx:1114:18: warning: deleting object of abstract class type ‘draw_adaptor_base’ which has non-virtual destructor will cause undefined behaviour [-Wdelete-non-virtual-dtor]

     delete self->draw;

                  ^

aggdraw.cxx: In function ‘PyObject* pen_new(PyObject*, PyObject*, PyObject*)’:

aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

     static char* kwlist[] = { "color", "width", "opacity", NULL };

                                                                 ^

aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx:1133:65: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx: In function ‘PyObject* brush_new(PyObject*, PyObject*, PyObject*)’:

aggdraw.cxx:1164:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

     static char* kwlist[] = { "color", "opacity", NULL };

                                                        ^

aggdraw.cxx:1164:56: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx: In function ‘PyObject* font_new(PyObject*, PyObject*, PyObject*)’:

aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

     static char* kwlist[] = { "color", "file", "size", "opacity", NULL };

                                                                        ^

aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx:1195:72: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]

aggdraw.cxx: At global scope:

aggdraw.cxx:169:21: warning: ‘FontType’ defined but not used [-Wunused-variable]

 static PyTypeObject FontType = {

                     ^

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /mnt/data/home/stu/.virtualenvs/t4/bin/python -c "import setuptools, tokenize;__file__='/mnt/data/home/stu/.virtualenvs/t4/build/aggdraw/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-QPxA_0-record/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/data/home/stu/.virtualenvs/t4/include/site/python2.7 failed with error code 1 in /mnt/data/home/stu/.virtualenvs/t4/build/aggdraw
Traceback (most recent call last):
  File "/mnt/data/home/stu/.virtualenvs/t4/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/mnt/data/home/stu/.virtualenvs/t4/local/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/mnt/data/home/stu/.virtualenvs/t4/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

It seems like this is a known "problem" with compiling aggdraw for 64 bit systems. A quick google showed me http://forums.fedoraforum.org/archive/index.php/t-259163.html and https://gist.github.com/stefanfoulis/902296#comment-82989.

If you create a PR to document this in the README then i'll happily accept it

@stuaxo Any idea if you are still receiving these errors? Based on the links above this bad integer conversion in AGG (the C library). That makes me think that our best move forward would be to upgrade the internal copy of the AGG library (not an easy task). There are forks of this library that seem to have done this so we may be able to borrow from them.

Building seems to work now and selftest seems to pass :)