Incompatible libpng version in application and library
-
My QtQuick application previously worked with Qt 5.12 and Ubuntu 16.04. Since then I've updated to Qt 5.13.0 and Ubuntu 18.04.03, and now the app segfaults when opening a file dialog:
libpng warning: Application jmp_buf size changed Thread 1 "mbgrdviz" 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) bt #0 0x00007ffff4e43b00 in __longjmp_chk (env=0x0, val=1) at ../setjmp/longjmp.c:32 #1 0x00007fffb423bc9c in () at /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so #2 0x00007ffff08492c7 in png_error (png_ptr=0x555557fe6ad0, error_message=error_message@entry=0x7ffff0dd9cb8 "Incompatible libpng version in application and library") at libpng/pngerror.c:80 #3 0x00007ffff084c685 in png_create_read_struct_2 (user_png_ver=0x7fffb423ce57 "1.6.34", error_ptr=0x555557fd11a0, error_fn=0x7fffb423bc50, warn_fn=0x7fffb423cd10, mem_ptr=0x0, malloc_fn=0x7fffb423c320, free_fn=0x7fffb423afc0) at libpng/pngread.c:150
I've installed libpng16 on my system. I rebuilt Qt5.13.0 after configuring it to use the system libpng:
./configure -system-libpng make make install
I've cleaned and rebuilt my app after these steps but still get the same segfault due to "Incompatible libpng version in application and library".
Suggested fixes?
I am building with qtcreator 4.11.1 - how can see exactly what libpng files it's compiling with and which libpng.so it's liking with?Thanks
Tom -
Hi,
Are you using any external library with your application that also makes use if libpng ?
-
ldd is your friend
-
@Christian-Ehrlicher - 'ldd myprog | grep libpng' does not show any result, so I assume that means myprog doesn't rely on libpng dynamic library. What else should I check? Thanks!
-
You should check all the third party libraries you are using.
-
The same tool: ldd
-
Any of these uses plugins ?
-
@SGaist - I do not think so, at least I didn't create any. To be sure I ran 'ldd -u -d -r ' on all *plugin.so files in my Qt5.13.0 directory, none of them show dependency on libpng.
Obviously something is invoking libpng routines, but I haven't found libpng dependency with ldd in any of my app's libraries....??? -
Can you provide a full stack trace of your crash ?
-
@SGaist - yes, gdb stacktrace is below - thank you!
Thread 1 "mbgrdviz" 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) bt #0 0x00007ffff4e43b00 in __longjmp_chk (env=0x0, val=1) at ../setjmp/longjmp.c:32 #1 0x00007fffb423bc9c in () at /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so #2 0x00007ffff08492c7 in png_error (png_ptr=0x555557fde4f0, error_message=error_message@entry=0x7ffff0dd9cb8 "Incompatible libpng version in application and library") at libpng/pngerror.c:80 #3 0x00007ffff084c685 in png_create_read_struct_2 (user_png_ver=0x7fffb423ce57 "1.6.34", error_ptr=0x555557faf050, error_fn=0x7fffb423bc50, warn_fn=0x7fffb423cd10, mem_ptr=0x0, malloc_fn=0x7fffb423c320, free_fn=0x7fffb423afc0) at libpng/pngread.c:150 #4 0x00007fffb423befb in () at /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders/libpixbufloader-png.so #5 0x00007fffe07a408c in () at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 #6 0x00007fffe07a4955 in gdk_pixbuf_loader_close () at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 #7 0x00007fffe07a120b in () at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 #8 0x00007fffe07a223c in gdk_pixbuf_new_from_stream () at /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0 #9 0x00007fffe15ff142 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #10 0x00007fffe15ff2bb in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #11 0x00007fffe15ffb46 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #12 0x00007fffe15f74b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #13 0x00007fffe172db3a in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #14 0x00007fffe15f5faa in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #15 0x00007fffe15aebf1 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #16 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #17 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #18 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #19 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #20 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #21 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #22 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #23 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #24 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #25 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #26 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #27 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #28 0x00007fffe175b1c0 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #29 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #30 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #31 0x00007fffe175ad35 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #32 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #33 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #34 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #35 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #36 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #37 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #38 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #39 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #40 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #41 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #42 0x00007fffe172ffd7 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #43 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #44 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #45 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #46 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #47 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #48 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #49 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #50 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #51 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #52 0x00007fffe16ed820 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #53 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #54 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #55 0x00007fffe16ed6c1 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #56 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #57 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #58 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #59 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #60 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #61 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #62 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #63 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #64 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #65 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #66 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #67 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #68 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #69 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #70 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #71 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #72 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #73 0x00007fffe159fcf4 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #74 0x00007fffe15f140d in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #75 0x00007fffe15f6063 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #76 0x00007fffe15a2601 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #77 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #78 0x00007fffe15ec3ca in gtk_container_propagate_draw () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #79 0x00007fffe15ec4b2 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #80 0x00007fffe18136ef in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #81 0x00007fffe18058db in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #82 0x00007fffe180e998 in () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #83 0x00007fffe16b2859 in gtk_main_do_event () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0 #84 0x00007fffe11c3765 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #85 0x00007fffe11d37f5 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #86 0x00007fffe11d49f6 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #87 0x00007fffe11d4bf0 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #88 0x00007fffdbdbc10d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #89 0x00007fffdbdcf05e in () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #90 0x00007fffdbdd7715 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #91 0x00007fffdbdd812f in g_signal_emit () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 #92 0x00007fffe11ccac9 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #93 0x00007fffe11b8080 in () at /usr/lib/x86_64-linux-gnu/libgdk-3.so.0 #94 0x00007fffeca4ed03 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #95 0x00007fffeca4e285 in g_main_context_dispatch () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #96 0x00007fffeca4e650 in () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #97 0x00007fffeca4e6dc in g_main_context_iteration () at /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0 #98 0x00007ffff5d7118f in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) (this=0x5555559fc4b0, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #99 0x00007ffff5d17902 in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) (this=this@entry=0x7fffffffda70, flags=..., flags@entry=...) at kernel/qeventloop.cpp:225 #100 0x00007ffff5d20260 in QCoreApplication::exec() () at kernel/qcoreapplication.cpp:1373 #101 0x000055555555a767 in main(int, char**) (argc=<optimized out>, argv=<optimized out>) at main.cpp:66
-
Can you start your application with the QT_DEBUG_PLUGINS environment variable set 1 ?
-
@SGaist - Thank you. I do that and output shows multiple image libraries being loaded:
loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqgif.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqicns.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqico.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqjpeg.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqsvg.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqtga.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqtiff.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqwbmp.so" loaded library "/home/oreilly/Qt/5.13.0/gcc_64/plugins/imageformats/libqwebp.so"
However these do not include libpng.so - probably because before building Qt I configured it to use my system's libpng; "./configure -system-libpng", while is libpng16. What else might the problem be?
-
What QPA and theme plugins gets loaded ?
-
@SGaist - Thanks very much for your help!
I discovered which library is causing the problem. It's a non-Qt library that doesn't directly rely on libpng, but it does rely on 50+ other libraries - apparently one of those does directly or indirectly rely on libpng. Apparently ldd doesn't show recursive dependencies, which surprises me. https://stackoverflow.com/questions/15064685/does-ldd-also-show-dependencies-of-dependencies/15064784#15064784 -
What library was it ?
-
@SGaist - the segfault occurs when I link with /usr/local/lib/libgmt.so.6.0.0, for the Generic Mapping Tools. I built the library from source and installed on this system. Yet when I run 'ldd /usr/local/lib/libgmt.so.6.0.0' it does not display any dependency on libpng - I don't understand why...