Totally disable zlib from opencv 4.8.0

Hello, i have some conflicts with another library and i want totally disable zlib from opencv 4.8.0, but even i disable it in CMake it builds anyway and a lot of 3d party libs based on it and as far as i am concerned opencv core libs also… Could you please give any hints or tutorial?

add this variable when you build opencv using cmake (windows)

-DZLIB_INCLUDE_DIR:PATH=${installRepo}/zlib/include \ -DZLIB_LIBRARY_DEBUG:FILEPATH=${installRepo}/zlib/lib/${zlibname}d.lib \ -DZLIB_LIBRARY_RELEASE:FILEPATH=${installRepo}/zlib/lib/${zlibname}.lib \

installRepo is your own zlib path

1 Like

Thank you for reply, but i don’t have my own zlib libraries and i don’t want to have… my question is how to disable zlib at all? I am trying to use opencv 4.8.0 with freetype2 support, i’ve successfully build harfbuzz and freetype, also successfully build opencv 4.8.0 with freetype and hurfbuzz support, but when i am trying to declare the instance of freetype in my code it conflicts with zlib.lib

i don’t think, this is possible.
(e.g. core’s FileStorage depends on it)

but see here, too

1 Like

Thank you for information, so maybe you can advice how to build opencv 4.8.0 with support of freetype that it not conflicts with zlib, it’s not an easy routine to build opencv with freetype support, it needs to be build separately (freetype2 and harfbuzz) because default CMAKE flag WITH_FREETYPE doesnt make any sence and freetype is not builded until you manually pass includes and libs (freetype,hurfbuzz) to CMAKE config. I will be happy not to use freetype at all and use truetype default support in 5.x versions of opencv, but there is another conflicts problems with imgui library (it use truetype and i can’t disable it). I am struggling the whole week and seems my problem is cycled:))) i am trying to disable some libs that not to have a conflicts but with no success… and i can’t find optimal way how to build all that stuff altogether…

also try this way, no succes (( i got a lot of errors unresolved symbols

Dear Moderators, exuse me for wasting your time, problem is closed :)) finally i found a bug in my linkage code, problem was in precompiled headers///

to compensate us, please add a short writeup, what & how worked for you, in the end – might be useful for ppl in a similar situation :wink: