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

mingw-w64-x86_64-qgpgme-qt5: use of IMPORTED_IMPLIB_RELEASE breaks non-release CMake builds #22993

Closed
2 of 6 tasks
amyspark opened this issue Jan 4, 2025 · 4 comments
Closed
2 of 6 tasks
Labels

Comments

@amyspark
Copy link

amyspark commented Jan 4, 2025

Description / Steps to reproduce the issue

  1. Install mingw-w64-x86_64-qgpgme-qt5.
  2. Do a find_package(QGpgme) on any project.
  3. Link against the QGpgme target.

Expected behavior

Link should succeed.

Actual behavior

[proc] Ejecutando el comando: "C:\Program Files\CMake\bin\cmake.EXE" --build e:/kmymoney/build --config RelWithDebInfo --target install --
[build] ninja: error: 'kmymoney/misc/QGpgme-NOTFOUND', needed by 'kmymoney/misc/CMakeFiles/kmm_gpgfile_autogen_timestamp_deps', missing and no known rule to make it

This is because the import library as provided by MSYS2 is qualified for only the Release build type.

Verification

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANGARM64

Are you willing to submit a PR?

As soon as I get confirmation from a maintainer

@amyspark amyspark added the bug label Jan 4, 2025
@Biswa96
Copy link
Member

Biswa96 commented Jan 9, 2025

Please provide steps to reproduce the issue. Also, the cmake does not seem from msys2.

@amyspark
Copy link
Author

amyspark commented Jan 9, 2025

CMakeLists.txt:

cmake_minimum_required(VERSION 3.19)
project(gpgme2 C CXX)

find_package(Qt5 COMPONENTS Core REQUIRED)
find_package(QGpgme REQUIRED)

add_executable(main main.cpp)

target_link_libraries(main PUBLIC QGpgme)

main.cpp:

int main() {
    return 0;
}

Configuring with a recent enough CMake detects the error:

[main] Configurando el proyecto: gpgme 
[proc] Ejecutando el comando: D:/msys64/clang64/bin/cmake.exe -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=c:/Users/Amalia/Desktop/Rachel/gpgme/install -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_CXX_COMPILER:FILEPATH=D:/msys64/clang64/bin/clang++.exe -DCMAKE_CC_COMPILER:FILEPATH=D:/msys64/clang64/bin/clang.exe --no-warn-unused-cli -SC:/Users/Amalia/Desktop/Rachel/gpgme -Bc:/Users/Amalia/Desktop/Rachel/gpgme/build -G Ninja
[cmake] Not searching for unused variables given on the command line.
[cmake] -- The C compiler identification is Clang 18.1.8
[cmake] -- The CXX compiler identification is Clang 18.1.8
[cmake] -- Detecting C compiler ABI info
[cmake] -- Detecting C compiler ABI info - done
[cmake] -- Check for working C compiler: D:/msys64/clang64/bin/cc.exe - skipped
[cmake] -- Detecting C compile features
[cmake] -- Detecting C compile features - done
[cmake] -- Detecting CXX compiler ABI info
[cmake] -- Detecting CXX compiler ABI info - done
[cmake] -- Check for working CXX compiler: D:/msys64/clang64/bin/clang++.exe - skipped
[cmake] -- Detecting CXX compile features
[cmake] -- Detecting CXX compile features - done
[cmake] -- Configuring done (3.8s)
[cmake] CMake Warning (dev) in CMakeLists.txt:
[cmake]   Policy CMP0111 is not set: An imported target missing its location property
[cmake]   fails during generation.  Run "cmake --help-policy CMP0111" for policy
[cmake]   details.  Use the cmake_policy command to set the policy and suppress this
[cmake]   warning.
[cmake] 
[cmake]   IMPORTED_IMPLIB not set for imported target "QGpgme" configuration "Debug".
[cmake] This warning is for project developers.  Use -Wno-dev to suppress it.
[cmake] 
[cmake] -- Generating done (0.1s)
[cmake] -- Build files have been written to: C:/Users/Amalia/Desktop/Rachel/gpgme/build

This is patently clear in the contents of QGpgmeConfig.cmake lines 69 onwards:

# Create imported target QGpgme
add_library(QGpgme SHARED IMPORTED)

set_target_properties(QGpgme PROPERTIES
  IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libqgpgme.dll.a"
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/qgpgme;${_IMPORT_PREFIX}/include"
  INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core"
  IMPORTED_LOCATION "${_IMPORT_PREFIX}/bin/libqgpgme-15.dll"
)
get_target_property(_libpath QGpgme IMPORTED_IMPLIB_RELEASE)

And reviewing the patch that MSYS2 ships should've detected this bug on the spot (as it's a system artifact, the highlighted lines should not read RELEASE):

- IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a"
- INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@"
+ IMPORTED_IMPLIB_RELEASE "${_IMPORT_PREFIX}/lib/libqgpgme.dll.a"
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/qgpgme;${_IMPORT_PREFIX}/include"

@Biswa96
Copy link
Member

Biswa96 commented Jan 9, 2025

Thanks, I can reproduce the issue which should be fixed in upstream. IMPORTED_IMPLIB_RELEASE comes from upstream files

Meanwhile, if you have any patch to fix the warning please create a pull request.

@MehdiChinoune
Copy link
Collaborator

I think the issue is fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants