Forum OpenACS Development: ns_xml.so problem - Please Help!

Collapse
Posted by Jose Mendez on
I downloaded nsxml form the arsdigita site and got it to compile, but haven't been able to get aolserver to load the module. I get the following error message:

[22/Aug/2001:23:47:47][24838.1024][-main-] Notice: modload: loading '/home/nsadmin/bin/ns_xml.so'
[22/Aug/2001:23:47:47][24838.1024][-main-] Warning: modload: failed to load '/home/nsadmin/bin/ns_xml.so': '/home/nsadmin/bin/ns_xml.so: undefined symbol: gzdopen'
[22/Aug/2001:23:47:47][24838.1024][-main-] Fatal: modload: failed to load module '/home/nsadmin/bin/ns_xml.so'

Does anyone know what the problem is?
Collapse
Posted by Jose Mendez on
By the way, I am running aolserver 3.4 and compiled xml module 1.0
Collapse
Posted by Yon Derek on
1. This version is broken. Get a newer one from here: http://acs-misc.sourceforge.net/nsxml.html.

2. For a solution to your problem see http://www.arsdigita.com/bboard/q-and-a-fetch-msg?msg_id=0009Vr&topic_id=web%2fdb and http://www.arsdigita.com/bboard/q-and-a-fetch-msg?msg_id=000ZF3

Collapse
Posted by Jose Mendez on
I downloaded the latest version from xmlsoft.org but I cannot get it to compile. I get the following error:

