Qt library compilation error: xfixes.c: (.text + 0x4e): Undefined reference to 'xcb_send_request'

wrong description

g++ -Wl,--no-undefined -Wl,-O1 -Wl,--enable-new-dtags -Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -shared -o libqxcb-egl-integration.so .obj/qxcbeglintegration.o .obj/qxcbeglwindow.o .obj/qxcbeglmain.o .obj/qxcbeglnativeinterfacehandler.o  /home/jaron/software/qt-build/qtbase/lib/libQt5XcbQpa.so /home/jaron/software/qt-build/qtbase/lib/libQt5ServiceSupport.a /home/jaron/software/qt-build/qtbase/lib/libQt5ThemeSupport.a /home/jaron/software/qt-build/qtbase/lib/libQt5FontDatabaseSupport.a -lfontconfig -lfreetype -lz /home/jaron/software/qt-build/qtbase/lib/libQt5XkbCommonSupport.a /home/jaron/software/qt-build/qtbase/lib/libQt5EglSupport.a -lEGL /home/jaron/software/qt-build/qtbase/lib/libQt5Gui.so /home/jaron/software/qt-build/qtbase/lib/libQt5EdidSupport.a /home/jaron/software/qt-build/qtbase/lib/libQt5DBus.so /home/jaron/software/qt-build/qtbase/lib/libQt5Core.so -lGL -lpthread -lX11-xcb -lxcb -lXext -lX11 -lm -lSM -lICE /home/jaron/software/qt-build/qtbase/lib/libxcb-static.a -lxkbcommon -ldl -lEGL   
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_query_version’中:
xfixes.c:(.text+0x4e):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_query_version_unchecked’中:
xfixes.c:(.text+0xbb):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_change_save_set_checked’中:
xfixes.c:(.text+0x14d):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_change_save_set’中:
xfixes.c:(.text+0x1ca):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_select_selection_input_checked’中:
xfixes.c:(.text+0x242):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):xfixes.c:(.text+0x2af): 跟着更多未定义的参考到 xcb_send_request
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_query_version_reply’中:
xfixes.c:(.text+0xe1):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_get_cursor_image_reply’中:
xfixes.c:(.text+0x4f1):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_fetch_region_reply’中:
xfixes.c:(.text+0x1381):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_get_cursor_name_reply’中:
xfixes.c:(.text+0x1931):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(xfixes.o):在函数‘xcb_xfixes_get_cursor_image_and_name_reply’中:
xfixes.c:(.text+0x1ad1):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_initialize’中:
sync.c:(.text+0x22f):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_initialize_unchecked’中:
sync.c:(.text+0x29c):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_list_system_counters’中:
sync.c:(.text+0x356):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_list_system_counters_unchecked’中:
sync.c:(.text+0x3c3):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_create_counter_checked’中:
sync.c:(.text+0x47f):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):sync.c:(.text+0x4ec): 跟着更多未定义的参考到 xcb_send_request
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_create_alarm_sizeof’中:
sync.c:(.text+0x9f8):对‘xcb_popcount’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_create_alarm_checked’中:
sync.c:(.text+0xa58):对‘xcb_popcount’未定义的引用
sync.c:(.text+0xa8e):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_create_alarm’中:
sync.c:(.text+0xaf8):对‘xcb_popcount’未定义的引用
sync.c:(.text+0xb2b):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_change_alarm_sizeof’中:
sync.c:(.text+0xb58):对‘xcb_popcount’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_change_alarm_checked’中:
sync.c:(.text+0xbb8):对‘xcb_popcount’未定义的引用
sync.c:(.text+0xbee):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_change_alarm’中:
sync.c:(.text+0xc58):对‘xcb_popcount’未定义的引用
sync.c:(.text+0xc8b):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_destroy_alarm_checked’中:
sync.c:(.text+0xcfa):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_destroy_alarm’中:
sync.c:(.text+0xd67):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_query_alarm’中:
sync.c:(.text+0xdda):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_query_alarm_unchecked’中:
sync.c:(.text+0xe47):对‘xcb_send_request’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):sync.c:(.text+0xece): 跟着更多未定义的参考到 xcb_send_request
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_initialize_reply’中:
sync.c:(.text+0x2c1):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_list_system_counters_reply’中:
sync.c:(.text+0x421):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_query_counter_reply’中:
sync.c:(.text+0x6d1):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_query_alarm_reply’中:
sync.c:(.text+0xe71):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):在函数‘xcb_sync_get_priority_reply’中:
sync.c:(.text+0x1041):对‘xcb_wait_for_reply’未定义的引用
/home/jaron/software/qt-build/qtbase/lib/libxcb-static.a(sync.o):sync.c:(.text+0x14b1): 跟着更多未定义的参考到 xcb_wait_for_reply
collect2: error: ld returned 1 exit status
Makefile:131: recipe for target '../../../../../../plugins/xcbglintegrations/libqxcb-egl-integration.so' failed
make[7]: *** [../../../../../../plugins/xcbglintegrations/libqxcb-egl-integration.so] Error 1
make[7]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms/xcb/gl_integrations/xcb_egl'
Makefile:47: recipe for target 'sub-xcb_egl-make_first' failed
make[6]: *** [sub-xcb_egl-make_first] Error 2
make[6]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms/xcb/gl_integrations'
Makefile:150: recipe for target 'sub-gl_integrations-make_first-ordered' failed
make[5]: *** [sub-gl_integrations-make_first-ordered] Error 2
make[5]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms/xcb'
Makefile:102: recipe for target 'sub-xcb-make_first' failed
make[4]: *** [sub-xcb-make_first] Error 2
make[4]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins/platforms'
Makefile:104: recipe for target 'sub-platforms-make_first' failed
make[3]: *** [sub-platforms-make_first] Error 2
make[3]: Leaving directory '/home/jaron/software/qt-build/qtbase/src/plugins'
Makefile:723: recipe for target 'sub-plugins-make_first' failed
make[2]: *** [sub-plugins-make_first] Error 2
make[2]: Leaving directory '/home/jaron/software/qt-build/qtbase/src'
Makefile:50: recipe for target 'sub-src-make_first' failed
make[1]: *** [sub-src-make_first] Error 2
make[1]: Leaving directory '/home/jaron/software/qt-build/qtbase'
Makefile:87: recipe for target 'module-qtbase-make_first' failed
make: *** [module-qtbase-make_first] Error 2

