qt之库编译错误:xfixes.c:(.text+0x4e):对‘xcb_send_request’未定义的引用

错误描述

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

错误原因

        这是由于工程文件qtbase/src/plugins/platform/xcb/xcb.pro里引用了xcb-static工程:

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

        工程文件qtbase/src/plugins/platform/xcb/xcb-static/xcb-static.pro内容为:

#
# 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)

        里对应的源代码在目录qtbase/src/3rdparty/xcb里面,而搜索了该目录下的所有文件,都未发现有函数xcb_send_requestxcb_wait_for_reply定义的地方,所以在编译静态库libxcb-static.a时会出错。

解决方法

        可以在工程文件qtbase/src/plugins/platform/xcb/xcb.pro里去除对xcb-static工程的引用,则需要在configure的时候加上配置选项-system-xcb

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值