[FIXED] Zlib linking troubles. vcpkg. Windows 11 x64

Hello. I’m using Windows, Visual Studio 2022.

I downloaded and updated the clean main blender branch 3 or 4 times already.
And using any building modes - release, debug, using different ways to build it (using just make, make full nobuild and then with VS, as it is in the wiki) I get the same result - build error at the linking stage.
The error is about unresolved external symbol __imp_gzseek and same functions, gzclose, gzwrite, gzread, gzopen_w.

zlib files are where they have to be (lib\win64_vc15\zlib\lib). The lib is linked In blender VS main application project. I have no idea, how to fix it, can you please help? There is the build log file: https://pastebin.com/0pK9eRbE

In the bf_blenlib project, can you look up the fileops_c.cc right click it, select properties and setting this option in the advanced section:

then right clicking fileops_c.cc again and select Compile this time, your build log should now include where it is picking up all includes from, can you paste the output?

Thank you so much for the hint! I found out that it was trying to pick zlib files from installed vcpkg. Removing them fixed everything, and I could build and run blender :slight_smile:

1>Note: including file: C:\Users\alekc\vcpkg\installed\x64-windows\include\zlib.h
1>Note: including file: C:\Users\alekc\vcpkg\installed\x64-windows\include\zconf.h

I’m real glad that now I can develop blender too!
Thanks!

It shouldn’t be picking up things from vcpkg, shame you already fixed the issue otherwise i’d like you to test this patch

diff --git a/build_files/cmake/macros.cmake b/build_files/cmake/macros.cmake
index 2ab4588cace..8c0224eb301 100644
--- a/build_files/cmake/macros.cmake
+++ b/build_files/cmake/macros.cmake
@@ -402,7 +402,9 @@ function(blender_add_lib__impl
   # message(STATUS "Configuring library ${name}")

   add_library(${name} ${sources})
-
+  if(WIN32)
+    set_target_properties(${name} PROPERTIES VS_GLOBAL_VcpkgEnabled "false")
+  endif()
   blender_target_include_dirs(${name} ${includes})
   blender_target_include_dirs_sys(${name} ${includes_sys})

Okay, I’ve tried to test this. There are my steps:

  • I have restored vcpkg zlib, and as expected, building failed again (linking with vcpkg zlib again)
  • Then I have remade project with new macros.cmake with your patch.
  • I builded again and everything works:
    1>Note: including file: A:\blender-dev\lib\win64_vc15\zlib\include\zlib.h
    1>Note: including file:  A:\blender-dev\lib\win64_vc15\zlib\include\zconf.h
    

So, I suppose, the patch works :slight_smile:

Excellent! thanks for testing!

I also encountered this problem today, fixed by VS_GLOBAL_VcpkgEnabled Properties, that patch should commit to main branch.

Sorry, this one slipped through the cracks, committed in 23430f4db868.

1 Like