libpng cannot be initialized (Macos)
This issue is particular to MacOS builds.
When building SRB2 (and variants) from source, and when using homebrew (though this will occur regardless of homebrews presence), the presence of a pre-existing framework containing a libpng header file will cause issues with libpng on runtime. This issue is caused by CMakes handling of Frameworks. Specifically, it (silently) places loading their header files ahead of any other library including when manually specified. This is not emitted to stdout/stderr and is only detectable when directly checking the CMakeCache.txt generated by the required cmake ..
call made prior in the build process.
This issue can easily be addressed by adding the following to roughly line 110 in $sourceroot/CMakeLists.txt
(Setting -DCMAKE_FIND_FRAMEWORK=
has no effect on this issue unfortunately):
109 if(${CMAKE_SYSTEM} MATCHES "Darwin")
110 add_definitions(-DMACOSX)
111 set(CMAKE_FIND_FRAMEWORK LAST)
112 endif()
This isn't a perfect solution however, as noted here: https://stackoverflow.com/questions/36523911/osx-homebrew-cmake-libpng-version-mismatch-issue