Blender crashes at startup due to libpng version mismatch

Hi, I got a problem recently on MacOS Mojave when trying to build master branch.

I removed CMakeCache.txt and deleted the ‘lib’ folder with prebuilt MacOS dependencies.
Compiling works fine, only when I start Blender, it crashes right away with message

I also tried to ‘make deps’ to see if maybe the available deps builds were wrong, to no avail.

I had libpng installed with Homebrew and I forced it to remove libpng.
However the issue remains.

libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
Cannot png_create_read_struct
IMB_ibImageFromMemory: unknown fileformat (<splash>)
imb_loadtiff: size < IMB_TIFF_NCB
DDS: trying to read beyond end of stream (corrupt file?)
IMB_ibImageFromMemory: unknown fileformat (<blender icons>)
imb_loadtiff: size < IMB_TIFF_NCB
DDS: trying to read beyond end of stream (corrupt file?)
IMB_ibImageFromMemory: unknown fileformat (<blender icons>)
found bundled python: /Users/some_user/blender/build_darwin/bin/blender.app/Contents/Resources/2.91/python
libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
Cannot png_create_read_struct
IMB_ibImageFromMemory: unknown fileformat (<splash screen>)

Sounds like something I could’ve broken in https://developer.blender.org/rB1f6b7387ad0177c1dec9bb83b7c7586a454691db due to careless reading of the FindPNG’s documentation.

I often delete the build folder itself, and use lite builds to test things. PNG is a compulsory dependency, so if lite works, full will also work.

That is not a good idea. It will give a fatal error if you try to build afresh in an empty folder.

Please

  • put the lib folder back, (or download it again)
  • run make update in blender folder
  • delete old build folder,
  • run make full ( or make lite for quick testing),
  • copy the whole output from the start till the end and share it with us, https://pastebin.com or https://developer.blender.org/paste/

Thanks for your reply.
When I say I delete lib folder (only in a rare case like this), of course I always run make update so that it fetches the necessary pre-built deps before make again. I mentioned compilation works.

Isn’t make full the same as make deps followed by make ?

Here’s the output for make lite
https://developer.blender.org/P1704

It shows that it finds libpng 1.4.12 in the downloaded dependencies under
lib/darwin/png/libpng.a

then later there’s this warning:

libpng warning: Application built with libpng-1.4.12 but running with 1.6.37
write_png: Cannot png_create_write_struct for file: 

I’ve never built deps, so I don’t know. You can find their working in the GNUmakefile.

But the PNG lib Blender supplies is at "1.6.37" not "1.4.12", TIFF is at "4.1.0" not "4.0.8".

I see these line in the output:

/Users/some_user/blender/blender/source/blender/imbuf/intern/png.c:71:28: warning: passing 'const unsigned char *' to parameter of type 'png_bytep' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
    ret_val = !png_sig_cmp(mem, 0, 8);
                           ^~~
<What is this doing here?! ↓----------------------↓ >
/Library/Frameworks/Mono.framework/Headers/png.h:1528:47: note: passing argument to parameter 'sig' here
PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
                                              ^

So…make finds the downloaded libpng but for some reason uses the system one?

Cmake*

I just committed
https://developer.blender.org/rBbac91956ae97 , so try updating and building again.

Unfortunately that doesn’t fix it. Same output with your latest commit, removing old build folder, with make update and make lite

Try this:

mkdir final_attempt && cd final_attempt
cmake ../blender -C ../blender/build_files/cmake/config/blender_lite.cmake -DCMAKE_FIND_FRAMEWORK=LAST
make -j 8 install

You’re not the only one with this issue https://stackoverflow.com/questions/36523911/osx-homebrew-cmake-libpng-version-mismatch-issue

1 Like

Found these bug reports too:

Thanks for your help! That final attempt worked at least.
Yes, now that I see the related issues with it, this problem appeared after a recent install of Mono…Crazy bug.

Thanks!
https://developer.blender.org/rBbb872b25f219d1a9bc2446228b6dc7a9248d7f20