GCC库中未定义的引用

时间:2014-08-04 15:22:40

标签: c++ linux gcc static-linking qt5.3

我正在尝试在Linux上构建我公司主要应用程序的静态链接版本。该应用程序使用Qt 5.3,如果我使用Qt的调试/动态链接构建,一切编译都很好。但是,在进行静态构建时,.a中的/usr/lib/x86_64-linux-gnu库会出现许多奇怪的错误。

我在Qt下载的5.3/Src/qtbase/文件夹中使用以下命令为静态版本配置了Qt 5.3.1:

./configure -release -static -opensource -nomake tools -nomake examples --force-asserts -no-sql-sqlite -no-libjpeg -no-opengl -no-gif -qt-xcb -qpa xcb
make clean
make sub-src

然后我在Emu项目目录中使用以下命令使用QMake和make构建应用程序:

/path/to/qt-static/qmake -r -spec linux-g++ emu.pro
make clean
make

最后一个make命令在最后的链接步骤中产生以下错误:

/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `XInput_find_display':
(.text+0xf9): undefined reference to `XextFindDisplay'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `XInput_find_display':
(.text+0x111): undefined reference to `XextCreateExtension'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `XInput_find_display':
(.text+0x1eb): undefined reference to `XextAddDisplay'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `XInputClose':
(.text+0x154a): undefined reference to `XextRemoveDisplay'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `XInputClose':
(.text+0x1575): undefined reference to `XextDestroyExtension'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libXi.a(XExtInt.o): In function `_XiCheckExtInit':
(.text+0x16f1): undefined reference to `XMissingExtension'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxcb.a(xcb_auth.o): In function `get_authptr':
(.text+0xd4): undefined reference to `XauGetBestAuthByAddr'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxcb.a(xcb_auth.o): In function `_xcb_get_auth_info':
(.text+0x321): undefined reference to `XauDisposeAuth'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxcb.a(xcb_auth.o): In function `_xcb_get_auth_info':
(.text+0x55e): undefined reference to `XdmcpWrap'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libxcb.a(xcb_auth.o): In function `_xcb_get_auth_info':
(.text+0x56e): undefined reference to `XauDisposeAuth'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `FcConfigMessage':
(.text+0x290): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `FcConfigMessage':
(.text+0x301): undefined reference to `XML_GetCurrentLineNumber'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x12d1): undefined reference to `XML_ParserCreate'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1333): undefined reference to `XML_SetUserData'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1345): undefined reference to `XML_SetDoctypeDeclHandler'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1357): undefined reference to `XML_SetElementHandler'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1364): undefined reference to `XML_SetCharacterDataHandler'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1397): undefined reference to `XML_ParseBuffer'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x13b4): undefined reference to `XML_GetBuffer'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x13f6): undefined reference to `XML_ParserFree'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/lib .
01`
.0j mnfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1639): undefined reference to `XML_GetErrorCode'
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libfontconfig.a(fcxml.o): In function `IA__FcConfigParseAndLoad':
(.text+0x1640): undefined reference to `XML_ErrorString'
collect2: error: ld returned 1 exit status

但我找到了所有可以找到的X Window System库......

我不知道为什么我在标准库中遇到错误。那么为什么会发生这种情况,我该如何解决?

0 个答案:

没有答案