conan-io / conan-center-index

Recipes for the ConanCenter repository
https://conan.io/center
MIT License
940 stars 1.69k forks source link

[package] tesseract/5.3.3: Build fails with MSVC debug #23943

Open Seally opened 3 months ago

Seally commented 3 months ago

Description

Building tesseract with the "Debug" build type fails on Windows when using MSVC (at least) with the message:

Expand ``` D:/home/.conan2/p/b/tesse9094796c026b0/b/build/CMakeFiles/CMakeScratch/TryCompile-f8clg0/cmTC_2e2e3Targets.cmake:21 (set_target_properties): The link interface of target "leptonica" contains: CONAN_LIB::leptonica_leptonica-1.83.1d_DEBUG but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. Call Stack (most recent call first): D:/home/.conan2/p/b/tesse9094796c026b0/b/build/CMakeFiles/CMakeScratch/TryCompile-f8clg0/CMakeLists.txt:18 (include) CMake Error at cmake/CheckFunctions.cmake:34 (try_run): Failed to generate test project build system. Call Stack (most recent call first): CMakeLists.txt:410 (check_leptonica_tiff_support) -- Configuring incomplete, errors occurred! tesseract/5.3.3: ERROR: Package '540fd90f5592e87fac971774d379d1fa485d1bdc' build failed tesseract/5.3.3: WARN: Build folder D:\home\.conan2\p\b\tesse9094796c026b0\b\build ERROR: tesseract/5.3.3: Error in build() method, line 147 cmake.configure() ConanException: Error 1 while executing ```

This doesn't occur when using the "Release" build type. I've attempted to replicate this using GCC on Linux, but the build succeeds, so this issue seems to be specific to MSVC "Debug" builds.

I have not yet verified whether using other compilers on Windows leads to similar issues.

Package and Environment Details

Conan profile

[settings] arch=x86_64 build_type=Debug compiler=msvc compiler.cppstd=20 compiler.runtime=dynamic compiler.version=193 os=Windows

Steps to reproduce

Run

conan install . --profile=debug --build=missing --output-folder=out

in a new stub CMake project under the VS2022 PowerShell dev environment.

conanfile.txt

[requires]
tesseract/5.3.3

[generators]
CMakeDeps
CMakeToolchain

[layout]
cmake_layout

Logs

Short version of log (subsequent run with most compilation done):

