Open sideeffect42 opened 4 months ago
I ran into a similar issue earlier. vcpkg should pull in a version of libpng with the correct patchset, because libpng is a vcpkg dependency for Ladybird. This problem arises because clang is trying to get use system's libpng.
The problem (on my system) was that I was overriding $CPATH
and $LIBRARY_PATH
(I overrode them trying to fix a separate build issue). I'm not sure if that specific fix is relevant to you, but hopefully it gives you a starting point.
I'm neither using clang nor vcpkg. I build directly from source using system tools and GCC.
While I can USE=apng emerge media-libs/libpng
on Gentoo to get libpng with the APNG patchset installed, this is a lot harder on other distros (e.g. Debian).
We're in a similar situation to Firefox in this regard. APNG is supported by all the other browsers, so we want it as well. So whatever those distros do for Firefox wanting the APNG patch is the same deal we're going to ask for
I'm not against APNG, I'm just asking for APNG support being guarded behind #ifdef PNG_APNG_SUPPORTED
.
This way, when Ladybird is compiled against a patched libpng you get the niceties of animated PNGs and if not, well, not.
A browser without APNG is still better than no browser, right?
I'm neither using clang nor vcpkg. I build directly from source using system tools and GCC.
That's weird, the build system is supposed to pull in libpng from vcpkg. Was that changed?
Edit: I was unaware that the PR purposefully used a non-vcpkg version of libpng
That's weird, the build system is supposed to pull in libpng from vcpkg. Was that changed?
vcpkg is a package manager, not a build system. its job is to find packages for us, and help us link to them. In a perfect world using a system package manager would work as well.
That being said, we simply must have APNG. It is supported by everyone.
https://github.com/pnggroup/libpng/issues/267 https://caniuse.com/apng
We should be looking for a solution to get APNG working in more environments, rather than disabling the feature because some distros don't want to ship a patch they consider less than ideal.
Is there at least some way to give a better error message here?
I also had this issue on MacOS, and like @dzfrias said, it was because my system's libpng installation was getting included instead of the one installed by vcpkg. For me, the build system kept putting -isystem /opt/local/include
into the compile command, and I couldn't figure out how to get rid of it, so I eventually just renamed /opt/local/include/png.h
to /opt/local/include/png.h.bak
and the error went away. Super hacky, but it seems to have worked.
@ADKaster while vcpkg currently preferred by developers, it is not the only way to find packages. If you must have APNG you need to check its existence and show correct error message if it is not present
Compilation fails when linking against a libpng without the apng patch set applied.
Would it be possible to detect this at compile-time and disable APNG support if libpng does not support it either?