Problems with building QtSVG from source
-
I'd like to contribute to SVG rendering in the Qt project. Unfortunately, even preparing a baseline build proved to be a problem.
I use Fedora. All the relevant prerequisite packages (devel versions included) are installed. After fiddling around for two days, googling, and poking the AI assistant to understand the architecture, particular CMake directives, and linking dependencies, I managed to make the build work. Apparently.
(Note: I do NOT use AI to write any code. This is an ideological choice for many reasons, including personal data and code safety.)
My natural next step is to run tests (before I make any changes to code) to
a) establish a baseline against which to evaluate future changes
b) understand how auto testing here works in concept
c) be ready to re-run the same tests after rebuilding
That's where I start losing whatever little hair I have left. I went with creating a CMakeUserPresets.json to keep all my config variables at one place. I've identified 3 variables relevant to tests and added them like this:"QT_BUILD_EXAMPLES":"OFF", "QT_BUILD_STANDALONE_EXAMPLES":"OFF", "QT_BUILD_STANDALONE_TESTS":"ON",I've explicitly disabled both example vars because the existing CMake project settings allow building either examples or tests, not both. They are mutually exclusive.
However, trying to reconfig CMake and build gives me this:CMake Error at /usr/lib64/cmake/Qt6/QtTargetHelpers.cmake:192 (target_link_libraries): [cmake] Target "tst_qsvggenerator" links to: [cmake] Qt6::Svg [cmake] but the target was not found.I've tried some hacks to no avail. It seems that I need some deeper insight into the structure.
About my environment:
Fedora 44 with KDE Plasma 6.7.2. I use VSCodium with C++ extensions: Kylin CMake Workflow, Clangd, Clang-format, CodeLLDB (trying to avoid MS telemetry here). The compilers are GCC / G++ .About the specific build:
The current stable Qt build for Fedora is Qt 6.11.1. The latest stable QtSvg source version matching this is 6.10 (6.11 requires Qt 6.11.2, dev — an even newer one). So 6.10 is the branch that I'm trying to build.
I target the QtSvg repo itself, trying to circumvent building the overarching QtBase (scary!). -
The problem is that you defined QT_BUILD_STANDALONE_TESTS (which expects an installed module) instead of QT_BUILD_TESTS (which builds tests in the same tree as the module you are building) — just replace it with the correct variable and rebuild.
Fix in CMakeUserPresets.json
"QT_BUILD_EXAMPLES": "OFF", "QT_BUILD_STANDALONE_EXAMPLES": "OFF", "QT_BUILD_TESTS": "ON" -
M MelOzone has marked this topic as solved
-
M MelOzone referenced this topic