Operating System - HP-UX
1756431 Members
3039 Online
108847 Solutions
New Discussion юеВ

Re: XML sheet Parsing in Perl

 
SOLVED
Go to solution
Syed Madar J S
Frequent Advisor

XML sheet Parsing in Perl

I have a file "default.cst" and an external entity "mgr.dtd".

The XML::Parser built by me is able to parse "default.cst" onlt in 'standalone' mode, but if a refernce is made to external entity, then i get an error, as below.

Log:
-----
error in processing external entity reference at line 2, column 59, byte 82:




I see that somehow the XML::Parser built by me is unable to parse if there is a refernce to external entity.

But, drilling down further -- I found that XML::Parser requires "libexpat." - a library used in parsing.

The "libexpat" library has to be built from the "expat-2.0.1" source, which i downloaded and built, but there are some flags to be set for the Parsing of External Entity to take place smoothly.

I need to know how to build "libexpat" from "expat-2.0.1" so as to parse XML documents with reference to external entities!
9 REPLIES 9
James R. Ferguson
Acclaimed Contributor

Re: XML sheet Parsing in Perl

Hi:

This would seem to be a continuation of your earlier posts:

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1339255

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1326545

> I need to know how to build "libexpat" from "expat-2.0.1"

I would think the best starting point is here:

http://expat.sourceforge.net/

,,,and you might raise this question here:

http://www.perlmonks.org/

Regards!

...JRF...
Shinji Teragaito_1
Respected Contributor

Re: XML sheet Parsing in Perl

Hello again,

Here's the steps to generate 32-bit or 64-bit libexpat 2.0.1 on 11.31:

(32-bit)
% env CC=cc CFLAGS="+O2" CXX=aCC CXXFLAGS="+O2" \
./configure --libdir=/usr/local/lib/hpux32
(64-bit)
% env CC=cc CFLAGS="+O2 +DD64" CXX=aCC CXXFLAGS="+O2 +DD64" \
./configure --libdir=/usr/local/lib/hpux64

% make
% make check
(you should confirm none of failure happens)
% su
# make install

% cd ~/.cpan/build/XML-Parse-2.36
% /opt/perl_32/bin/perl Makefile.PL \
EXPATLIBPATH=/usr/local/lib/hpux32 EXPATINCPATH=/usr/local/include
% make
% make test
(you should confirm none of failure happens)

% ldd blib/arch/auto/XML/Parser/Expat/Expat.so
libexpat.so.6 => /usr/local/lib/hpux32/libexpat.so.6
libc.so.1 => /usr/lib/hpux32/libc.so.1
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
%

If you want to make Expat.so link with libexpat.a, you have to
change Expat/Makefile as follows:

% diff Expat/Makefile Expat/Makefile.org
< LDLOADLIBS = -L/usr/local/lib/hpux32 -lexpat
--
> LDLOADLIBS = -aarchive_shared -L/usr/local/lib/hpux32 -lexpat
%

I'll leave 64-bit Expat.so generation as an exercise :-)

Hope this helps you !!
Syed Madar J S
Frequent Advisor

Re: XML sheet Parsing in Perl

Thanks James and Shinji,

I had been using a similar process in the building of expat-2.0.1 and also the XML-Parser module.

and though the "make check" on expat-2.0.1 "make test" on the XML-Parser goes without any warnings and error.

But i noticed that during the "make" of XML-Parser we are getting some unsatisfied symbols,

