Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Undefined symbol when trying to load a Wayland custom shell extension client plugin
Forum Updated to NodeBB v4.3 + New Features

Undefined symbol when trying to load a Wayland custom shell extension client plugin

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 178 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Brenton
    wrote last edited by
    #1

    I'm having an issue with writing a custom shell integration client plugin for Wayland. I'm trying to write a plugin for wlr-layer-shell like layer-shell-qt but with minimal dependencies. I can build the plugin but when I try to use it I get an "undefined symbol" error. The custom shell example builds and runs fine, but when I try to use other Wayland protocols (like xdg-shell) I get the error.

    As a test I've copied xdg-shell from QtWayland 6.8.3, renamed it to "new-shell", and modified the CMakeLists.txt to be similar to the custom shell example. Then I build the project with cmake -B build && cmake --build build and run test.sh.

    The output I get (omitting the non-relevant output) is this:

    qt.core.library: "/home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so" cannot load: Cannot load library /home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so: /home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so: undefined symbol: xdg_activation_v1_interface
    qt.core.plugin.loader: QLibraryPrivate::loadPlugin failed on "/home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so" : "Cannot load library /home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so: /home/brenton/Development/new-shell/plugins/wayland-shell-integration/libnew-shell.so: undefined symbol: xdg_activation_v1_interface"
    qt.qpa.wayland: Loading shell integration failed.
    qt.qpa.wayland: Attempted to load the following shells QList("new-shell")
    qt.qpa.plugin: Could not load the Qt platform plugin "wayland" in "" even though it was found.
    This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
    
    Available platform plugins are: wayland, wayland-egl, vnc, xcb, minimalegl, vkkhrdisplay, offscreen, eglfs, minimal, linuxfb.
    
    ./test.sh: line 11: 47588 Aborted                 (core dumped) qml --verbose test.qml
    

    So the error is undefined symbol: xdg_activation_v1_interface, but xdg-activation-v1.xml is included in qt_generate_wayland_protocol_client_sources. It's not just an issue with xdg_activation_v1_interface, I have seen the error for various functions that are in the files generated by qt_generate_wayland_protocol_client_sources.

    Does anyone know what the issue could be? Obviously xdg-shell in QtWayland works, and layer-shell-qt works too. I have the issue with layer-shell-qt although I have to make modifications to the CMakeLists.txt to build it. I've also tried using Qt 6.9.1 and the newest version of cmake.

    Thanks

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote last edited by
      #2

      Hi and welcome to devnet,

      What do you get if you run ldd on that plug-in ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      B 1 Reply Last reply
      0
      • SGaistS SGaist

        Hi and welcome to devnet,

        What do you get if you run ldd on that plug-in ?

        B Offline
        B Offline
        Brenton
        wrote last edited by
        #3

        Hey @SGaist, this is what I get:

        $ ldd libnew-shell.so 
        	linux-vdso.so.1 (0x00007b09d8fa6000)
        	libwayland-client.so.0 => /lib/x86_64-linux-gnu/libwayland-client.so.0 (0x00007b09d8f18000)
        	libQt6WaylandClient.so.6 => /opt/Qt/6.8.3/gcc_64/lib/libQt6WaylandClient.so.6 (0x00007b09d8e0c000)
        	libQt6Gui.so.6 => /opt/Qt/6.8.3/gcc_64/lib/libQt6Gui.so.6 (0x00007b09d8200000)
        	libGLX.so.0 => /lib/x86_64-linux-gnu/libGLX.so.0 (0x00007b09d8dd9000)
        	libOpenGL.so.0 => /lib/x86_64-linux-gnu/libOpenGL.so.0 (0x00007b09d8dac000)
        	libQt6Core.so.6 => /opt/Qt/6.8.3/gcc_64/lib/libQt6Core.so.6 (0x00007b09d7a00000)
        	libstdc++.so.6 => /lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007b09d7600000)
        	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007b09d8d7e000)
        	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007b09d7200000)
        	libffi.so.8 => /lib/x86_64-linux-gnu/libffi.so.8 (0x00007b09d8d72000)
        	libwayland-cursor.so.0 => /lib/x86_64-linux-gnu/libwayland-cursor.so.0 (0x00007b09d8d66000)
        	libGL.so.1 => /lib/x86_64-linux-gnu/libGL.so.1 (0x00007b09d8cdf000)
        	libxkbcommon.so.0 => /lib/x86_64-linux-gnu/libxkbcommon.so.0 (0x00007b09d81b7000)
        	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007b09d7917000)
        	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007b09d8cda000)
        	libEGL.so.1 => /lib/x86_64-linux-gnu/libEGL.so.1 (0x00007b09d8cc6000)
        	libfontconfig.so.1 => /lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007b09d8166000)
        	libX11.so.6 => /lib/x86_64-linux-gnu/libX11.so.6 (0x00007b09d74c3000)
        	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007b09d8cc1000)
        	libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007b09d70b7000)
        	libQt6DBus.so.6 => /opt/Qt/6.8.3/gcc_64/lib/libQt6DBus.so.6 (0x00007b09d6fe5000)
        	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007b09d814a000)
        	libfreetype.so.6 => /lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007b09d6f19000)
        	libgthread-2.0.so.0 => /lib/x86_64-linux-gnu/libgthread-2.0.so.0 (0x00007b09d8cba000)
        	libGLdispatch.so.0 => /lib/x86_64-linux-gnu/libGLdispatch.so.0 (0x00007b09d6e61000)
        	libicui18n.so.73 => /opt/Qt/6.8.3/gcc_64/lib/libicui18n.so.73 (0x00007b09d6a00000)
        	libicuuc.so.73 => /opt/Qt/6.8.3/gcc_64/lib/libicuuc.so.73 (0x00007b09d6600000)
        	libicudata.so.73 => /opt/Qt/6.8.3/gcc_64/lib/libicudata.so.73 (0x00007b09d4600000)
        	libzstd.so.1 => /lib/x86_64-linux-gnu/libzstd.so.1 (0x00007b09d6da7000)
        	librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007b09d8cb3000)
        	/lib64/ld-linux-x86-64.so.2 (0x00007b09d8fa8000)
        	libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007b09d811e000)
        	libxcb.so.1 => /lib/x86_64-linux-gnu/libxcb.so.1 (0x00007b09d80f5000)
        	libpcre2-8.so.0 => /lib/x86_64-linux-gnu/libpcre2-8.so.0 (0x00007b09d7429000)
        	libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007b09d78c8000)
        	libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007b09d78b4000)
        	libpng16.so.16 => /lib/x86_64-linux-gnu/libpng16.so.16 (0x00007b09d6d6f000)
        	libbrotlidec.so.1 => /lib/x86_64-linux-gnu/libbrotlidec.so.1 (0x00007b09d78a6000)
        	libXau.so.6 => /lib/x86_64-linux-gnu/libXau.so.6 (0x00007b09d8ca9000)
        	libXdmcp.so.6 => /lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007b09d789e000)
        	libsystemd.so.0 => /lib/x86_64-linux-gnu/libsystemd.so.0 (0x00007b09d6920000)
        	libbrotlicommon.so.1 => /lib/x86_64-linux-gnu/libbrotlicommon.so.1 (0x00007b09d68fd000)
        	libbsd.so.0 => /lib/x86_64-linux-gnu/libbsd.so.0 (0x00007b09d7888000)
        	libcap.so.2 => /lib/x86_64-linux-gnu/libcap.so.2 (0x00007b09d741c000)
        	libgcrypt.so.20 => /lib/x86_64-linux-gnu/libgcrypt.so.20 (0x00007b09d64b8000)
        	liblz4.so.1 => /lib/x86_64-linux-gnu/liblz4.so.1 (0x00007b09d68db000)
        	liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007b09d68a9000)
        	libmd.so.0 => /lib/x86_64-linux-gnu/libmd.so.0 (0x00007b09d6d60000)
        	libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007b09d6884000)
        
        1 Reply Last reply
        0
        • Axel SpoerlA Offline
          Axel SpoerlA Offline
          Axel Spoerl
          Moderators
          wrote last edited by
          #4

          Is the generated xdg-activation-v1-protocol.c linked in your CMakeLists.txt?

          Software Engineer
          The Qt Company, Oslo

          B 1 Reply Last reply
          0
          • Axel SpoerlA Axel Spoerl

            Is the generated xdg-activation-v1-protocol.c linked in your CMakeLists.txt?

            B Offline
            B Offline
            Brenton
            wrote last edited by
            #5

            @Axel-Spoerl not directly, but I believe that should be handled by the qt_generate_wayland_protocol_client_sources function.

            I've tried adding the generated files like this but I still have the same run time error:

            target_sources(new-shell PUBLIC
                    build/qwayland-xdg-activation-v1.cpp
                    build/qwayland-xdg-activation-v1.h
                    build/qwayland-xdg-decoration-unstable-v1.cpp
                    build/qwayland-xdg-decoration-unstable-v1.h
                    build/qwayland-xdg-dialog-v1.cpp
                    build/qwayland-xdg-dialog-v1.h
                    build/qwayland-xdg-foreign-unstable-v2.cpp
                    build/qwayland-xdg-foreign-unstable-v2.h
                    build/qwayland-xdg-shell.cpp
                    build/qwayland-xdg-shell.h
                    build/wayland-xdg-activation-v1-client-protocol.h
                    build/wayland-xdg-activation-v1-protocol.c
                    build/wayland-xdg-decoration-unstable-v1-client-protocol.h
                    build/wayland-xdg-decoration-unstable-v1-protocol.c
                    build/wayland-xdg-dialog-v1-client-protocol.h
                    build/wayland-xdg-dialog-v1-protocol.c
                    build/wayland-xdg-foreign-unstable-v2-client-protocol.h
                    build/wayland-xdg-foreign-unstable-v2-protocol.c
                    build/wayland-xdg-shell-client-protocol.h
                    build/wayland-xdg-shell-protocol.c
            )
            
            1 Reply Last reply
            0
            • Axel SpoerlA Offline
              Axel SpoerlA Offline
              Axel Spoerl
              Moderators
              wrote last edited by
              #6

              If a library exists and an application’s related symbols can’t be resolved, it can be any combination of

              • version mismatch
              • missing user permissions
              • not linked
                Hard to guess from here. You can only try that locally

              Software Engineer
              The Qt Company, Oslo

              1 Reply Last reply
              0
              • B Offline
                B Offline
                Brenton
                wrote last edited by
                #7

                I've figured out the problem, in the project definition in CMakeLists.txt I had CXX but not C, which meant that the .c files weren't processed.

                Christian EhrlicherC 1 Reply Last reply
                1
                • B Brenton has marked this topic as solved
                • B Brenton

                  I've figured out the problem, in the project definition in CMakeLists.txt I had CXX but not C, which meant that the .c files weren't processed.

                  Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote last edited by
                  #8

                  @Brenton said in Undefined symbol when trying to load a Wayland custom shell extension client plugin:

                  n the project definition in CMakeLists.txt I had CXX but not C

                  Simply leave it empty so CMake will auto-determine the needed compilers.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  B 1 Reply Last reply
                  2
                  • Christian EhrlicherC Christian Ehrlicher

                    @Brenton said in Undefined symbol when trying to load a Wayland custom shell extension client plugin:

                    n the project definition in CMakeLists.txt I had CXX but not C

                    Simply leave it empty so CMake will auto-determine the needed compilers.

                    B Offline
                    B Offline
                    Brenton
                    wrote last edited by
                    #9

                    @Christian-Ehrlicher said in Undefined symbol when trying to load a Wayland custom shell extension client plugin:

                    Simply leave it empty so CMake will auto-determine the needed compilers.

                    Yeah, if it's omitted it will default to C and CXX. The custom shell example has LANGUAGES CXX but that still works for the example.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved