views:

71

answers:

1

Hello All,

We are building a project that requires log4c to be linked in the static mode, the following is part of the linker error that is being generated.

/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

Off hand it seems to be missing libexpat.a, but libexpat.a is on the build machine and Eclipse is configured to find it. We have built libexpat.a with the --disable-shared parm to ./configure with no success.

Any ideas?

A: 

The solution to the static link issue is to set the linking order of the libraries to:

// other libs

log4c

expat

pthread

This should allow log4c to link in the static mode.

Fred