Closed fxdeniz closed 4 months ago
Hi, I can't repro your issue.
Built qt 6.7.2 from source:
sudo apt install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev
./configure -opensource -confirm-license -nomake examples -nomake tests -no-dbus -no-openssl
cmake --build . --parallel
sudo ninja install
Build your project
git clone https://github.com/fxdeniz/NeSync.git
cd NeSync
git submodule update --init
cmake -DCMAKE_PREFIX_PATH="/usr/local/Qt-6.7.2" -B build -G "Ninja"
cd build
ninja
./NeSync
Consider pointing quazip git submodule to master if that changes anything.
Same here, on Windows and Linux. I jumped from 6.6.0 to 6.7.2, so I can't comment on 6.7.1, but...
CMake Error at D:/a/CLIFp/CLIFp/Qt/Install/lib/cmake/Qt6/QtPublicWalkLibsHelpers.cmake:259 (message):
The Core5Compat target is mentioned as a dependency for QuaZip::QuaZip, but
not declared.
Call Stack (most recent call first):
D:/a/CLIFp/CLIFp/Qt/Install/lib/cmake/Qt6/QtPublicWalkLibsHelpers.cmake:311 (__qt_internal_walk_libs)
D:/a/CLIFp/CLIFp/Qt/Install/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:651 (__qt_internal_collect_all_target_dependencies)
D:/a/CLIFp/CLIFp/Qt/Install/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:774 (_qt_internal_finalize_executable)
D:/a/CLIFp/CLIFp/Qt/Install/lib/cmake/Qt6Core/Qt6CoreMacros.cmake:590:EVAL:1 (qt6_finalize_target)
app/CMakeLists.txt:DEFERRED
I'll try to discern what's going on if I can, but it's interesting that the problem doesn't seem to affect everyone. Happens to me on master too.
EDIT: So far I can confirm that the issue doesn't occur with the same setup otherwise, but Qt 6.7.1
Ok so at least in my case it seems to have been a latent bug that previously went unnoticed. I didn't have Core5Compat listed in my find_package(Qt6...)
call. I'm not sure how it was working before this (it's almost like QuaZip brute force links to the lib even if the CMake target doesn't exist, and that Qt before wasn't double-checking the target's existence), but it seems that in like in 6.7.2 Qt closed the hole in their CMake scripts:
$ diff -u "C:\Engineering\Development\Qt\6.7.1\static\msvc2022_64\lib\cmake\Qt6\QtPublicWalkLibsHelpers.cmake" "C:\Users\Player\Downloads\Chrome\6.7.2-static-release\lib\cmake\Qt6\QtPublicWalkLibsHelpers.cmake"
--- "C:\\Engineering\\Development\\Qt\\6.7.1\\static\\msvc2022_64\\lib\\cmake\\Qt6\\QtPublicWalkLibsHelpers.cmake" 2024-05-08 05:42:08.000000000 -0400
+++ "C:\\Users\\Player\\Downloads\\Chrome\\6.7.2-static-release\\lib\\cmake\\Qt6\\QtPublicWalkLibsHelpers.cmake" 2024-05-06 19:06:44.000000000 -0400
@@ -184,13 +184,13 @@
if(lib_target MATCHES "^::@")
continue()
elseif(TARGET ${lib_target})
- if ("${lib_target}" MATCHES "^Qt::(.*)")
- # If both, Qt::Foo and Foo targets exist, prefer the target name without
+ if(NOT "${lib_target}" MATCHES "^(Qt|${QT_CMAKE_EXPORT_NAMESPACE})::.+")
+ # If both, Qt::Foo and Foo targets exist, prefer the target name with versioned
# namespace. Which one is preferred doesn't really matter. This code exists to
# avoid ending up with both, Qt::Foo and Foo in our dependencies.
- set(namespaceless_lib_target "${CMAKE_MATCH_1}")
- if(TARGET "${namespaceless_lib_target}")
- set(lib_target ${namespaceless_lib_target})
+ set(versioned_qt_target "${QT_CMAKE_EXPORT_NAMESPACE}::${lib_target}")
+ if(TARGET "${versioned_qt_target}")
+ set(lib_target ${versioned_qt_target})
endif()
endif()
get_target_property(lib_target_type ${lib_target} TYPE)
@@ -255,8 +255,8 @@
__qt_internal_promote_target_to_global(${lib_target_unaliased})
endif()
endif()
- elseif("${lib_target}" MATCHES "^Qt::(.*)")
- message(FATAL_ERROR "The ${CMAKE_MATCH_1} target is mentioned as a dependency for \
+ elseif("${lib_target}" MATCHES "^(Qt|${QT_CMAKE_EXPORT_NAMESPACE})::(.*)")
+ message(FATAL_ERROR "The ${CMAKE_MATCH_2} target is mentioned as a dependency for \
${target}, but not declared.")
else()
if(NOT operation MATCHES "^(collect|direct)_targets$")
So simply adding the missing component to the find_package() call fixed things. Not sure how @fxdeniz is experiencing this, but maybe he unknowingly was using a different version of his script where that component was missing...
Hi, I solved the problem.
The solution was adding the Core5Compat
to find_package
directive in the CMakeLists.txt
.
You can find the solution here: https://github.com/fxdeniz/NeSync/commit/273392d3c1192afd29ee43a3bde740ae50cc4c99
As I said, prior to Qt 6.7.2
you don't need to declare Core5Compat
.
But something changed in Qt 6.7.2
and you need to declare it in the CMakeLists.txt
.
Plus, maybe merging #198 by @geustache may solve this problem entirely.
Core5Compat
did not improve anything in a similar situation, but setting CMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON
in CMake solved the issue for me.
Hi,
I'm getting this error when I'm trying to build my project.
This occurs on all platforms (Mac, Linux and Windows). Error occurs immediately when CMake is ran. Specifically, this error started to occur when I switched to
Qt 6.7.2
I tried to build with
Qt 6.7.2
on all platforms I mentioned, and I'm getting same error message on all platforms. Before switching toQt 6.7.2
even with Qt 6.7.1 or older, everything was working fine.This will probably affect the upcoming Qt releases too.
As a final note, I'm leaving the error log here:
This is the CMake file, I was building: https://github.com/fxdeniz/NeSync/blob/main/CMakeLists.txt