Skip to content

Conversation

@choyy
Copy link
Contributor

@choyy choyy commented Nov 7, 2025

cmake error: #8484

CMake Error at /github/home/.xmake/packages/o/opencv/4.12.0/f64cc25c8ea945fd9fed9b60af1ed663/lib/cmake/opencv4/OpenCVModules.cmake:363 (set_target_properties):
  The link interface of target "opencv_wechat_qrcode" contains:

    Iconv::Iconv

  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):
  /github/home/.xmake/packages/o/opencv/4.12.0/f64cc25c8ea945fd9fed9b60af1ed663/lib/cmake/opencv4/OpenCVConfig.cmake:128 (include)
  CMakeLists.txt:221 (FIND_PACKAGE)

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @choyy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request aims to resolve build and CMake-related issues encountered with OpenCV, particularly for version 4.12.0. It introduces a new patch for this specific version and modifies the CMake configuration to ensure proper dependency resolution, specifically for the Iconv library when building modules like opencv_wechat_qrcode. These changes are intended to fix a reported CMake error and improve the overall build stability for OpenCV.

Highlights

  • OpenCV 4.12.0 Patch: A new patch has been added specifically for OpenCV version 4.12.0, likely addressing specific issues or improvements for this version.
  • CMake Dependency Fix: The build configuration has been updated to correctly handle CMake dependencies. This includes adding include(CMakeFindDependencyMacro) and find_dependency(Iconv) to OpenCVModules.cmake for the opencv_wechat_qrcode module, resolving a reported CMake error.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request addresses a CMake build error by adding a new patch for OpenCV 4.12.0 and correcting a typo in the cmake.install function. Additionally, it modifies the generated OpenCVModules.cmake to include find_dependency(Iconv), which implies a new dependency on libiconv for projects consuming OpenCV. While the typo fix is a good improvement, the implicit dependency on libiconv should be explicitly declared in the opencv package's xmake.lua to ensure proper dependency management.

Comment on lines 243 to 245
io.replace(package:installdir("lib/cmake/opencv4/OpenCVModules.cmake"),
"opencv_wechat_qrcode\n",
"opencv_wechat_qrcode\ninclude(CMakeFindDependencyMacro)\nfind_dependency(Iconv)\n", {plain = true})
Copy link
Contributor

Choose a reason for hiding this comment

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

high

The addition of find_dependency(Iconv) in OpenCVModules.cmake indicates that libiconv is now a dependency for OpenCV, specifically for modules like opencv_wechat_qrcode. However, libiconv is not explicitly added as a dependency in the opencv package's on_load function. This can lead to build failures for downstream projects if libiconv is not available or properly managed by xmake. Please add package:add("deps", "libiconv") to ensure this dependency is correctly handled.

import("package.tools.cmake").install(package, configs, {buildir = "bd", shflags = shflags, ldflags = ldflags})
import("package.tools.cmake").install(package, configs, {builddir = "bd", shflags = shflags, ldflags = ldflags})

if package:is_plat("linux", "macosx") then
Copy link
Contributor

@luadebug luadebug Nov 10, 2025

Choose a reason for hiding this comment

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

opencv/opencv#20404 (comment)
Maybe related, as for MinGW.

If zxing.hpp is like this (according to contrib resource https://codeload.github.com/opencv/opencv_contrib/tar.gz/refs/tags/4.12.0): That would be if not package:is_plat("windows", "android") ?

#if defined(__ANDROID_API__) || defined(_MSC_VER)

#ifndef NO_ICONV
#define NO_ICONV
#endif

#endif

If we apply lebarsfa/Packages@4b271d2#diff-e13272f82adfb96ae33f958418128ddbc9bd47bc4819f0ddb82ca6358f365bc6 choco/libopencv-dev/tools/no_iconv_mingw.patch that would be if not package:is_plat("windows", "android", "mingw") ?

Copy link
Contributor Author

@choyy choyy Nov 10, 2025

Choose a reason for hiding this comment

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

opencv/opencv_contrib#2916 disabled MinGW, opencv/opencv_contrib#2931 enabled MinGW later. Then it would be not package:is_plat("windows", "android"). But I'm not sure if the cmake file is like lib/cmake/opencv4/OpenCVModules.cmake on MinGW.

Copy link
Contributor

Choose a reason for hiding this comment

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

Everything looks good, if we could do check by package version for MinGW filter maybe it would be better...?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems no version was released during MinGW was disabled?

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.

2 participants