[root@we-24-24-150-135 nsxml]# make
gcc -I/home/nsadmin/include -D_REENTRANT=1 -DNDEBUG=1 -g -fPIC -Wall -Wno-unused -mcpu=i686 -DHAVE_CMMSG=1 -DUSE_FIONREAD=1 -DHAVE_COND_EINTR=1 -c -o ns_xml.o ns_xml.c
ns_xml.c: In function `xml_parse_warning':
ns_xml.c:753: structure has no member named `_private'
ns_xml.c: In function `xml_parse_error':
ns_xml.c:795: structure has no member named `_private'
ns_xml.c: In function `xml_parse':
ns_xml.c:915: structure has no member named `_private'
ns_xml.c: In function `xml_node_command':
ns_xml.c:1135: structure has no member named `children'
ns_xml.c: In function `Ns_ModuleInit':
ns_xml.c:1512: warning: implicit declaration of function `xmlMemSetup'
ns_xml.c:1512: `xmlFreeFunc' undeclared (first use in this function)
ns_xml.c:1512: (Each undeclared identifier is reported only once
ns_xml.c:1512: for each function it appears in.)
ns_xml.c:1512: parse error before `ns_free'
ns_xml.c:1521: warning: implicit declaration of function `xmlInitParser'
make: *** [ns_xml.o] Error 1

any ideas?
Collapse
Posted by Dave Manginelli on
By coincedence, I am also having (trouble?) with ns_xml.  I tried to re-load OpenACS 4 using the latest CVS code today and got a message saying I needed to get a newer version.  I downloaded version 1.4 as pointed to in another thread.  It compiled fine for me after commenting out the XSLT support from the make file because I didn't have the required library on my machine.

Strangely, I am still getting the message (on the very first OpenACS welcome/config screen) that says my ns_xml is not up to snuff and that internal "workarounds" will be used.  I am positive that I have copied the newly compiled nsxml.so file to the correct directory.  Can someone let me know whether I've got a real problem or the version checking code is wrong?

(I am running AOLServer 3.2+Ad12 / Oracle)

Collapse
Posted by Yon Derek on
Re: Jose's problem. Most likely you have the latest 2.x version of libxml and the old (1.0) version of nsxml. Version 1.0 of nsxml (the one you can download from AD) only works with 1.8.x version of libxml. To use libxml 2.x you need the latest nsxml 1.4 (see the link above).
Collapse
Posted by Yon Derek on
Re: dave's problem. I would guess that you don't have a correct version of nsxml. Please re-check.

To test for old/new version you can use the script I've posted in this thread:

proc nsxml_broken_p { } {
  set doc '<?xml version="1.0"?><me>him</me>'
  set doc_id [ns_xml parse $doc]
  set root [ns_xml doc $doc_id]
  set name [ns_xml node name $root]
  if { [string_equal_p $name "me"] } {
    return 1
  }
  return 0
}
This procedure returns 1 if you have old, broken version and 0 if it's a good version.
Collapse
Posted by Jose Mendez on
I did download the latest version from the link you provided, but I haven't been able to compile it.  When I type 'make' it starts the compilation but exists on an error (see above). I should mention that I installed the libxml2 rpm's that I downloaded from the xmlsoft.org site.  Is there anything I could try?  By the way Yon, thanks you very much for trying to help me out, I really appreciate it.
Collapse
Posted by Yon Derek on
Most likely you have both versions of libxml (1.8.x and 2.x) installed and for some reason gcc gives precedence to 1.8.x includes which are not compatible with 2.x includes.

You can verify this by doing:

locate xmlmemory.h
On my system it returns the following (abridged for clarity):
[nsadmin@rusty nsxml]$ locate xmlmemory.h
/usr/include/gnome-xml/xmlmemory.h
/usr/include/libxml/xmlmemory.h
/usr/local/include/libxml/xmlmemory.h
This is not obvious, but /usr/include/libxml/xmlmemory.h is for 1.8.x version and /usr/local/include/libxml/xmlmemory.h is for 2.x. Your problem is that gcc tries to include from /usr/include and not /usr/local/include. From the top of my head I don't know how to force gcc to do otherwise (I'm sure it's somewhere in the gcc docs).

My first suggestion is to modify the Makefile and add the line:

CFLAGS = -I/usr/local/include
(note that on your system it can be somewhere else than /usr/local/include).

My second suggestion: get the tarball and compile from it. This is how I installed libxml on my RH 62 machine and it seems to be working.

If it fails - dive into gcc docs to find out how to force the proper include order.

Collapse
Posted by Jose Mendez on
Thank you Yon, you were right, I was using the wrong libraries.  To change them I went into the ns_xml.c file and modified the include statements to point to the right .h files.  It compiled, and the module loaded just fine :).  Once again, thank you.
Collapse
Posted by Dave Manginelli on
Thanks all for the advice.

Stupid error on my part.  The error page must have been cached in my browser from before I upgraded to the newest version!  I fired it up again with exactly the same setup and now everything is working.

Sorry to have taken up your time.

Collapse
Posted by Pat Colgan on
I'm also having trouble getting nsxml to compile. I'm following Vinod's Brief Installation manual for debian woody 2.2.19pre17.

When I try to make, I get this error:

nx_xml.c:40: libxml/parser.h: No such file or directory
nx_xml.c:41: libxml/xmlmemory.h: No such file or directory

This is my first debian install, so it could be something basic about how I've set up the system, or some package I've neglected to install. I did use apt-get to install libxml2 2.4.6-1 and libxml2-dev 2.4.6.-1. Libxml1 1.8.16-1 was installed by default somewhere along the line.

I'm using the version of nsxml that Vinod points to at http://acs-misc.sourceforge.net/dl/nsxml.tgz

If I try 'find . -name "xmlmemory.h" it's found here: ./usr/include/libxml2/libxml/xmlmemory.h
Same goes for parser.h I tried Yon's idea of adding CFLAGS, but it didn't seem to help.

Any thoughts?

Collapse
Posted by C. R. Oldham on

Here's a snippet from my machine changelogs. I needed libxml in slink, but it isn't a package, so I retrieved the sources from unstable and built them. At the end I discovered:

     I had to create a symbolic link by hand in /usr/include
	ln -s libxml2/libxml libxml
     (e.g. /usr/include/libxml points to /usr/include/libxml2/libxml)
     I think this directory structure is a bug in the package.
Collapse
Posted by Jose Mendez on
I was having the same problem, the way I got it fixed was by adding the full path to the librabries in the include statements in the ns_xml.c file.
Collapse
Posted by Vinod Kurup on
This does seem to be a bug in the way that debian has packaged libxml2-dev. The compiler is looking for header files in /usr/include/libxml, but they are instead in /usr/include/libxml2/libxml. So, you can link the directories (as mentioned above) or add the following to the Makefile
CFLAGS  = -I/usr/include/libxml2
Collapse
Posted by Andrew Turner on
The real cause of the problems here is that the Makefile isn't using xml2-config to find out where libxml was installed.  If it had, then all would be fine.

It should use "xml2-config --cflags" and "xml2-config --libs".