Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-86287

Static 5.15.0 compile results in "undefined reference to xcb_aux_create_gc"

    XMLWordPrintable

Details

    • Linux/X11
    • 39b1dea2ec5cde9523df61c78dec5d4b195f66d2 (qt/qtbase/dev) adc42bebcac764ca8de78578e3a4ac39b621bd09 (qt/qtbase/5.15)

    Description

      Using Ubuntu 18.04 inside Docker, compiled Qt5 with -static -qpa xcb [...] 

      After that's done, I try to compile my program I get:

      /usr/local/lib/libxcb-image.a(xcb_image.o): In function `xcb_create_pixmap_from_bitmap_data':
      xcb_image.c:(.text+0x1c69): undefined reference to `xcb_aux_create_gc'
      collect2: error: ld returned 1 exit status
      CMakeFiles/hello2.dir/build.make:310: recipe for target 'hello2' failed
      make[2]: *** [hello2] Error 1
      CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/hello2.dir/all' failed
      make[1]: *** [CMakeFiles/hello2.dir/all] Error 2
      Makefile:102: recipe for target 'all' failed

       

      I have:

      • /usr/local/lib/libxcd-image.a version 0.3.9
      • /usr/local/lib/libxcd-util.a version 0.3.9

       

      libxcb-image.a requires libxcb-util.a, as can be seen on the libxcb-image repo, the function xcb_aux_create_gc is defined in -util, see also the libxcb-util repo.

      However, in qtbase/src/gui/configure.json we see no such requirement.

      So I have added:

      "xcb_util": {
          "label": "XCB Util >= 0.3.9",
          "headers": "xcb/xcb_util.h",
          "sources": [
              { "type": "pkgConfig", "args": "xcb-util >= 0.3.9" },
              "-lxcb-util"
          ],
          "use": "xcb"
      },
      "xcb_image": {
          "label": "XCB Image >= 0.3.9",
          "headers": "xcb/xcb_image.h",
          "sources": [
              { "type": "pkgConfig", "args": "xcb-image >= 0.3.9" },
              "-lxcb-image"
          ],
          "use": "xcb_shm xcb_util xcb"
      },
      

       

      And for xcb_syslibs:

      "use": "xcb_icccm xcb_util xcb_image xcb_keysyms xcb_randr xcb_render xcb_renderutil xcb_shape xcb_shm xcb_sync xcb_xfixes xcb_xinerama xcb_xkb xcb"

      So that the qtbase compilation also links against xcb_util before xcb_image. My Qt5 hello world program compiles fine now.

       

      I have attached both my ./configure options and a git patch for the 5.15.0 branch as I'm not sure how to contribute to Qt development.

      Here are some of the xcb libraries I installed statically:

      CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./autogen.sh --disable-shared --enable-static && \
      make -j4
      make install

      Attachments

        Issue Links

          For Gerrit Dashboard: QTBUG-86287
          # Subject Branch Project Status CR V

          Activity

            People

              sfer Robert Boon
              sfer Robert Boon
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes