1752743 Members
4790 Online
108789 Solutions
New Discussion

and linking problem

 
SOLVED
Go to solution
AlexanderM
Advisor

and linking problem

Hi to everyone. Again.

  • I've build the libxml library
  • I've got a trouble with linking
  • Directory structure
    Spoiler
    +libxml2-2_9
    |  libxml.olb
    |  main.c
    |  +libxml
        |  header1.h
        |  header2.h
        |  ....
        |  headern.h 

     

     

  • The sourse of example:

    main.c (Was honestly stealed from libxml site)

     

    Spoiler
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    #include <libxml/xmlmemory.h>
    #include <libxml/parser.h>
    
    void
    parseStory (xmlDocPtr doc, xmlNodePtr cur) {
    
    	xmlChar *key;
    	cur = cur->xmlChildrenNode;
    	while (cur != NULL) {
    	    if ((!xmlStrcmp(cur->name, (const xmlChar *)"keyword"))) {
    		    key = xmlNodeListGetString(doc, cur->xmlChildrenNode, 1);
    		    printf("keyword: %s\n", key);
    		    xmlFree(key);
     	    }
    	cur = cur->next;
    	}
        return;
    }
    
    static void
    parseDoc(char *docname) {
    
    	xmlDocPtr doc;
    	xmlNodePtr cur;
    
    	doc = xmlParseFile(docname);
    	
    	if (doc == NULL ) {
    		fprintf(stderr,"Document not parsed successfully. \n");
    		return;
    	}
    	
    	cur = xmlDocGetRootElement(doc);
    	
    	if (cur == NULL) {
    		fprintf(stderr,"empty document\n");
    		xmlFreeDoc(doc);
    		return;
    	}
    	
    	if (xmlStrcmp(cur->name, (const xmlChar *) "story")) {
    		fprintf(stderr,"document of the wrong type, root node != story");
    		xmlFreeDoc(doc);
    		return;
    	}
    	
    	cur = cur->xmlChildrenNode;
    	while (cur != NULL) {
    		if ((!xmlStrcmp(cur->name, (const xmlChar *)"storyinfo"))){
    			parseStory (doc, cur);
    		}
    		 
    	cur = cur->next;
    	}
    	
    	xmlFreeDoc(doc);
    	return;
    }
    
    int
    main(int argc, char **argv) {
    
    	char *docname;
    		
    	if (argc <= 1) {
    		printf("Usage: %s docname\n", argv[0]);
    		return(0);
    	}
    
    	docname = argv[1];
    	parseDoc (docname);
    
    	return (1);
    }

     

     

  • Error:
    Spoiler
    XW01> LINK main.obj, libxml.olb/library
    %LINK-I-OPENIN, error opening IBS_REL_SYS:[MT.SCR]MTFMSSCREEN.OLB; as input
    -RMS-E-PRV, insufficient privilege or file protection violation
    %LINK-I-OPENIN, error opening IBS_REL_SYS:[MT.MESSAGE]MTMESSAGE.OLB; as input
    -RMS-E-PRV, insufficient privilege or file protection violation
    %LINK-I-OPENIN, error opening IBS_REL_SYS:[MT.MESSAGE]VMSSYMBOL.OLB; as input
    -RMS-E-PRV, insufficient privilege or file protection violation
    %LINK-W-NUDFSYMS, 6 undefined symbols:
    %LINK-I-UDFSYM,         XMLDOCGETROOTELEMENT
    %LINK-I-UDFSYM,         XMLFREE
    %LINK-I-UDFSYM,         XMLFREEDOC
    %LINK-I-UDFSYM,         XMLNODELISTGETSTRING
    %LINK-I-UDFSYM,         XMLPARSEFILE
    %LINK-I-UDFSYM,         XMLSTRCMP
    %LINK-W-USEUNDEF, undefined symbol XMLFREE referenced
            in psect $LINK$ offset %X00000020
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1
    %LINK-W-USEUNDEF, undefined symbol XMLSTRCMP referenced
            in psect $LINK$ offset %X00000030
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1
    %LINK-W-USEUNDEF, undefined symbol XMLNODELISTGETSTRING referenced
            in psect $LINK$ offset %X00000070
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1
    %LINK-W-USEUNDEF, undefined symbol XMLFREEDOC referenced
            in psect $LINK$ offset %X000000B0
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1
    %LINK-W-USEUNDEF, undefined symbol XMLPARSEFILE referenced
            in psect $LINK$ offset %X000000E0
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1
    %LINK-W-USEUNDEF, undefined symbol XMLDOCGETROOTELEMENT referenced
            in psect $LINK$ offset %X000000F0
            in module MAIN file TST$USERS:[ALEXANDER.LIBXML2-2_9]MAIN.OBJ;1

     

  • libxml.olb structure: (in attached file due to size)
  • I've found all of undefined symbols in the library description (attached file flist.txt). But it seems, that the linker has another opinion.)  Is the issue in the linker's keys?
6 REPLIES 6
Steven Schweda
Honored Contributor
Solution

Re: and linking problem

 
H.Becker
Honored Contributor

Re: and linking problem

>>> With all your fancy HTML, I didn't see the command which you used to compile "main.c", but I'll guess that you didn't specify /NAMES=AS_IS. Apparently, the library modules _were_ compiled that way.
 
There is more, as one can guess from names like xmlDoValidityCheckingDe1bcsei4$: the library modules were compiled with /NAMES=(AS_IS,SHORTENED)
 
Wasn't that already mentioned in the other thread?
 
Steven Schweda
Honored Contributor

Re: and linking problem

 
Dennis Handly
Acclaimed Contributor

Re: libxml linking problem

>Wasn't that already mentioned in the other thread?

 

It would have been helpful to mention the other topic or keep the topics together, as Steven said.

http://h30499.www3.hp.com/t5/Languages-and-Scripting/libxml-building/m-p/6230631

AlexanderM
Advisor

Re: libxml linking problem

Steven Schweda
>>>With all your fancy HTML, I didn't see the command which you used to compile "main.c", but I'll guess that you didn't specify /NAMES=AS_IS. Apparently, the library modules _were_ compiled that way.

You are right. The main.c compillation and linking commands I've used are below:
>cc/include="./" main.c
>link main, libxml.olb/library

Steven Schweda
>>>General suggestion: You might try putting more effort into the
content of your questions, and less into the format.  Showing _all_ the
actual commands you used would be a good start.

Thanks. I am new on a forums and I'll try to learn to express the issues in a proper way.

 
H.Becker
>>>There is more, as one can guess from names like xmlDoValidityCheckingDe1bcsei4$: the library modules were compiled with /NAMES=(AS_IS,SHORTENED)

I've used the file from the previous 'building libxml' thread and there indeed was a line
cc_opts = "/nowarn/DEF=HAVE_CONFIG_H/NAMES=(as_is,SHORTENED)/FLOAT=IEEE/IEEE_MODE=DENORM_RESULTS/INCLUDE=xml_srcdir"

The full version of file is attached.

Dennis Handly
>>>It would have been helpful to mention the other topic or keep the topics together, as Steven said.
http://h30499.www3.hp.com/t5/Languages-and-Scripting/libxml-building/m-p/6230631

It seems that now there is not any opportunity to merge threads. That was not the great idea to create the new one, but I've made it due to the 'building libxml' thread was marked as 'resolved'.

 

AlexanderM
Advisor

Re: libxml linking problem

Thanks to everyone. I've linked the library and run a simple test.

Building and Linking commands:

>cc/include="./"/NAMES=(AS_IS,SHORTENED) main.c

>link main, libxml.olb/library