[xml] Static Link problem



I have a strange problem when I run a static linked application I'm
developing.

The dynamically linked version executes correctly. The statically linked
version fails the xmlStrcmp test in my code and I get the "Incorrect XML
document error ...". I'm running gcc=2.96, RH Linux=2.2.16-22, libxml=2.4.22

Any help is very much appreciated.

best
Roy



The offending code fragment is ...

//-----------------------------------------------------------
doc = xmlParseFile(configfile);
//writeXML();
if(!doc) {
        printf("No XML doc found in %s",configfile);
        return TRUE;
}
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
        printf("Empty doc found in %s",configfile);
        return(TRUE);
}
if (xmlStrcmp(cur->name, (const xmlChar *) "vsmsd")) {  // <<<< ---------
PROBLEM HERE ----------
        printf("Incorrect XML document found in %s",configfile);
        return(TRUE);
}
//------------------------------------------------------------




My Makefile looks like this :-
//-------------------------------------------------------------
all:    vsmsd
LIBS=-lresolv -lnsl -lm  -lxml -L/usr/lib
#CFLAGS=-D_REENTRANT=1 -I. -g -O2 -I/usr/include/gnome-xml
CFLAGS=-D_REENTRANT=1 -I. -g -O2 -Dxml2=TRUE -I/usr/local/libxml2/include/li
bxml2/libxml
LDFLAGS=

# xml2 static
LIBXML=/usr/local/libxml2/lib/libxml2.a /usr/lib/libz.a /usr/lib/libm.a

# xml2 dynamic
#LIBXML=/usr/local/libxml2/lib/libxml2.so

clean:
    rm *.o

vsmsd.o:    vsmsd.c vsmsd.h
    gcc $(CFLAGS) -c -ggdb vsmsd.c

vsmsd:  vsmsd.o md5.o
    gcc $(LIBS) -static -o vsmsd vsmsd.o md5.o $(LIBXML)
    #gcc $(LIBS) -o vsmsd vsmsd.o md5.o $(LIBXML)
//------------------------------------------------------------------------




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]