wrong reason

        This is because the project qtbase/src/plugins/platform/xcb/xcb.prois referenced in the xcb-staticproject file :

TEMPLATE = subdirs
CONFIG += ordered
QT_FOR_CONFIG += gui-private

!qtConfig(system-xcb): SUBDIRS += xcb-static

SUBDIRS += xcb_qpa_lib.pro
SUBDIRS += xcb-plugin.pro
SUBDIRS += gl_integrations

        The qtbase/src/plugins/platform/xcb/xcb-static/xcb-static.procontent of the project file is:

#
# Statically compile in code for
# libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image,
# libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb,
# libxcb-xinerama, libxcb-xinput
#
CONFIG += static

XCB_DIR = $$QT_SOURCE_TREE/src/3rdparty/xcb

MODULE_INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
INCLUDEPATH += $$XCB_DIR/include/xcb

QMAKE_USE += xcb/nolink

# ignore compiler warnings in 3rdparty code
QMAKE_CFLAGS_STATIC_LIB+=-w

#
# libxcb
#
LIBXCB_DIR = $$XCB_DIR/libxcb

SOURCES += \
    $$LIBXCB_DIR/xfixes.c \
    $$LIBXCB_DIR/randr.c \
    $$LIBXCB_DIR/shm.c \
    $$LIBXCB_DIR/sync.c \
    $$LIBXCB_DIR/render.c \
    $$LIBXCB_DIR/shape.c \
    $$LIBXCB_DIR/xkb.c \
    $$LIBXCB_DIR/xinerama.c \
    $$LIBXCB_DIR/xinput.c

#
# xcb-util
#
XCB_UTIL_DIR = $$XCB_DIR/xcb-util


SOURCES += \
    $$XCB_UTIL_DIR/xcb_aux.c \
    $$XCB_UTIL_DIR/atoms.c \
    $$XCB_UTIL_DIR/event.c

#
# xcb-util-image
#
XCB_IMAGE_DIR = $$XCB_DIR/xcb-util-image

SOURCES += $$XCB_IMAGE_DIR/xcb_image.c

#
# xcb-util-keysyms
#
XCB_KEYSYMS_DIR = $$XCB_DIR/xcb-util-keysyms

SOURCES += $$XCB_KEYSYMS_DIR/keysyms.c

#
# xcb-util-renderutil
#

XCB_RENDERUTIL_DIR = $$XCB_DIR/xcb-util-renderutil

SOURCES += $$XCB_RENDERUTIL_DIR/util.c

#
# xcb-util-wm
#
XCB_WM_DIR = $$XCB_DIR/xcb-util-wm

SOURCES += \
    $$XCB_WM_DIR/icccm.c

OTHER_FILES = $$XCB_DIR/README

TR_EXCLUDE += $$XCB_DIR/*

load(qt_helper_lib)

        The corresponding source code in is in the directory qtbase/src/3rdparty/xcb, and all the files in the directory are searched, and no functions xcb_send_requestand xcb_wait_for_replydefinitions are found, so an libxcb-static.aerror will occur when compiling the static library .

Solution

        You can qtbase/src/plugins/platform/xcb/xcb.proremove xcb-staticthe reference to the project in the project file , you need to configureadd configuration options when -system-xcb.

Published 32 original articles · won praise 1 · views 4551

Guess you like

Origin blog.csdn.net/hezhanran/article/details/105087029