Click to expand log ``` conan : At line:1 char:1 + conan install . --profile=debug --build=missing --output-folder=out 2 ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError ======== Input profiles ======== Profile host: [settings] arch=x86_64 build_type=Debug compiler=msvc compiler.cppstd=20 compiler.runtime=dynamic compiler.runtime_type=Debug compiler.version=193 os=Windows Profile build: [settings] arch=x86_64 build_type=Release compiler=msvc compiler.cppstd=20 compiler.runtime=dynamic compiler.runtime_type=Release compiler.version=193 os=Windows ======== Computing dependency graph ======== Graph root conanfile.txt: D:\devel\Seally\conan-test\conanfile.txt Requirements getopt-for-visual-studio/20200201#32ee360e2552fe65ad8bec52edcd64fd - Cache giflib/5.2.1#40245212d3adda9d502692704b0b35ab - Cache jbig/20160605#2d29fa02aacd76902e0d2cbbc24631ef - Cache leptonica/1.83.1#f22a5e85d71e21ee4baeb556c4d743b2 - Cache libarchive/3.7.2#114cbc029fd927b03e0669123ea48d17 - Cache libcurl/8.6.0#357425be60d85553bfe65154194b71be - Cache libdeflate/1.19#3ea74a4549efc14d4b1202dc4bfbf602 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd - Cache libjpeg/9e#a794b5e74808992b08a21b126e19eab4 - Cache libpng/1.6.40#06f726bd4bfd83f5cdc10587826093f0 - Cache libtiff/4.6.0#51d0e7e15d032aeec1b64e65c44ecd9f - Cache libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38 - Cache openjpeg/2.5.0#2886244f2492121aa7c6c493a814db06 - Cache openssl/3.2.1#c7b554068caae5eda12b735ea6f23d70 - Cache tesseract/5.3.3#f6efa29051ee955fa105f8adf1f5582c - Cache xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2 - Cache zstd/1.5.5#e03fb7b37b87f0174e9db4a8407e3f4d - Cache Build requirements cmake/3.29.3#292a699b66d006bf4c6648608fa7c9e4 - Cache meson/1.2.2#04bdfb85d665c82b08a3510aee3ffd19 - Cache msys2/cci.latest#5a31efa2bde593541fd5ac3bcc50c01c - Cache nasm/2.15.05#058c93b2214a49ca1cfe9f8f26205568 - Cache ninja/1.11.1#77587f8c8318662ac8e5a7867eb4be21 - Cache pkgconf/2.1.0#27f44583701117b571307cf5b5fe5605 - Cache strawberryperl/5.32.1.1#8f83d05a60363a422f9033e52d106b47 - Cache Resolved version ranges cmake/[>=3.18 <4]: cmake/3.29.3 libcurl/[>=7.78.0 <9]: libcurl/8.6.0 openssl/[>=1.1 <4]: openssl/3.2.1 zlib/[>=1.2.11 <2]: zlib/1.3.1 ======== Computing necessary packages ======== tesseract/5.3.3: Checking 2 compatible configurations tesseract/5.3.3: Compatible configurations not found in cache, checking servers tesseract/5.3.3: '08d6c13d592665641d07c07925ca748c55122ec9': compiler.cppstd=17 tesseract/5.3.3: '133a9c8f6ce80b1276039f413cd40a2a1c8b3926': compiler.cppstd=23 Requirements giflib/5.2.1#40245212d3adda9d502692704b0b35ab:c62c5cfdb7a1cc6ede9a8513163565771c2c1026#5e42732588ec041850ada1a2329f 05c2 - Cache jbig/20160605#2d29fa02aacd76902e0d2cbbc24631ef:85bd0bf550d4574beeae07d92fdbad07dc9eecc7#2fd32becdda30784d8bf37a4344 3db26 - Cache leptonica/1.83.1#f22a5e85d71e21ee4baeb556c4d743b2:a924f927737bd04493b3c2b7cb8cc115a0c77622#a40a38689b74401ee58813dd cfbb0ca7 - Cache libarchive/3.7.2#114cbc029fd927b03e0669123ea48d17:3800ef524f3d2082a7e69f5b8371a5b93fac98c0#17619699f5d93a2df0ec6cb7 457c0ed1 - Cache libcurl/8.6.0#357425be60d85553bfe65154194b71be:42d7b763d0cc00fb2a5397473f33f9b2d2e32de4#e16cfa2811a4615cd1d306d3e62 1e195 - Cache libdeflate/1.19#3ea74a4549efc14d4b1202dc4bfbf602:ed44dacde2751b398e4bf9441ff992a70c913c00#b1ec3e86becc493a8a3564ff8 c349252 - Cache libiconv/1.17#73fefc1b696e069df90fd1d18aa63edd:ed44dacde2751b398e4bf9441ff992a70c913c00#306ae095e0906a5708173d891df 5b01d - Cache libjpeg/9e#a794b5e74808992b08a21b126e19eab4:ed44dacde2751b398e4bf9441ff992a70c913c00#2ec1d9ca5493ac3b9f4103b393baf391 - Cache libpng/1.6.40#06f726bd4bfd83f5cdc10587826093f0:5e7a111f5314c9f54a1e9427fb0e00352a8aecb0#0075d475a7b3e7f5edfa2d55997 0e4d0 - Cache libtiff/4.6.0#51d0e7e15d032aeec1b64e65c44ecd9f:9348f9f35f5669152f0bba37c081cc901ceab2bd#66eb50cb03a1247e3a786bb8708 138ec - Cache libwebp/1.3.2#52f69c4a31c5cf033fdd9230d77a8e38:12afaa78103951cc5089f5dfd4e152a7a2a704ce#bd5edb2fadc1f9a3b68d0c1fe74 3be10 - Cache openjpeg/2.5.0#2886244f2492121aa7c6c493a814db06:ed44dacde2751b398e4bf9441ff992a70c913c00#a630c9dd18533af84d52c07a20 1a02db - Cache openssl/3.2.1#c7b554068caae5eda12b735ea6f23d70:302e5a4b273149c6a991f3b5b0c98d358d2fa4c6#4eb7ddc6c5e8accf04a04cfd9e0 413d5 - Cache tesseract/5.3.3#f6efa29051ee955fa105f8adf1f5582c:540fd90f5592e87fac971774d379d1fa485d1bdc - Build xz_utils/5.4.5#51e5a6e6564f4ea3afd79def01f035ad:ed44dacde2751b398e4bf9441ff992a70c913c00#2114f8dd478743688358ed923d 9fc430 - Cache zlib/1.3.1#f52e03ae3d251dec704634230cd806a2:ed44dacde2751b398e4bf9441ff992a70c913c00#53f4ca25bf476932f386d0481bc44739 - Cache zstd/1.5.5#e03fb7b37b87f0174e9db4a8407e3f4d:d9c18cdab4c795a71d55be3a5ec18baae7d735df#eada0240e6811483b7bf6307f5892b6a - Cache Build requirements Skipped binaries getopt-for-visual-studio/20200201, cmake/3.29.3, meson/1.2.2, msys2/cci.latest, nasm/2.15.05, ninja/1.11.1, pkgconf/2.1.0, strawberryperl/5.32.1.1 ======== Installing packages ======== jbig/20160605: Already installed! (1 of 17) libdeflate/1.19: Already installed! (2 of 17) libjpeg/9e: Already installed! (3 of 17) libwebp/1.3.2: Already installed! (4 of 17) openjpeg/2.5.0: Already installed! (5 of 17) xz_utils/5.4.5: Already installed! (6 of 17) zlib/1.3.1: Already installed! (7 of 17) zstd/1.5.5: Already installed! (8 of 17) giflib/5.2.1: Already installed! (9 of 17) libiconv/1.17: Already installed! (10 of 17) libpng/1.6.40: Already installed! (11 of 17) libtiff/4.6.0: Already installed! (12 of 17) libarchive/3.7.2: Already installed! (13 of 17) openssl/3.2.1: Already installed! (14 of 17) leptonica/1.83.1: Already installed! (15 of 17) libcurl/8.6.0: Already installed! (16 of 17) -------- Installing package tesseract/5.3.3 (17 of 17) -------- tesseract/5.3.3: Building from source tesseract/5.3.3: Package tesseract/5.3.3:540fd90f5592e87fac971774d379d1fa485d1bdc tesseract/5.3.3: Copying sources to build folder tesseract/5.3.3: Building your package in D:\home\.conan2\p\b\tesse9094796c026b0\b tesseract/5.3.3: Calling generate() tesseract/5.3.3: Generators folder: D:\home\.conan2\p\b\tesse9094796c026b0\b\build\generators tesseract/5.3.3: CMakeToolchain generated: conan_toolchain.cmake tesseract/5.3.3: CMakeToolchain generated: D:\home\.conan2\p\b\tesse9094796c026b0\b\build\generators\CMakePresets.json tesseract/5.3.3: CMakeToolchain generated: D:\home\.conan2\p\b\tesse9094796c026b0\b\src\CMakeUserPresets.json tesseract/5.3.3: Generating aggregated env files tesseract/5.3.3: Generated aggregated env files: ['conanbuild.bat', 'conanrun.bat'] tesseract/5.3.3: Calling build() tesseract/5.3.3: Apply patch (portability): fix condition for cpu optimizations tesseract/5.3.3: Running CMake.configure() tesseract/5.3.3: RUN: cmake -G "Visual Studio 17 2022" -DCMAKE_TOOLCHAIN_FILE="generators/conan_toolchain.cmake" -DCMAKE_INSTALL_PREFIX="D:/home/.conan2/p/b/tesse9094796c026b0/p" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" "D:/home/.conan2/p/b/tesse9094796c026b0/b/src" -- Setting policy CMP0091 to NEW -- Using Conan toolchain: D:/home/.conan2/p/b/tesse9094796c026b0/b/build/generators/conan_toolchain.cmake -- Conan toolchain: CMAKE_GENERATOR_TOOLSET=v143 -- Conan toolchain: C++ Standard 20 with extensions OFF -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045. -- The C compiler identification is MSVC 19.39.33523.0 -- The CXX compiler identification is MSVC 19.39.33523.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped -- Detecting C compile features -- Detecting C compile features - done -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.39.33519/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring tesseract version 5.3.3... -- Setting build type to 'Release' as none was specified. -- IPO / LTO supported -- CMAKE_SYSTEM_PROCESSOR= CMake Warning (dev) in CMakeLists.txt: A logical block opening on the line D:/home/.conan2/p/b/tesse9094796c026b0/b/src/CMakeLists.txt:169 (if) closes on the line D:/home/.conan2/p/b/tesse9094796c026b0/b/src/CMakeLists.txt:276 (endif) with mis-matching arguments. This warning is for project developers. Use -Wno-dev to suppress it. -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) -- Conan: Target declared 'leptonica' -- Conan: Target declared 'GIF::GIF' -- Conan: Target declared 'PNG::PNG' -- Conan: Target declared 'ZLIB::ZLIB' -- Conan: Target declared 'openjp2' -- Conan: Including build module from 'D:/home/.conan2/p/b/openjd4caec841b1f4/p/lib/cmake/conan-official-openjpeg-variables.cmake' -- Conan: Target declared 'TIFF::TIFF' -- Conan: Component target declared 'libdeflate::libdeflate_static' -- Conan: Target declared 'LibLZMA::LibLZMA' -- Conan: Including build module from 'D:/home/.conan2/p/b/xz_uta980367117f69/p/lib/cmake/conan-official-xz_utils-variables.cmake' -- Conan: Target declared 'JPEG::JPEG' -- Conan: Target declared 'jbig::jbig' -- Conan: Component target declared 'zstd::libzstd_static' -- Conan: Component target declared 'WebP::webpdecoder' -- Conan: Component target declared 'WebP::sharpyuv' -- Conan: Component target declared 'WebP::webp' -- Conan: Component target declared 'WebP::webpdemux' -- Conan: Component target declared 'WebP::libwebpmux' -- Conan: Target declared 'libwebp::libwebp' -- Found leptonica version: 1.83.1 CMake Error at D:/home/.conan2/p/b/tesse9094796c026b0/b/build/CMakeFiles/CMakeScratch/TryCompile-f8clg0/cmTC_2e2e3Targets.cmake:21 (set_target_properties): The link interface of target "leptonica" contains: CONAN_LIB::leptonica_leptonica-1.83.1d_DEBUG but the target was not found. Possible reasons include: * There is a typo in the target name. * A find_package call is missing for an IMPORTED target. * An ALIAS target is missing. Call Stack (most recent call first): D:/home/.conan2/p/b/tesse9094796c026b0/b/build/CMakeFiles/CMakeScratch/TryCompile-f8clg0/CMakeLists.txt:18 (include) CMake Error at cmake/CheckFunctions.cmake:34 (try_run): Failed to generate test project build system. Call Stack (most recent call first): CMakeLists.txt:410 (check_leptonica_tiff_support) -- Configuring incomplete, errors occurred! tesseract/5.3.3: ERROR: Package '540fd90f5592e87fac971774d379d1fa485d1bdc' build failed tesseract/5.3.3: WARN: Build folder D:\home\.conan2\p\b\tesse9094796c026b0\b\build ERROR: tesseract/5.3.3: Error in build() method, line 147 cmake.configure() ConanException: Error 1 while executing ```

Full build log with all compilation messages (almost 43k lines): output-debug0.log

Ahajha commented 3 months ago

Potentially related to this issue with the Conan client itself: https://github.com/conan-io/conan/issues/12012

It seems that they try_xxx family of CMake functions just tend to not work for some reason.

web2098 commented 3 months ago

I just hit this today, it seems to be caused by cmake file for Tesseract not detecting a CMAKE_BUILD_TYPE so it defaults it to release

-- Setting build type to 'Release' as none was specified.

This results in the error

    the link interface of target "leptonica" contains:

    CONAN_LIB::leptonica_leptonica-1.83.1{BUILD_TYPE}

For any configuration not matching Release

Not sure how what the proper way to address the issue, but I just added the build_type to the configuration step for windows only.

memsharded commented 3 months ago

Here https://github.com/conan-io/conan/issues/12180#issuecomment-1909617709 it is recommended to try the CMAKE_TRY_COMPILE_CONFIGURATION