Repository: conan-io/conan-center-index

Issue:
[package] libtiff/4.0.9/4.1.0 undefined reference to `lzma' error
### Package and Environment Details
  * Package Name/Version: **libtiff/4.1.0**
  * Operating System+version: **Windows 10**
  * Compiler+version: **msys2 /mingw64 gcc 8.1**
  * Docker image: **conanio/gcc8**
  * Conan version: **conan 1.23.0**
  * Python version: **Python 3.7.5/none**


### Conan profile
```
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=gcc
compiler.cppstd=14
compiler.exception=seh
compiler.libcxx=libstdc++11
compiler.threads=posix
compiler.version=8.1
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
CONAN_CMAKE_GENERATOR=MinGW Makefiles
```

```
[requires]
# libtiff/4.0.9
libtiff/4.1.0
```


### Steps to reproduce
update `libtiff` build package to last version.
build fail in:

```
[ 95%] Linking C shared library ..\bin\libtiff.dll
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMASetupDecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:116: undefined reference to `lzma_end'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAPreDecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:152: undefined reference to `lzma_stream_decoder'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMADecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:191: undefined reference to `lzma_code'
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:195: undefined reference to `lzma_memusage'
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:195: undefined reference to `lzma_stream_decoder'
```

### Temporary solution
disable the `lzma` cmake definitions temporarily.
`libtiff:lzma=False`

Please fixed the bug.

### Logs
<details><summary>Click to expand log</summary>

```
libtiff/4.1.0: WARN: Build folder is dirty, removing it: C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75
libtiff/4.1.0: Copying sources to build folder
libtiff/4.1.0: Building your package in C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75
libtiff/4.1.0: Generator cmake created conanbuildinfo.cmake
libtiff/4.1.0: Generator cmake_find_package created FindZLIB.cmake
libtiff/4.1.0: Generator cmake_find_package created FindLibLZMA.cmake
libtiff/4.1.0: Generator cmake_find_package created Findlibjpeg.cmake
libtiff/4.1.0: Generator cmake_find_package created Findjbig.cmake
libtiff/4.1.0: Generator cmake_find_package created Findzstd.cmake
libtiff/4.1.0: Generator cmake_find_package created Findlibwebp.cmake
libtiff/4.1.0: Calling build()
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Check for working C compiler: C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe
-- Check for working C compiler: C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: C:/mingw64/bin/x86_64-w64-mingw32-g++.exe
-- Check for working CXX compiler: C:/mingw64/bin/x86_64-w64-mingw32-g++.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Conan: called by CMake conan helper
-- Conan: called inside local cache
-- Conan: Adjusting output directories
-- Conan: Using cmake global configuration
-- Conan: Adjusting default RPATHs Conan policies
-- Conan: Adjusting language standard
-- Conan: Compiler GCC>=5, checking major version 8.1
-- Conan: Checking correct version: 8.1
-- Building tiff version 4.1.0
-- libtiff library version 5.5.0
-- Performing Test C_FLAG_Wall
-- Performing Test C_FLAG_Wall - Success
-- Performing Test C_FLAG_Winline
-- Performing Test C_FLAG_Winline - Success
-- Performing Test C_FLAG_W
-- Performing Test C_FLAG_W - Success
-- Performing Test C_FLAG_Wformat_security
-- Performing Test C_FLAG_Wformat_security - Success
-- Performing Test C_FLAG_Wpointer_arith
-- Performing Test C_FLAG_Wpointer_arith - Success
-- Performing Test C_FLAG_Wdisabled_optimization
-- Performing Test C_FLAG_Wdisabled_optimization - Success
-- Performing Test C_FLAG_Wno_unknown_pragmas
-- Performing Test C_FLAG_Wno_unknown_pragmas - Success
-- Performing Test C_FLAG_Wdeclaration_after_statement
-- Performing Test C_FLAG_Wdeclaration_after_statement - Success
-- Performing Test C_FLAG_fstrict_aliasing
-- Performing Test C_FLAG_fstrict_aliasing - Success
-- Performing Test HAVE_LD_VERSION_SCRIPT
-- Performing Test HAVE_LD_VERSION_SCRIPT - Success
-- Looking for assert.h
-- Looking for assert.h - found
-- Looking for dlfcn.h
-- Looking for dlfcn.h - not found
-- Looking for fcntl.h
-- Looking for fcntl.h - found
-- Looking for inttypes.h
-- Looking for inttypes.h - found
-- Looking for io.h
-- Looking for io.h - found
-- Looking for search.h
-- Looking for search.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for string.h
-- Looking for string.h - found
-- Looking for strings.h
-- Looking for strings.h - found
-- Looking for sys/time.h
-- Looking for sys/time.h - found
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for unistd.h
-- Looking for unistd.h - found
-- Performing Test C_HAS_inline
-- Performing Test C_HAS_inline - Success
-- Performing Test TIME_WITH_SYS_TIME
-- Performing Test TIME_WITH_SYS_TIME - Success
-- Performing Test TM_IN_SYS_TIME
-- Performing Test TM_IN_SYS_TIME - Success
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of signed int
-- Check size of signed int - done
-- Check size of unsigned int
-- Check size of unsigned int - done
-- Check size of signed long
-- Check size of signed long - done
-- Check size of unsigned long
-- Check size of unsigned long - done
-- Check size of signed long long
-- Check size of signed long long - done
-- Check size of unsigned long long
-- Check size of unsigned long long - done
-- Check size of unsigned char *
-- Check size of unsigned char * - done
-- Check size of size_t
-- Check size of size_t - done
-- Check size of ptrdiff_t
-- Check size of ptrdiff_t - done
-- Looking for mmap
-- Looking for mmap - not found
-- Looking for setmode
-- Looking for setmode - found
-- Looking for snprintf
-- Looking for snprintf - found
-- Looking for strcasecmp
-- Looking for strcasecmp - found
-- Looking for strtol
-- Looking for strtol - found
-- Looking for strtoll
-- Looking for strtoll - found
-- Looking for strtoul
-- Looking for strtoul - found
-- Looking for strtoull
-- Looking for strtoull - found
-- Looking for getopt
-- Looking for getopt - found
-- Looking for lfind
-- Looking for lfind - found
-- Check if the system is big endian
-- Searching 16 bit integer
-- Check size of unsigned short
-- Check size of unsigned short - done
-- Using unsigned short
-- Check if the system is big endian - little endian
-- CMAKE_HOST_SYSTEM_PROCESSOR set to AMD64
-- HOST_FILLORDER set to FILLORDER_LSB2MSB
-- HOST_BIG_ENDIAN set to 0
-- HAVE_IEEEFP set to 1
-- Conan: Using autogenerated FindZLIB.cmake
-- Found ZLIB: 1.2.11 (found version "1.2.11") 
-- Library zlib found C:/Users/Home/.conan/data/zlib/1.2.11/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libzlib.dll.a
-- Found: C:/Users/Home/.conan/data/zlib/1.2.11/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libzlib.dll.a
-- Found JPEG: C:/Users/Home/.conan/data/libjpeg/9d/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libjpeg.dll.a (found version "90") 
-- Looking for jbg_newlen
-- Looking for jbg_newlen - not found
-- Conan: Using autogenerated FindLibLZMA.cmake
-- Found LibLZMA: 5.2.4 (found version "5.2.4") 
-- Library lzma.dll found C:/Users/Home/.conan/data/xz_utils/5.2.4/_/_/package/9bae293509b8f1cbf43b85e17e13bb8ccb9d978a/lib/liblzma.dll.a
-- Found: C:/Users/Home/.conan/data/xz_utils/5.2.4/_/_/package/9bae293509b8f1cbf43b85e17e13bb8ccb9d978a/lib/liblzma.dll.a
-- Looking for ZSTD_decompressStream in C:/Users/Home/.conan/data/zstd/1.4.4/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libzstd.dll.a
-- Looking for ZSTD_decompressStream in C:/Users/Home/.conan/data/zstd/1.4.4/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libzstd.dll.a - found
-- Found ZSTD library: C:/Users/Home/.conan/data/zstd/1.4.4/_/_/package/9e3762944ae8f4cc8b7bd27c3e59996e1e3a0709/lib/libzstd.dll.a
-- Found WEBP library: C:/Users/Home/.conan/data/libwebp/1.1.0/_/_/package/cccf43a11dc2e80d0eb543e565c4bda253be64b1/lib/libwebp.dll.a
-- Found OpenGL: opengl32   
-- Could NOT find GLUT (missing: GLUT_glut_LIBRARY GLUT_INCLUDE_DIR) 
-- Looking for GL/gl.h
-- Looking for GL/gl.h - found
-- Looking for GL/glu.h
-- Looking for GL/glu.h - found
-- Looking for GL/glut.h
-- Looking for GL/glut.h - not found
-- Looking for GLUT/glut.h
-- Looking for GLUT/glut.h - not found
-- Looking for OpenGL/gl.h
-- Looking for OpenGL/gl.h - not found
-- Looking for OpenGL/glu.h
-- Looking for OpenGL/glu.h - not found
-- 
-- Libtiff is now configured for 
-- 
--   Installation directory:             C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/package/56850fc9366221fc7a1643b188fbe1bc1a5b4f75
--   Documentation directory:            C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/package/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/share/doc/tiff
--   C compiler:                         C:/mingw64/bin/x86_64-w64-mingw32-gcc.exe
--   C++ compiler:                       C:/mingw64/bin/x86_64-w64-mingw32-g++.exe
--   Build shared libraries:             ON
--   Enable linker symbol versioning:    TRUE
--   Support Microsoft Document Imaging: ON
--   Use win32 IO:                       TRUE
-- 
--  Support for internal codecs:
--   CCITT Group 3 & 4 algorithms:       ON
--   Macintosh PackBits algorithm:       ON
--   LZW algorithm:                      ON
--   ThunderScan 4-bit RLE algorithm:    ON
--   NeXT 2-bit RLE algorithm:           ON
--   LogLuv high dynamic range encoding: ON
-- 
--  Support for external codecs:
--   ZLIB support:                       True (requested) TRUE (availability)
--   Pixar log-format algorithm:         ON (requested) TRUE (availability)
--   JPEG support:                       True (requested) TRUE (availability)
--   Old JPEG support:                   ON (requested) TRUE (availability)
--   JPEG 8/12 bit dual mode:            ON (requested) FALSE (availability)
--   ISO JBIG support:                   True (requested) TRUE (availability)
--   LZMA2 support:                      True (requested) TRUE (availability)
--   ZSTD support:                       True (requested) TRUE (availability)
--   WEBP support:                       True (requested) TRUE (availability)
-- 
--   C++ support:                        ON (requested) TRUE (availability)
-- 
--   OpenGL support:                     FALSE
-- 
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_EXPORT_NO_PACKAGE_REGISTRY


