pythonpython-2.7wxpythonvirtualenvubuntu-14.10

How can I install wxPython 3.0.1.1 in Python 2.7 virtualenv on Ubuntu 14.10?


The following procedure fails. Am I missing something?

The final command fails with:

src/gtk/_core_wrap.cpp:20407:7: note: ‘arg3’ was declared here
   int arg3 ;
       ^
src/gtk/_core_wrap.cpp: In function ‘PyObject* _wrap_Image_SetAlphaBuffer(PyObject*, PyObject*, PyObject*)’:
src/gtk/_core_wrap.cpp:3747:13: warning: ‘arg3’ may be used uninitialized in this function [-Wmaybe-uninitialized]
             if (ALPHASIZE != self->GetWidth() * self->GetHeight()) {
             ^
src/gtk/_core_wrap.cpp:20474:7: note: ‘arg3’ was declared here
   int arg3 ;
       ^
cc1plus: some warnings being treated as errors
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Solution

  • I used python setup.py install &> ~/error.txt to pass on the error messages to knowledgeable colleague who identified that C compilation was using the -Werror=format-security flag. This version of wxPython (and maybe others) cannot compile with that flag.

    My $CPPFLAGS and $CFLAGS environment variables were empty. It turns out that this flag is triggered by hardening-wrapper.

    So, I overrode the flag by invoking the final step as follows, and wxPython was installed successfully:

    CFLAGS=-Wno-error=format-security CPPFLAGS=-Wno-error=format-security python setup.py install