0

I am having this error during installation of 4suite.xml on ubuntu. Trying to install harpia on my ubuntu but couple packages are missing from my system so during to getting those missing dependencies I stuck on this.

username@ubuntu:~/4Suite-XML-1.0.2$ sudo python setup.py install
running install
running build
running config
running build_py
running build_ext
building 'Ft.Xml.Lib.cStreamWriter' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c Ft/Xml/src/StreamWriter.c -o build/temp.linux- x86_64-2.7/Ft/Xml/src/StreamWriter.o
In file included from /usr/include/python2.7/Python.h:94:0,
             from Ft/Xml/src/StreamWriter.c:14:
Ft/Xml/src/StreamWriter.c: In function ‘writer_print’:
/usr/include/python2.7/stringobject.h:91:32: error: format not a string literal and no format arguments [-Werror=format-security]
 #define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
                            ^ 
 Ft/Xml/src/StreamWriter.c:605:15: note: in expansion of macro   ‘PyString_AS_STRING’
 fprintf(fp, PyString_AS_STRING(repr));
           ^


Ft/Xml/src/StreamWriter.c: In function ‘entitymap_print’:
/usr/include/python2.7/stringobject.h:91:32: error: format not a string    literal and no format arguments [-Werror=format-security]
#define PyString_AS_STRING(op) (((PyStringObject *)(op))->ob_sval)
                            ^
Ft/Xml/src/StreamWriter.c:815:15: note: in expansion of macro  ‘PyString_AS_STRING’
fprintf(fp, PyString_AS_STRING(repr));
           ^

cc1: some warnings being treated as errors

Can you help me to figure that out ?

VladoDemcak
  • 4,893
  • 4
  • 35
  • 42
hma
  • 556
  • 2
  • 11
  • 29

2 Answers2

0

Trying to use code below might helpful:

fprintf(fp, "%s", PyString_AS_STRING(repr));

Clues are from fprintf, error: format not a string literal and no format arguments [-Werror=format-security] and How to fix this compiler error 'format not a string literal and no format arguments' and similar situation in deploying python codes

Community
  • 1
  • 1
Nick Dong
  • 3,638
  • 8
  • 47
  • 84
  • 1
    When I install [wxPython 2.8.12.1](https://sourceforge.net/projects/wxpython/files/wxPython/2.8.12.1/) in fedora 23 x86_64, I met similar problem. And I change `PyErr_Format(PyExc_RuntimeError, mesg);` appeared in the source codes to `PyErr_Format(PyExc_RuntimeError, "%s", mesg);`. And It works for me. – Nick Dong Apr 08 '17 at 10:53
0

A quick and dirty workaround for me was to set CFLAGS to override -Werror=format-security with -Wno-error=format-security (python 2 on CenTOS):

wget  https://files.pythonhosted.org/packages/0e/ae/3c5b4fffb12be7c3a80c99475853349e1cf8477f99051921ea06fbf5e3b9/4Suite-XML-1.0.2.tar.gz
tar -xvf 4Suite-XML-1.0.2.tar.gz
export CFLAGS=" -Wno-error=format-security" # no error will be generated, you know what you do
python2  ./setup.py install # 4Suite-XML compilation works without error