log:
----
/usr/lib/hpux32/libcres.a[memmove.o]:
section .text PROGBITS AX 8768 32 added to text segment
section .IA_64.unwind UNWIND A 12 4 added to text segment
section .IA_64.unwind_info PROGBITS A 36 4 added to text segment
Searching library /usr/lib/hpux32/milli.a:
ld: (Warning) Unsatisfied symbol "Perl_sv_catpvn_flags" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_pop_scope" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newSVpv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newSViv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newSVsv" in file Expat.o
ld: (Warning) Unsatisfied symbol "malloc" in file /usr/local/lib/hpux32/libexpatw.a[xmlparse.o]
ld: (Warning) Unsatisfied symbol "realloc" in file /usr/local/lib/hpux32/libexpatw.a[xmlparse.o]
ld: (Warning) Unsatisfied symbol "_memcpy" in file Expat.o
ld: (Warning) Unsatisfied symbol "_memcmp" in file /usr/local/lib/hpux32/libexpatw.a[xmlparse.o]
ld: (Warning) Unsatisfied symbol "Perl_sv_newmortal" in file Expat.o
ld: (Warning) Unsatisfied symbol "memmove" in file /usr/lib/hpux32/libcres.a[memmove.o]
ld: (Warning) Unsatisfied symbol "_memset" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_2mortal" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_save_int" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_call_method" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_safesysmalloc" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tmarkstack_max_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tstack_sp_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Isv_undef_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tstack_max_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_catpv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_setpv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_setiv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_TSv_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_free_tmps" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_av_clear" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_gv_stashpv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_setref_pv" in file Expat.o
ld: (Warning) Unsatisfied symbol "PL_memory_wrap" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Isv_no_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "strncmp" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_free" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Ttmps_floor_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_catsv_flags" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newSV" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newXS" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newRV" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newHV" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newAV" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_form" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_2bool" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Ierrgv_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_setsv_flags" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_safesysfree" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Ttmps_ix_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newSVpvn" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_hv_fetch" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_bless" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_markstack_grow" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_get_hv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_get_sv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tmarkstack_ptr_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "__assert" in file /usr/local/lib/hpux32/libexpatw.a[xmlparse.o]
ld: (Warning) Unsatisfied symbol "__memmove_ver" in file /usr/lib/hpux32/libcres.a[memmove.o]
ld: (Warning) Unsatisfied symbol "Perl_croak_nocontext" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_av_len" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_av_pop" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Isv_yes_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_catpvf_nocontext" in file Expat.o
ld: (Warning) Unsatisfied symbol "free" in file /usr/local/lib/hpux32/libexpatw.a[xmlparse.o]
ld: (Warning) Unsatisfied symbol "Perl_sv_setpvn" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_2uv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_2iv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Top_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_av_push" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_newRV_noinc" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_stack_grow" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_derived_from" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tstack_base_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_TXpv_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Gthr_key_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "strchr" in file Expat.o
ld: (Warning) Unsatisfied symbol "strlen" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_call_pv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_call_sv" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_hv_store" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_mg_set" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tcurpad_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "pthread_getspecific" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_safesysrealloc" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_push_scope" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_sv_2pv_flags" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_Tna_ptr" in file Expat.o
ld: (Warning) Unsatisfied symbol "Perl_croak" in file Expat.o
84 warnings.
chmod 755 ../blib/arch/auto/XML/Parser/Expat/Expat.so
cp Expat.bs ../blib/arch/auto/XML/Parser/Expat/Expat.bs
chmod 644 ../blib/arch/auto/XML/Parser/Expat/Expat.bs
Manifying ../blib/man3/XML::Parser::Expat.3
gmake[1]: Leaving directory `/tmp/Perl-Module/XML-Parser-2.34/Expat'
Manifying blib/man3/XML::Parser::Style::Objects.3
Manifying blib/man3/XML::Parser::Style::Debug.3
Manifying blib/man3/XML::Parser.3
Manifying blib/man3/XML::Parser::Style::Subs.3
Manifying blib/man3/XML::Parser::Style::Tree.3
Manifying blib/man3/XML::Parser::Style::Stream.3
clone# /tmp/gmake test
gmake[1]: Entering directory `/tmp/Perl-Module/XML-Parser-2.34/Expat'
gmake[1]: Leaving directory `/tmp/Perl-Module/XML-Parser-2.34/Expat'
PERL_DL_NONLAZY=1 /opt/perl_32/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/astress.........
t/astress.........1/27

t/astress.........ok
t/cdata...........
t/cdata...........1/2

t/cdata...........ok
t/decl............
t/decl............1/30

t/decl............ok
t/defaulted.......
t/defaulted.......1/4

t/defaulted.......ok
t/encoding........"my" variable $p masks earlier declaration in same scope at t/encoding.t line 94.

t/encoding........1/6

t/encoding........ok
t/external_ent....
t/external_ent....1/5

t/external_ent....ok
t/file............
t/file............1/2

t/file............ok
t/finish..........
t/finish..........1/3

t/finish..........ok
t/namespaces......
t/namespaces......1/16

t/namespaces......ok
t/parament........
t/parament........1/12

t/parament........ok
t/partial.........
t/partial.........1/3

t/partial.........ok
t/skip............
t/skip............1/4

t/skip............ok
t/stream..........
t/stream..........1/3

t/stream..........ok
t/styles..........
t/styles..........1/13

t/styles..........ok
All tests successful.
Files=14, Tests=130, 4 wallclock secs ( 0.25 usr 0.14 sys + 3.29 cusr 0.60 csys = 4.28 CPU)
Result: PASS


Not sure if this is the reason for the External entity parsing by the module causes to fail.

Thanks for the suggestion,with the build and install of expat-2.0.1 going fine - i am planing to look into these symbols
Dennis Handly
Acclaimed Contributor
Solution

Re: XML sheet Parsing in Perl

>we are getting some unsatisfied symbols

You can ignore them since they are warnings, unless they occur at runtime.
To look for real unsats you can use my show_remaining_imports_elf.sh tool attached in this thread:
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1261297
Syed Madar J S
Frequent Advisor

Re: XML sheet Parsing in Perl

Thanks Dennis,

The tool is of great help.
Jeff Gaber
New Member

Re: XML sheet Parsing in Perl

Hey guys,

I am trying to build a 64 bit version of expat-2.0.1. I have downloaded the 32 bit binary version from the HP download site. I tested it for functionality and it does what I need. I now need to build a 64 bit version to work with our 64 bit application.

I downloaded source for expat from both sourceforge and HP. The configure bombs out for both of these with a cpp sanity error. The sourceforge version bombs at can't find machine/vmtypes.h. The HP version bombs at ac_nonexistent.h not found and /lib/cpp not found.

What packages do I need to install and what configure options do I need. I do not have root access so I will need to install packages relative to my home dir.

Thanks.
Dennis Handly
Acclaimed Contributor

Re: XML sheet Parsing in Perl

>Jeff: The HP version bombs at ac_nonexistent.h not found and /lib/cpp not found.

Look at the code around ac_nonexistent.h and see if there is a #if and -D that needs to be set.

/lib/ should be a symlink to /usr/lib and that should have a symlink to /usr/ccs/lbin/cpp or /opt/langtools/lbin/cpp. You probably should be using gcc to compile.

What OS version do you have?
Jeff Gaber
New Member

Re: XML sheet Parsing in Perl

HP-UX 11.31 ia64

In other forums I have found that I really need to be using the aCC compiler not the bundled cc compiler. I have installed a trial version an will see if I get any further.

Thanks.
Jeff Gaber
New Member

Re: XML sheet Parsing in Perl

OK, using the trial version of the aCC compiler it now builds and make runs. But when I ran make check I got an ABI mismatch. I had to make clean and add +O2 +DD64 to the CPPFLAGS directive.

It now builds and checks fine.