2022.10.05 12:32 "[Tiff] Building libtiff with WEBP support", by Miguel Medalha

2022.10.05 12:32 "[Tiff] Building libtiff with WEBP support", by Miguel Medalha

Salutations to all

Due to some recent changes in the WEBP source code, building the dynamic libtiff library with WEBP support started giving the following error messages:

libwebp.lib(picture_csp_enc.obj) : error LNK2001: unresolved external symbol SharpYuvConvert [C:\Build\bin\libtiff\libtiff\tiff.vcxproj] 
libwebp.lib(picture_csp_enc.obj) : error LNK2001: unresolved external symbol SharpYuvGetConversionMatrix [C:\Build\bin\libtiff\libtiff\tiff.vcxproj] 
libwebp.lib(picture_csp_enc.obj) : error LNK2001: unresolved external symbol SharpYuvInit [C:\Build\bin\libtiff\libtiff\tiff.vcxproj] 
C:\Build\bin\libtiff\libtiff\Release\tiff.dll : fatal error LNK1120: 3 unresolved externals [C:\Build\bin\libtiff\libtiff\tiff.vcxproj]

This is related to the introduction of a new library in WEBP, libsharpyuv.lib.

I solved the problem by appending the following to the end of libtiff/libtiff/CMakeLists.txt:

if(WEBP_SUPPORT) 
  target_link_libraries(${PROJECT_NAME} PRIVATE "C:/build/lib/libsharpyuv.lib") 
endif()

or including the line in the relevant WEBP section (starting with line 148):

if(WEBP_SUPPORT) 
  target_link_libraries(tiff PRIVATE WebP::WebP) 
  string(APPEND tiff_requires_private " libwebp") 
  target_link_libraries(${PROJECT_NAME} PRIVATE "C:/build/lib/libsharpyuv.lib") 
endif()

With this line, libtiff builds and works correctly.

But having to edit the file by hand each time is not very elegant and I would like to find a definitive solution. I tried to pass the instruction on the cmake command line, but I couldn’t find a working solution.

Better still would be someone with the necessary programming knowledge to come up with a permanent solution on the original libtiff code. I am not a developer, I am a libtiff user with just enough knowledge to compile it myself and lightly modify code to solve basic issues.

I can also introduce the reference to libshrpyuv in Microsoft Visual Studio, under Linker/Input/Additional Dependencies, but I mostly prefer to build from the command line using cmake.

Any tips would be appreciated.

Thank you.