LNK2019 Error when building INSTALL (VS2022 Preview)

I tried building the INSTALL.vsxproj in visual studio after a lot of time setting build systems up. I was greeted with a LNK2019 error after spending around an hour building.

The ouputted errors is enormous so I’ll just put the first 5 error messages that appeared:
‘5>bf_blenlib.lib(fileops.c.obj) : error LNK2019: unresolved external symbol __imp_gzopen_w referenced in function BLI_gzopen
5>extern_mantaflow.lib(ioutil.obj) : error LNK2001: unresolved external symbol __imp_gzopen_w
5>bf_blenlib.lib(fileops.c.obj) : error LNK2019: unresolved external symbol __imp_ZSTD_isError referenced in function BLI_file_unzstd_to_mem_at_pos
5>bf_blenloader.lib(writefile.obj) : error LNK2001: unresolved external symbol __imp_ZSTD_isError
5>bf_blenlib.lib(filereader_zstd.obj) : error LNK2001: unresolved external symbol __imp_ZSTD_isError’

I’m very new to contributing to FOSS and am really eager to get involved. Any help would be amazing!

Looks like it’s dynamically trying to link both zlib and zstd, which… shouldn’t be happening. can you attach your CMakeCache.txt file from your build folder? should sit right next to your blender.sln file

1 Like

I’m a new user so it’s not letting me attach files. Is there any work around?

I bumped your trust level, give it another shot

CMakeCache.txt (134.4 KB)
Here you go

All seems ok, it’s at least trying to link the right files, can you validate these two files actually exist on disk?

C:\Blender-Git\lib\win64_vc15\zlib\lib\libz_st.lib
C:\Blender-Git\lib\win64_vc15\zstd\lib\zstd_static.lib

My folder is labeled win64_vc17 instead of win64_vc15 and I don’t have a zlib folder or a zstd folder.

Oh nvm I do have both of the .lib files I was just looking on the wrong path.

that’s…very non standard, how did that came to be?

we have build instructions up over at

https://wiki.blender.org/wiki/Building_Blender

that will help you get a pre-built set of libraries for blender to link against so you don’t have to chase down and build 100+ deps on your own

The files are exactly where you asked they would be I just went down the wrong path file path sorry abt that I’m running on very little sleep.

Allright, i’m at a bit of a loss here then.

5>bf_blenlib.lib(fileops.c.obj) : error LNK2019: unresolved external symbol __imp_ZSTD_isError referenced in function BLI_file_unzstd_to_mem_at_pos

this implies that fileops.c has been build with -DZSTD_DLL_IMPORT=1 but i can’t find any logical explanation where that could be coming from. nor do I see this on any of our CI infrastructure.

i’d check out the compilation options of that file in the IDE, and see if its there, if so, see if you can find out where it came from.

I reconfigured blender from start to finish and tried building “INSTALL” it says:
========== Build: 168 succeeded, 2 failed, 0 up-to-date, 0 skipped ==========

And above this message it spits out a bunch of messages saying Error: MSB3073

Here are the first few MSB3073 errors:
170>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: The command "setlocal 170>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: "C:\Program Files\CMake\bin\cmake.exe" -DBUILD_TYPE=Debug -P cmake_install.cmake 170>C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd

That’s just the final “oh no.i’m unhappy” , the actual error is higher up