Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opencv 4.x: honor dynamic runtime from conan profile when compiler is clang-cl #24071

Merged
merged 2 commits into from
May 30, 2024

Conversation

SpaceIm
Copy link
Contributor

@SpaceIm SpaceIm commented May 22, 2024

closes #24056

is_msvc() and is_msvc_static_runtime() helpers don't understand clang-cl profiles (os=Windows, compiler=clang, compiler.runtime defined). They are too specific and not a proper mapping with the meaning of MSVC variable in CMake (MSVC is TRUE in CMake for any cl like compiler).
In opencv, runtime is changed through a CMake option which must be passed by the recipe, so opencv recipe must pass compiler.runtime if it is defined, irrespective of compiler.


@SpaceIm SpaceIm changed the title opencv: fix clang-cl with dynamic runtime opencv 4.x: fix clang-cl with dynamic runtime May 22, 2024
@conan-center-bot

This comment has been minimized.

@conan-center-bot

This comment has been minimized.

Copy link
Contributor

Hooks produced the following warnings for commit bc01d0b
opencv/4.9.0@#0e6e307ff1ed2e12e623c2e72a3214de
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490d.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490d.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490d.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio490d.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
opencv/4.5.5@#8dd0345982066b80c1b279106dee329a
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455d.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455d.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455d.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455d.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio455.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
opencv/4.8.1@#c786879d407ea7a371081ee7e87f66bb
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481d.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481d.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481d.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481d.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio481.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
opencv/4.1.2@#845e76a4ed264a974308672169d8568e
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412d.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412d.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio412d.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
opencv/4.5.3@#da3d82851686a2d09d28f9063a7b5310
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453d.dll' links to system library 'd3d11' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453d.dll' links to system library 'mfreadwrite' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453d.dll' links to system library 'mf' but it is not in cpp_info.system_libs.
post_package(): WARN: [MISSING SYSTEM LIBS (KB-H043)] Library '.\bin\opencv_videoio453d.dll' links to system library 'dxgi' but it is not in cpp_info.system_libs.

@danimtb
Copy link
Member

danimtb commented May 24, 2024

I was trying to compile opencv with and without the changes here with clang-cl on windows but the build keeps getting stuck at:

opencv/4.9.0: RUN: cmake --build "C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build" --config Release
MSBuild version 17.10.4+10fbfbf2e for .NET Framework

  Checking Build System
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt
  opencv_core_AVX.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\core\opencv_core_AVX.dir\Release\opencv_core_AVX.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt
  opencv_core_AVX2.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\core\opencv_core_AVX2.dir\Release\opencv_core_AVX2.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt
  opencv_core_AVX512_SKX.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\core\opencv_core_AVX512_SKX.dir\Release\opencv_core_AVX512_SKX.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt
  opencv_core_SSE4_1.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\core\opencv_core_SSE4_1.dir\Release\opencv_core_SSE4_1.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt
  opencv_core_SSE4_2.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\core\opencv_core_SSE4_2.dir\Release\opencv_core_SSE4_2.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/CMakeLists.txt
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/CMakeLists.txt
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/imgproc/CMakeLists.txt
  opencv_imgproc_AVX.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_AVX.dir\Release\opencv_imgproc_AVX.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/imgproc/CMakeLists.txt
  opencv_imgproc_AVX2.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_AVX2.dir\Release\opencv_imgproc_AVX2.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/imgproc/CMakeLists.txt
  opencv_imgproc_AVX512_SKX.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_AVX512_SKX.dir\Release\opencv_imgproc_AVX512_SKX.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/imgproc/CMakeLists.txt
C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\src\modules\imgproc\src\imgwarp.sse4_1.cpp(135,46): warning : arithmetic between floating-point type 'const float' and enumeration type 'c v::InterpolationMasks' is deprecated [-Wdeprecated-enum-float-conversion] [C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.vcxproj]
C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\src\modules\imgproc\src\imgwarp.sse4_1.cpp(136,46): warning : arithmetic between floating-point type 'const float' and enumeration type 'c v::InterpolationMasks' is deprecated [-Wdeprecated-enum-float-conversion] [C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.vcxproj]
C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\src\modules\imgproc\src\imgwarp.sse4_1.cpp(168,50): warning : arithmetic between floating-point type 'const float' and enumeration type 'c v::InterpolationMasks' is deprecated [-Wdeprecated-enum-float-conversion] [C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.vcxproj]
C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\src\modules\imgproc\src\imgwarp.sse4_1.cpp(169,54): warning : arithmetic between floating-point type 'const float' and enumeration type 'c v::InterpolationMasks' is deprecated [-Wdeprecated-enum-float-conversion] [C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.vcxproj]
C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\src\modules\imgproc\src\imgwarp.sse4_1.cpp(483,36): warning : arithmetic between enumeration type 'cv::InterpolationMasks' and floating-po int type 'double' is deprecated [-Wdeprecated-enum-float-conversion] [C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.vcxproj]
  opencv_imgproc_SSE4_1.vcxproj -> C:\Users\danielm\.conan2\p\b\openc8da7fbfc076e5\b\build\modules\imgproc\opencv_imgproc_SSE4_1.dir\Release\opencv_imgproc_SSE4_1.lib
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/videoio/CMakeLists.txt
  Processing OpenCL kernels (core)
  Building Custom Rule C:/Users/danielm/.conan2/p/b/openc8da7fbfc076e5/b/src/modules/core/CMakeLists.txt

Was this your experience @SpaceIm? Any clue what's happening here? Thank you!

@SpaceIm
Copy link
Contributor Author

SpaceIm commented May 24, 2024

No idea, I've just fixed the most obvious issue reported by #24056 (dynamic runtime not honored if clang-cl), but not tested myself since I'm not on Windows currently. I don't know why it's stuck now (I guess when opencv_core490.lib is created?).

@Jimbopython Do you have a better luck?

@SpaceIm SpaceIm changed the title opencv 4.x: fix clang-cl with dynamic runtime opencv 4.x: honor dynamic runtime from conan profile when compiler is clang-cl May 24, 2024
@conan-center-bot
Copy link
Collaborator

Conan v1 pipeline ✔️

All green in build 3 (bc01d0b14eb6e12744a2e0a629dc561b83cbb539):

  • opencv/4.5.5:
    All packages built successfully! (All logs)

  • opencv/4.9.0:
    All packages built successfully! (All logs)

  • opencv/4.8.1:
    All packages built successfully! (All logs)

  • opencv/4.5.3:
    All packages built successfully! (All logs)

  • opencv/4.1.2:
    All packages built successfully! (All logs)


Conan v2 pipeline ✔️

Note: Conan v2 builds are now mandatory. Please read our discussion about it.

All green in build 3 (bc01d0b14eb6e12744a2e0a629dc561b83cbb539):

  • opencv/4.9.0:
    All packages built successfully! (All logs)

  • opencv/4.8.1:
    All packages built successfully! (All logs)

  • opencv/4.5.3:
    All packages built successfully! (All logs)

  • opencv/4.5.5:
    All packages built successfully! (All logs)

  • opencv/4.1.2:
    All packages built successfully! (All logs)

@Jimbopython
Copy link

I will take a look next week if the changes fix my issue. I had the issue from @danimtb as well, when building with clang-cl 17.
Clang-cl 16 is working fine.

@Jimbopython
Copy link

I just checked it and the fix works with clang-cl 16.

Note that the hanging of clang-cl 17 is known and already fixed in a newer version:

llvm/llvm-project#69428

@SpaceIm
Copy link
Contributor Author

SpaceIm commented May 25, 2024

May I ask to conan folks maintaining conancenter to push for adding these helpers to conan API? I've opened conan-io/conan#12336 long time ago, and I don't have the time to argue more.

Copy link
Member

@AbrilRBS AbrilRBS left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for double checking @Jimbopython :)

@conan-center-bot conan-center-bot merged commit c49991d into conan-io:master May 30, 2024
33 checks passed
@SpaceIm SpaceIm deleted the fix-opencv-clang-cl branch May 30, 2024 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[package] opencv/4.9: opencv cannot be built with clang-cl + dynamic runtime
5 participants