我们正在构建一个需要在静态模式下链接log4c的项目,以下是正在生成的链接器错误的一部分。
/usr/local/lib/liblog4c.a(domnode-expat.o): In function `sd_domnode_read':
/log4c-1.2.1/src/sd/domnode-expat.c:316: undefined reference to `XML_ParserCreate'
/log4c-1.2.1/src/sd/domnode-expat.c:324: undefined reference to `XML_SetCommentHandler'
/log4c-1.2.1/src/sd/domnode-expat.c:325: undefined reference to `XML_SetUserData'
/log4c-1.2.1/src/sd/domnode-expat.c:327: undefined reference to `XML_Parse'
/log4c-1.2.1/src/sd/domnode-expat.c:355: undefined reference to `XML_ParserFree'
/log4c-1.2.1/src/sd/domnode-expat.c:328: undefined reference to `XML_GetErrorCode'
/log4c-1.2.1/src/sd/domnode-expat.c:328: undefined reference to `XML_ErrorString'
/usr/local/lib/liblog4c.a(domnode-expat.o): In function `sd_domnode_fread':
/log4c-1.2.1/src/sd/domnode-expat.c:242: undefined reference to `XML_ParserCreate'
/log4c-1.2.1/src/sd/domnode-expat.c:250: undefined reference to `XML_SetCommentHandler'
/log4c-1.2.1/src/sd/domnode-expat.c:251: undefined reference to `XML_SetUserData'
/log4c-1.2.1/src/sd/domnode-expat.c:258: undefined reference to `XML_GetBuffer'
/log4c-1.2.1/src/sd/domnode-expat.c:268: undefined reference to `XML_ParseBuffer'
/log4c-1.2.1/src/sd/domnode-expat.c:301: undefined reference to `XML_ParserFree'
/log4c-1.2.1/src/sd/domnode-expat.c:269: undefined reference to `XML_GetErrorCode'
/log4c-1.2.1/src/sd/domnode-expat.c:269: undefined reference to `XML_ErrorString'
collect2: ld returned 1 exit status
关闭它似乎缺少libexpat.a,但libexpat.a在构建机器上,Eclipse配置为找到它。我们使用--disable-shared parm将libexpat.a构建为./configure,但没有成功。
有什么想法吗?
答案 0 :(得分:1)
静态链接问题的解决方案是将库的链接顺序设置为其他库
这应该允许log4c以静态模式链接。