Details
-
Bug
-
Resolution: Done
-
P1: Critical
-
6.0.0 Beta2
-
-
970102639fa43c8dcbba7514e62154d006b7109f (qt/qtwayland/dev)
Description
With the fix for QTBUG-87446 in place (https://codereview.qt-project.org/c/qt/qtwayland/+/319688), the wayland scanner is run and successfully generates the code it is supposed to. But when linking the program, the following error occurs (this can be observed in the custom-extension/cpp-client example for instance):
FAILED: custom-extension-cpp-client : && /usr/bin/c++ CMakeFiles/custom-extension-cpp-client.dir/custom-extension-cpp-client_autogen/mocs_compilation.cpp.o CMakeFiles/custom-extension-cpp-client.dir/media/eskil/Dev/dev/qt6-test/qtwayland/examples/wayland/custom-extension/client-common/customextension.cpp.o CMakeFiles/custom-extension-cpp-client.dir/main.cpp.o CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o -o custom-extension-cpp-client -Wl,-rpath,/media/eskil/Dev/dev/qt6-test-install/lib: /usr/lib/x86_64-linux-gnu/libxkbcommon.so /media/eskil/Dev/dev/qt6-test-install/lib/libQt6WaylandClient.so.6.0.0 /media/eskil/Dev/dev/qt6-test-install/lib/libQt6Gui.so.6.0.0 /media/eskil/Dev/dev/qt6-test-install/lib/libQt6Core.so.6.0.0 -pthread /usr/lib/x86_64-linux-gnu/libGLX.so /usr/lib/x86_64-linux-gnu/libOpenGL.so /usr/lib/x86_64-linux-gnu/libwayland-client.so /usr/lib/x86_64-linux-gnu/libwayland-cursor.so && : CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o: In function `qt_example_extension_create_local_object': qwayland-custom.cpp:(.text+0x108): undefined reference to `qt_example_local_object_interface' CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o: In function `QtWayland::qt_example_extension::init(wl_registry*, unsigned int, int)': qwayland-custom.cpp:(.text+0x30b): undefined reference to `qt_example_extension_interface' CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o: In function `QtWayland::qt_example_extension::interface()': qwayland-custom.cpp:(.text+0x3bf): undefined reference to `qt_example_extension_interface' CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o: In function `QtWayland::qt_example_local_object::init(wl_registry*, unsigned int, int)': qwayland-custom.cpp:(.text+0x74b): undefined reference to `qt_example_local_object_interface' CMakeFiles/custom-extension-cpp-client.dir/qwayland-custom.cpp.o: In function `QtWayland::qt_example_local_object::interface()': qwayland-custom.cpp:(.text+0x7ff): undefined reference to `qt_example_local_object_interface' collect2: error: ld returned 1 exit status
The missing symbols are symbols from the generated code, and looking at the build.ninja file, it does not look like the generated code is compiled and linked in at all.
This only happens when the example is configured using qt-cmake and built individually. With a module level build, the example also builds just fine.
The build.ninja file for the top-level build: toplevel_build.ninja
The build.ninja file for the standalone build: standalone_build.ninja
Search through both for e.g. "wayland-custom-protocol.c.o". In the first you will see it both as a build target and in the linker arguments, and in the other not at all.
Note that server-side code generation is a separate script which is almost identical. It also has this problem.