-- Build files have been written to: C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/build_subfolder
Scanning dependencies of target port
[  2%] Building C object port/CMakeFiles/port.dir/dummy.c.obj
[  4%] Linking C static library ..\lib\libport.a
[  4%] Built target port
Scanning dependencies of target tiff
[  6%] Building C object libtiff/CMakeFiles/tiff.dir/tif_aux.c.obj
[ 12%] Building C object libtiff/CMakeFiles/tiff.dir/tif_codec.c.obj
[ 12%] Building C object libtiff/CMakeFiles/tiff.dir/tif_color.c.obj
[ 12%] Building C object libtiff/CMakeFiles/tiff.dir/tif_close.c.obj
[ 21%] Building C object libtiff/CMakeFiles/tiff.dir/tif_dirinfo.c.obj
[ 21%] Building C object libtiff/CMakeFiles/tiff.dir/tif_dirread.c.obj
[ 21%] Building C object libtiff/CMakeFiles/tiff.dir/tif_dir.c.obj
[ 21%] Building C object libtiff/CMakeFiles/tiff.dir/tif_compress.c.obj
[ 23%] Building C object libtiff/CMakeFiles/tiff.dir/tif_dirwrite.c.obj
[ 25%] Building C object libtiff/CMakeFiles/tiff.dir/tif_dumpmode.c.obj
[ 27%] Building C object libtiff/CMakeFiles/tiff.dir/tif_error.c.obj
[ 29%] Building C object libtiff/CMakeFiles/tiff.dir/tif_extension.c.obj
[ 31%] Building C object libtiff/CMakeFiles/tiff.dir/tif_fax3.c.obj
[ 34%] Building C object libtiff/CMakeFiles/tiff.dir/tif_fax3sm.c.obj
[ 36%] Building C object libtiff/CMakeFiles/tiff.dir/tif_flush.c.obj
[ 38%] Building C object libtiff/CMakeFiles/tiff.dir/tif_getimage.c.obj
[ 40%] Building C object libtiff/CMakeFiles/tiff.dir/tif_jbig.c.obj
[ 42%] Building C object libtiff/CMakeFiles/tiff.dir/tif_jpeg.c.obj
[ 44%] Building C object libtiff/CMakeFiles/tiff.dir/tif_jpeg_12.c.obj
[ 48%] Building C object libtiff/CMakeFiles/tiff.dir/tif_luv.c.obj
[ 48%] Building C object libtiff/CMakeFiles/tiff.dir/tif_lzma.c.obj
[ 51%] Building C object libtiff/CMakeFiles/tiff.dir/tif_lzw.c.obj
[ 53%] Building C object libtiff/CMakeFiles/tiff.dir/tif_next.c.obj
[ 55%] Building C object libtiff/CMakeFiles/tiff.dir/tif_ojpeg.c.obj
[ 57%] Building C object libtiff/CMakeFiles/tiff.dir/tif_open.c.obj
[ 59%] Building C object libtiff/CMakeFiles/tiff.dir/tif_packbits.c.obj
[ 61%] Building C object libtiff/CMakeFiles/tiff.dir/tif_pixarlog.c.obj
[ 63%] Building C object libtiff/CMakeFiles/tiff.dir/tif_predict.c.obj
[ 65%] Building C object libtiff/CMakeFiles/tiff.dir/tif_print.c.obj
[ 68%] Building C object libtiff/CMakeFiles/tiff.dir/tif_read.c.obj
[ 70%] Building C object libtiff/CMakeFiles/tiff.dir/tif_strip.c.obj
[ 72%] Building C object libtiff/CMakeFiles/tiff.dir/tif_swab.c.obj
[ 74%] Building C object libtiff/CMakeFiles/tiff.dir/tif_thunder.c.obj
[ 76%] Building C object libtiff/CMakeFiles/tiff.dir/tif_tile.c.obj
[ 78%] Building C object libtiff/CMakeFiles/tiff.dir/tif_version.c.obj
[ 80%] Building C object libtiff/CMakeFiles/tiff.dir/tif_warning.c.obj
[ 82%] Building C object libtiff/CMakeFiles/tiff.dir/tif_webp.c.obj
[ 85%] Building C object libtiff/CMakeFiles/tiff.dir/tif_write.c.obj
[ 87%] Building C object libtiff/CMakeFiles/tiff.dir/tif_zip.c.obj
[ 89%] Building C object libtiff/CMakeFiles/tiff.dir/tif_zstd.c.obj
[ 91%] Building C object libtiff/CMakeFiles/tiff.dir/tif_win32.c.obj
[ 93%] Building C object libtiff/CMakeFiles/tiff.dir/__/port/dummy.c.obj
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_zstd.c: In function 'ZSTDDecode':
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_zstd.c:163:63: warning: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t' {aka 'long long unsigned int'} [-Wformat=]
                     "Not enough data at scanline %lu (short %lu bytes)",
                                                             ~~^
                                                             %I64u
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_zstd.c:165:21:
                     (unsigned long) (size_t)occ - out_buffer.pos);
                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c: In function 'TIFFFdOpen':
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c:240:35: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
  tif = TIFFClientOpen(name, mode, (thandle_t)ifd, /* FIXME: WIN64 cast to pointer warning */
                                   ^
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c: In function 'TIFFOpen':
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c:285:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  tif = TIFFFdOpen((int)fd, name, mode);   /* FIXME: WIN64 cast from pointer to int warning */
                   ^
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c: In function 'TIFFOpenW':
C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\source_subfolder\libtiff\tif_win32.c:340:19: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
  tif = TIFFFdOpen((int)fd,    /* FIXME: WIN64 cast from pointer to int warning */
                   ^
[ 95%] Linking C shared library ..\bin\libtiff.dll
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMASetupDecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:116: undefined reference to `lzma_end'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAPreDecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:152: undefined reference to `lzma_stream_decoder'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMADecode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:191: undefined reference to `lzma_code'
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:195: undefined reference to `lzma_memusage'
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:195: undefined reference to `lzma_stream_decoder'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMASetupEncode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:234: undefined reference to `lzma_end'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAPreEncode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:264: undefined reference to `lzma_stream_encoder'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAEncode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:294: undefined reference to `lzma_code'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAPostEncode':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:324: undefined reference to `lzma_code'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMACleanup':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:358: undefined reference to `lzma_end'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `LZMAVSetField':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:376: undefined reference to `lzma_lzma_preset'
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:378: undefined reference to `lzma_stream_encoder'
CMakeFiles\tiff.dir/objects.a(tif_lzma.c.obj): In function `TIFFInitLZMA':
C:/Users/Home/.conan/data/libtiff/4.1.0/_/_/build/56850fc9366221fc7a1643b188fbe1bc1a5b4f75/source_subfolder/libtiff/tif_lzma.c:465: undefined reference to `lzma_lzma_preset'
collect2.exe: error: ld returned 1 exit status
mingw32-make.exe[2]: *** [libtiff\CMakeFiles\tiff.dir\build.make:748: bin/libtiff.dll] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:146: libtiff/CMakeFiles/tiff.dir/all] Error 2
mingw32-make.exe: *** [Makefile:140: all] Error 2
libtiff/4.1.0: ERROR: Package '56850fc9366221fc7a1643b188fbe1bc1a5b4f75' build failed
libtiff/4.1.0: WARN: Build folder C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75
ERROR: libtiff/4.1.0: Error in build() method, line 114
	cmake.build()
	ConanException: Error 2 while executing cmake --build C:\Users\Home\.conan\data\libtiff\4.1.0\_\_\build\56850fc9366221fc7a1643b188fbe1bc1a5b4f75\build_subfolder -- -j4
libtiff/4.1.0: 

```

</details>


Discussion:
Hi @leyewen! Thanks for reporting it!
Hi @leyewen !

I can't reproduce your error, are you running mingw?

If you take a look on my log, it's working fine:

Log: https://gist.github.com/uilianries/0b1c8d608454537389689e7e953bbf4c
@uilianries It's of course ok because you set
```
[options]
libtiff:lzma=False # temporary solution is disable it, default True
[build_requires]
*: msys2/20190524, mingw_installer/1.0@conan/stable
```
This will disable libtiff lzma build.

And I am not using
```
[options]
libtiff:lzma=False
[build_requires]
*: msys2/20190524, mingw_installer/1.0@conan/stable
```
config for build.

My gcc env is install `msys2-x86_64-20190524.exe` and `x86_64-8.1.0-release-posix-seh-rt_v6-rev0.7z`.
And set
```
[options]
libtiff:shared=True
```
It happened really, I tried at least three times emptied all packages for test.
@leyewen Now it's clear, but you didn't comment about the shared option before. I'll take a look again. Regards!

Resolving patch:
diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py
--- a/recipes/libtiff/all/conanfile.py
+++ b/recipes/libtiff/all/conanfile.py
@@ -87,6 +87,7 @@ def _configure_cmake(self):
         return self._cmake
 
     def _patch_sources(self):
+        cmakefile = os.path.join(self._source_subfolder, "CMakeListsOriginal.txt")
         if self.options.shared and self.settings.compiler == "Visual Studio":
             # https://github.com/Microsoft/vcpkg/blob/master/ports/tiff/fix-cxx-shared-libs.patch
             tools.replace_in_file(os.path.join(self._source_subfolder, 'libtiff', 'CMakeLists.txt'),
@@ -95,18 +96,17 @@ def _patch_sources(self):
                                   r'WINDOWS_EXPORT_ALL_SYMBOLS ON)')
 
             if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio":
-                tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeListsOriginal.txt"),
+                tools.replace_in_file(cmakefile,
                                       "find_library(M_LIBRARY m)",
                                       "if (NOT MINGW)\n  find_library(M_LIBRARY m)\nendif()")
                 if self.version == '4.0.8':
                     # only one occurence must be patched. fixed in 4.0.9
-                    tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeListsOriginal.txt"),
-                                          "if (UNIX)",
-                                          "if (UNIX OR MINGW)")
+                    tools.replace_in_file(cmakefile, "if (UNIX)", "if (UNIX OR MINGW)")
 
         tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeListsOriginal.txt"),
                               "add_subdirectory(tools)\nadd_subdirectory(test)\nadd_subdirectory(contrib)\nadd_subdirectory(build)\n"
                               "add_subdirectory(man)\nadd_subdirectory(html)", "")
+        tools.replace_in_file(cmakefile, "LIBLZMA_LIBRARIES", "LibLZMA_LIBRARIES")
 
     def build(self):
         self._patch_sources()


Test patch: