wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.29k stars 516 forks source link

Force wxWidgets to use builtin image libraries #473

Open robmcmullen opened 7 years ago

robmcmullen commented 7 years ago

Operating system: Ubuntu 16.04 LTS wxPython version: git Stock or custom build: custom Python version: 2.7.12 Stock or custom build: stock

Description of the problem:

Crash when loading images using libpng 1.2:

Thread 1 "python" received signal SIGSEGV, Segmentation fault.
__longjmp_chk (env=0x0, val=1) at ../setjmp/longjmp.c:32
32  ../setjmp/longjmp.c: No such file or directory.
(gdb) where
#0  __longjmp_chk (env=0x0, val=1) at ../setjmp/longjmp.c:32
#1  0x00007fffe91021f0 in wx_PNG_error ()
   from /data/virtualenv/wx4/local/lib/python2.7/site-packages/wx/libwx_gtk3u_core-3.0.so.0
#2  0x00007fffe569b657 in png_error () from /lib/x86_64-linux-gnu/libpng12.so.0
#3  0x00007fffe5690892 in png_create_read_struct_2 () from /lib/x86_64-linux-gnu/libpng12.so.0
#4  0x00007fffe5690a61 in png_create_read_struct () from /lib/x86_64-linux-gnu/libpng12.so.0
#5  0x00007fffe91057ab in wxPNGHandler::LoadFile(wxImage*, wxInputStream&, bool, int) ()
   from /data/virtualenv/wx4/local/lib/python2.7/site-packages/wx/libwx_gtk3u_core-3.0.so.0
#6  0x00007fffe90eaf20 in wxImage::DoLoad(wxImageHandler&, wxInputStream&, int) ()

libpng 1.6 is current, but trying to install that on Ubuntu 16.04 tries to remove gtk3 for some reason. I can't get gtk2 compiles to work because of webkit.

It can be worked around by forcing wxWidgets to use its internal image libraries, but there doesn't seem to be a way to request than on the build.py command line. I hacked this into it:

diff --git a/build.py b/build.py
index a82ef9f..0616e27 100755
--- a/build.py
+++ b/build.py
@@ -1251,6 +1251,8 @@ def cmd_build_wx(options, args):
     if options.gtk3:
         build_options.append('--gtk3')

+    build_options.extend(['--features=--with-libpng=builtin --with-libjpeg=builtin --with-libtiff=builtin'])
+
     try:
         # Import and run the wxWidgets build script
         from buildtools import build_wxwidgets as wxbuild

but obviously that's not a general solution. I don't know if this is enough of an edge case to ignore, or if there should be some way to tell the config to use internal. But the next LTS isn't due for a while so there may be some need for a workaround?

w3sip commented 3 years ago

Thanks! This got me over the current section of wxpython build fun. I agree, this kind of build option should be accessible from top level (in my case, I was just trying to install via pip, and this build system favoring brew version of libtiff over builtin made things difficult ...)