Build opencv and tell it not to use PNG

Trying to use opencv on a ESP32, I got it to build from a GitHub project, and it works, now I want to read files from and sd card, so I need to do imdecode(), when adding that function now I have errors on libpng, can I tell opencv not to support png? I tried WITH_PNG=OFF and BUILD_PNG=OFF and still getting the error:

Undefined reference to ‘__wrap_longjmp’

opencv version / os / compiler ?

(github search does not find __wrap_longjmp )

besides, l lot of other 3rdparty libs are using longjmp, how do you know, it’s from png ?

why do you even want to disable png support, when you already know, that you have to use imdecode() later ?