Blender failed to build due to error LNK2019 with MSVC on windows

Environment:
VS 2019 + Windows Server 2016 + blender master branch latest source code.

Blender failed to build due to bf_intern_opencolorio.lib(ocio_impl.obj) : error LNK2019: unresolved external symbol “__declspec(dllimport) public: static class std::shared_ptr __cdecl OpenColorIO_v2_0::ColorSpaceTransform::Create(void)” with MSVC on windows. It can be reproduced on master branch with latest commit 956c539 and latest dependencies lib win64_vc15 version 62639. Could you please help take a look at this? Thanks in advance!

Repro steps:

  1. git clone https://git.blender.org/blender.git F:\gitP\blender.git
  2. git submodule update --init --recursive
  3. Open a VS 2019 x64 command prompt and browse to F:\gitP\blender.git\build_amd64
  4. cmake -G “Visual Studio 16 2019” -DCMAKE_SYSTEM_VERSION=10.0.18362.0 -DLIBDIR=F:/tools/blender/lib/win64_vc15 -DWITH_GTESTS=1 -DWITH_CYCLES=0 -DWITH_CYCLES_OPENSUBDIV=0 -DWITH_CYCLES_OSL=0 -DWITH_PYTHON_INSTALL=0 -DWITH_PYTHON_INSTALL_NUMPY=0 …
  5. set CL=/D_SILENCE_TR1_NAMESPACE_DEPRECATION_WARNING
  6. msbuild /p:Platform=x64 /p:Configuration=Release Blender.sln /t:Rebuild /p:BuildInParallel=true

Error Message: bf_intern_opencolorio.lib(ocio_impl.obj) : error LNK2019: unresolved external symbol "declspec(dllimport) public: static class std::shared_ptr cdecl OpenColorIO_v2_0::ColorSpaceTransform::Create(void)" (imp?Create@ColorSpaceTransform@OpenColorIO_v2_0@@SA?AV?$shared_ptr@VColorSpaceTransform@OpenColorIO_v2_0@@@std@@XZ) referenced in function "public: virtual struct OCIO_ConstProcessorRcPtr * * cdecl OCIOImpl::createDisplayProcessor(struct OCIO_ConstConfigRcPtr * *,char const *,char const *,char const *,char const *,float,float)" (?createDisplayProcessor@OCIOImpl@@UEAAPEAPEAUOCIO_ConstProcessorRcPtr@@PEAPEAUOCIO_ConstConfigRcPtr_@@PEBD111MM@Z) [F:\gitP\blender.git\build_amd64\source\creator\blender.vcxproj]

Sorry about that, got that fixed up for you!

Is there any reason you guys are no longer using cycles for regressions testing? Historically cycles has been the place where we encountered most of our codegen bugs.

@LazyDodo Thanks for fixing this issue. I’ve tried 7561e3d commit, it can build pass. Our current testing strategy is to update the open source commit every two months. So this problem may not be discovered in time.