Open demanuel opened 4 months ago
@demanuel thanks for the bug report.
Please try again with the latest LibXML v0.10.7 release.
It builds but the tests fail and there are still a lot of warnings:
> zef install LibXML
===> Searching for: LibXML
===> Searching for missing dependencies: Method::Also, W3C::DOM:ver<0.0.2+>, XML, App::Prove6
===> Searching for missing dependencies: Getopt::Long:ver<0.3.0+>, Path::Finder:ver<0.4.4+>, Pod::Usage, TAP:ver<0.3.4+>, sigpipe
===> Building: LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_get_keep_blanks’:
[LibXML] src/xml6_gbl.c:70:5: warning: ‘__xmlKeepBlanksDefaultValue’ is deprecated [-Wdeprecated-declarations]
[LibXML] 70 | return xmlKeepBlanksDefaultValue;
[LibXML] | ^~~~~~
[LibXML] In file included from /usr/include/libxml2/libxml/globals.h:11,
[LibXML] from src/xml6_gbl.h:4,
[LibXML] from src/xml6_gbl.c:2:
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/parser.h:885:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 885 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:857:3: note: in expansion of macro ‘XML_OP’
[LibXML] 857 | XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:881:3: note: in expansion of macro ‘XML_GLOBALS_PARSER_CORE’
[LibXML] 881 | XML_GLOBALS_PARSER_CORE \
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:886:1: note: in expansion of macro ‘XML_GLOBALS_PARSER’
[LibXML] 886 | XML_GLOBALS_PARSER
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_set_keep_blanks’:
[LibXML] src/xml6_gbl.c:74:5: warning: ‘__xmlKeepBlanksDefaultValue’ is deprecated [-Wdeprecated-declarations]
[LibXML] 74 | xmlKeepBlanksDefaultValue = flag;
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/parser.h:885:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 885 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:857:3: note: in expansion of macro ‘XML_OP’
[LibXML] 857 | XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:881:3: note: in expansion of macro ‘XML_GLOBALS_PARSER_CORE’
[LibXML] 881 | XML_GLOBALS_PARSER_CORE \
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:886:1: note: in expansion of macro ‘XML_GLOBALS_PARSER’
[LibXML] 886 | XML_GLOBALS_PARSER
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_get_last_error’:
[LibXML] src/xml6_gbl.c:82:5: warning: ‘__xmlLastError’ is deprecated [-Wdeprecated-declarations]
[LibXML] 82 | return &xmlLastError;
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:869:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 869 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:863:3: note: in expansion of macro ‘XML_OP’
[LibXML] 863 | XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:870:1: note: in expansion of macro ‘XML_GLOBALS_ERROR’
[LibXML] 870 | XML_GLOBALS_ERROR
[LibXML] | ^~~~~~~~~~~~~~~~~
===> Building [OK] for LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
===> Staging Method::Also:ver<0.0.8>:auth<zef:lizmat>
===> Staging [OK] for Method::Also:ver<0.0.8>:auth<zef:lizmat>
===> Staging W3C::DOM:ver<0.0.3>:auth<zef:dwarring>
===> Staging [OK] for W3C::DOM:ver<0.0.3>:auth<zef:dwarring>
===> Staging XML:ver<0.3.3>:auth<zef:raku-community-modules>
===> Staging [OK] for XML:ver<0.3.3>:auth<zef:raku-community-modules>
===> Staging Getopt::Long:ver<0.4.2>
===> Staging [OK] for Getopt::Long:ver<0.4.2>
===> Staging Path::Finder:ver<0.4.7>:auth<zef:leont>
===> Staging [OK] for Path::Finder:ver<0.4.7>:auth<zef:leont>
===> Staging Pod::Usage:ver<0.0.1>:auth<zef:leont>
===> Staging [OK] for Pod::Usage:ver<0.0.1>:auth<zef:leont>
===> Staging TAP:ver<0.3.14>
===> Staging [OK] for TAP:ver<0.3.14>
===> Staging sigpipe:ver<0.0.3>:auth<zef:leont>
===> Staging [OK] for sigpipe:ver<0.0.3>:auth<zef:leont>
===> Staging App::Prove6:ver<0.0.17>:auth<cpan:LEONT>
===> Staging [OK] for App::Prove6:ver<0.0.17>:auth<cpan:LEONT>
===> Staging LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
===> Staging [OK] for LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
===> Testing: Method::Also:ver<0.0.8>:auth<zef:lizmat>
===> Testing [OK] for Method::Also:ver<0.0.8>:auth<zef:lizmat>
===> Testing: W3C::DOM:ver<0.0.3>:auth<zef:dwarring>
===> Testing [OK] for W3C::DOM:ver<0.0.3>:auth<zef:dwarring>
===> Testing: XML:ver<0.3.3>:auth<zef:raku-community-modules>
===> Testing [OK] for XML:ver<0.3.3>:auth<zef:raku-community-modules>
===> Testing: Getopt::Long:ver<0.4.2>
===> Testing [OK] for Getopt::Long:ver<0.4.2>
===> Testing: Path::Finder:ver<0.4.7>:auth<zef:leont>
===> Testing [OK] for Path::Finder:ver<0.4.7>:auth<zef:leont>
===> Testing: Pod::Usage:ver<0.0.1>:auth<zef:leont>
===> Testing [OK] for Pod::Usage:ver<0.0.1>:auth<zef:leont>
===> Testing: TAP:ver<0.3.14>
===> Testing [OK] for TAP:ver<0.3.14>
===> Testing: sigpipe:ver<0.0.3>:auth<zef:leont>
===> Testing [OK] for sigpipe:ver<0.0.3>:auth<zef:leont>
===> Testing: App::Prove6:ver<0.0.17>:auth<cpan:LEONT>
===> Testing [OK] for App::Prove6:ver<0.0.17>:auth<cpan:LEONT>
===> Testing: LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
[LibXML] # Running libxml2 version: 2.12.06 (module 0.10.7, Raku 2024.04.85.g.46.a.8.f.3247)
[LibXML] # libxml2 configuration: threads=yes reader=yes schemas=yes compression=yes iconv=yes
[LibXML] samples/ns.xml:3: namespace warning : Namespace prefix mam was not found
[LibXML] <mam:legs xml:lang="en" yyy="zzz" a:xxx="foo" xmlns:a="urn:a">4</mam:legs>
[LibXML] ^
[LibXML] in block at t/14sax.t line 161
===> Testing [FAIL]: LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
Aborting due to test failure: LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0> (use --force-test to override)
Thanks @demanuel, I'm getting the same compilation and test warnings with libxml2 2.12.06 from source. There's more to be tidied up.
I'm finding the tests are now noisy, but passing against Raku 2024.04, and LIbXML has started segfaulting on the Rakudo blead on a number of tests. One example is shown below. Does this match what you're seeing?
david@pc:~/git/LibXML-raku$ rakudo-gdb-m -I. t/00dtd.t
================================================================================================
This is Rakudo running in the debugger, which often allows the user to generate useful back-
traces to debug or report issues in Rakudo, the MoarVM backend or the currently running code.
This Rakudo version is 2024.04.86.ge.227.a.4.f.29 built on MoarVM version 2024.04.4.gc.1.eedd.502,
running on debian (12.bookworm) / linux
Type `bt full` to generate a backtrace if applicable, type `q` to quit or `help` for help.
------------------------------------------------------------------------------------------------
Reading symbols from /home/david/git/rakudo/install/bin/rakudo-m...
Starting program: /home/david/git/rakudo/install/bin/rakudo-m -I. t/00dtd.t
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff72836c0 (LWP 27292)]
1..10
ok 1 -
ok 2 -
ok 3 -
ok 4 -
ok 5 -
ok 6 -
# Subtest: doc with internal dtd
1..14
ok 1 - no external DtD
# Subtest: Internal Dtd hidden from associative interface
1..3
ok 1 - doc keys
ok 2 - doc root elems
ok 3 - doc root dereference
ok 2 - Internal Dtd hidden from associative interface
ok 3 - has internal DtD
ok 4 - validate
ok 5 -
ok 6 - .name
ok 7 - sans systemId
ok 8 - sans publicId
ok 9 - is-XHTML
ok 10 - keys
ok 11 -
ok 12 -
Thread 1 "rakudo-m" received signal SIGSEGV, Segmentation fault.
mi_free (p=0x555555575630) at 3rdparty/mimalloc/src/alloc.c:538
538 const bool is_local= (_mi_thread_id() == mi_atomic_load_relaxed(&segment->thread_id));
(gdb) bt
#0 mi_free (p=0x555555575630) at 3rdparty/mimalloc/src/alloc.c:538
#1 0x00007ffff789bb51 in MVM_free (p=<optimized out>) at src/core/alloc.h:60
#2 gc_cleanup (data=0x2f73b0f09c0, st=<optimized out>, tc=<optimized out>)
at src/6model/reprs/CArray.c:156
#3 gc_free (tc=<optimized out>, obj=0x2f73b0f09a8) at src/6model/reprs/CArray.c:166
#4 0x00007ffff78682d0 in MVM_gc_collect_free_nursery_uncopied (
executing_thread=executing_thread@entry=0x2f734020180, tc=tc@entry=0x2f734020180,
limit=0x2f73b46fff8) at src/gc/collect.c:599
#5 0x00007ffff78636c4 in finish_gc (is_coordinator=<optimized out>, gen=<optimized out>,
tc=<optimized out>) at src/gc/orchestrate.c:244
#6 run_gc (tc=tc@entry=0x2f734020180, what_to_do=what_to_do@entry=0 '\000')
at src/gc/orchestrate.c:447
#7 0x00007ffff7864671 in MVM_gc_enter_from_allocator (tc=tc@entry=0x2f734020180)
at src/gc/orchestrate.c:598
#8 0x00007ffff7864921 in MVM_gc_allocate_nursery (tc=0x2f734020180, size=32)
at src/gc/allocation.c:37
#9 0x00007ffff7864ba8 in MVM_gc_allocate (size=<optimized out>, tc=0x2f734020180)
at src/gc/allocation.h:15
#10 MVM_gc_allocate_zeroed (size=<optimized out>, tc=0x2f734020180) at src/gc/allocation.h:21
#11 MVM_gc_allocate_object (tc=0x2f734020180, st=<optimized out>) at src/gc/allocation.c:86
--Type <RET> for more, q to quit, c to continue without paging--
#12 0x00007ffff787b4b3 in MVM_repr_alloc_init (tc=tc@entry=0x2f734020180,
type=type@entry=0x2f734610078) at src/6model/reprconv.c:17
#13 0x00007ffff787cf69 in MVM_repr_box_str (tc=0x2f734020180, type=0x2f734610078,
val=<optimized out>) at src/6model/reprconv.c:738
#14 0x00007fffea1abc01 in ?? ()
#15 0x00007ffff7e62e80 in ?? () from //home/david/git/rakudo/install/lib/libmoar.so
#16 0x000002f734485ce8 in ?? ()
#17 0x00007fffea1ac8e3 in ?? ()
#18 0x00007ffff78c6c3c in MVM_disp_program_record_end (tc=0x7fffffffe0a0,
record=0x2f734485ce8) at src/disp/program.c:3099
#19 0x00007ffff58e53b8 in ?? ()
#20 0x000002f7374f7728 in ?? ()
#21 0x000002f73684edf0 in ?? ()
#22 0x000002f7347260c8 in ?? ()
#23 0x000002f73f33cc80 in ?? ()
#24 0x0000000000000000 in ?? ()
how do i run the tests?
What i'm doing is:
This fails with:
demanuel@archlinux ~/a/LibXML-raku (master)> rakudo -I. t/00dtd.t
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/t/00dtd.t
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/lib/LibXML.rakumod (LibXML)
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/lib/LibXML/Parser.rakumod (LibXML::Parser)
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/lib/LibXML/Parser/Context.rakumod (LibXML::Parser::Context)
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/lib/LibXML/_Configurable.rakumod (LibXML::_Configurable)
===SORRY!=== Error while compiling /home/demanuel/apagar/LibXML-raku/lib/LibXML/Config.rakumod (LibXML::Config)
Cannot locate native library '/home/demanuel/apagar/LibXML-raku/resources/libraries/libxml6.so': /home/demanuel/apagar/LibXML-raku/resources/libraries/libxml6.so: cannot open shared object file: No such file or directory
at /home/demanuel/apagar/LibXML-raku/lib/LibXML/Config.rakumod (LibXML::Config):64
at /home/demanuel/apagar/LibXML-raku/lib/LibXML/_Configurable.rakumod (LibXML::_Configurable):3
at /home/demanuel/apagar/LibXML-raku/lib/LibXML/Parser/Context.rakumod (LibXML::Parser::Context):4
at /home/demanuel/apagar/LibXML-raku/lib/LibXML/Parser.rakumod (LibXML::Parser):4
at /home/demanuel/apagar/LibXML-raku/lib/LibXML.rakumod (LibXML):1
at /home/demanuel/apagar/LibXML-raku/t/00dtd.t:3
demanuel@archlinux ~/a/LibXML-raku (master) [1]>
LIbXML has started segfaulting on the Rakudo blead on a number of tests
THere has been a lot of refactoring in the nativecall in raku. Maybe related? https://github.com/rakudo/rakudo/commits/main
@demanuel
how do i run the tests? The missing
resources/libraries/libxml6.so
file contains some additional bindings that need to be compiled first.
$ zef build .
can be run to do the compilation.
Under the hood, zef
executes Build.pm6
to generate and run a Makefile
to do the compilation.
Yes, agree the recent NativeCall changes have broken something. I'll look at submitting a Rakudo ticket over the next couple of days. see below
demanuel@archlinux ~/a/LibXML-raku (master)> zef build .
===> Building: LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_get_keep_blanks’:
[LibXML] src/xml6_gbl.c:70:5: warning: ‘__xmlKeepBlanksDefaultValue’ is deprecated [-Wdeprecated-declarations]
[LibXML] 70 | return xmlKeepBlanksDefaultValue;
[LibXML] | ^~~~~~
[LibXML] In file included from /usr/include/libxml2/libxml/globals.h:11,
[LibXML] from src/xml6_gbl.h:4,
[LibXML] from src/xml6_gbl.c:2:
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/parser.h:885:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 885 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:857:3: note: in expansion of macro ‘XML_OP’
[LibXML] 857 | XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:881:3: note: in expansion of macro ‘XML_GLOBALS_PARSER_CORE’
[LibXML] 881 | XML_GLOBALS_PARSER_CORE \
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:886:1: note: in expansion of macro ‘XML_GLOBALS_PARSER’
[LibXML] 886 | XML_GLOBALS_PARSER
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_set_keep_blanks’:
[LibXML] src/xml6_gbl.c:74:5: warning: ‘__xmlKeepBlanksDefaultValue’ is deprecated [-Wdeprecated-declarations]
[LibXML] 74 | xmlKeepBlanksDefaultValue = flag;
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/parser.h:885:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 885 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:857:3: note: in expansion of macro ‘XML_OP’
[LibXML] 857 | XML_OP(xmlKeepBlanksDefaultValue, int, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:881:3: note: in expansion of macro ‘XML_GLOBALS_PARSER_CORE’
[LibXML] 881 | XML_GLOBALS_PARSER_CORE \
[LibXML] | ^~~~~~~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/parser.h:886:1: note: in expansion of macro ‘XML_GLOBALS_PARSER’
[LibXML] 886 | XML_GLOBALS_PARSER
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] src/xml6_gbl.c: In function ‘xml6_gbl_os_thread_get_last_error’:
[LibXML] src/xml6_gbl.c:82:5: warning: ‘__xmlLastError’ is deprecated [-Wdeprecated-declarations]
[LibXML] 82 | return &xmlLastError;
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlversion.h:499:27: note: declared here
[LibXML] 499 | attrs XMLPUBFUN type *__##name(void);
[LibXML] | ^~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:869:16: note: in expansion of macro ‘XML_DECLARE_GLOBAL’
[LibXML] 869 | #define XML_OP XML_DECLARE_GLOBAL
[LibXML] | ^~~~~~~~~~~~~~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:863:3: note: in expansion of macro ‘XML_OP’
[LibXML] 863 | XML_OP(xmlLastError, xmlError, XML_DEPRECATED) \
[LibXML] | ^~~~~~
[LibXML] /usr/include/libxml2/libxml/xmlerror.h:870:1: note: in expansion of macro ‘XML_GLOBALS_ERROR’
[LibXML] 870 | XML_GLOBALS_ERROR
[LibXML] | ^~~~~~~~~~~~~~~~~
===> Building [OK] for LibXML:ver<0.10.7>:auth<zef:dwarring>:api<0.10.0>
demanuel@archlinux ~/a/LibXML-raku (master)>
I've uploaded LibXML 0.10.8 which hopefully now passes tests on the Rakudo blead. It still has those noisy compile time warnings related to xmlKeepBlanksDefaultValue and xmlLastError`, which still need to be fixed.
The problem related to usage of CArray[Str]
in a couple of places. I think Raku frees the contents when garbage collecting. But these contained strings that weren't designed to be freed. These have now been eliminated.
They've always been a problem. It's just that tests are flapping at lot more on the latest Rakudo.
i was able to install. Still have the warnings above. Thanks for the fix.
So there's three global libxml2
deprecations triggering the warnings xmlLastError
, xmlKeepBlanksDefaultValue
and xmlDefaultSAXLocator
.
Looking firstly at xmlLastError
. This is replaced in recent libxml2 versions with several per-context error handler as described inb the following source-code comments:
/**
* xmlSetStructuredErrorFunc:
* @ctx: the new error handling context
* @handler: the new handler function
*
* DEPRECATED: Use a per-context error handler.
*
* It's recommended to use the per-context error handlers instead:
*
* - xmlCtxtSetErrorHandler (since 2.13.0)
* - xmlTextReaderSetStructuredErrorHandler
* - xmlXPathSetErrorHandler (since 2.13.0)
* - xmlXIncludeSetErrorHandler (since 2.13.0)
* - xmlSchemaSetParserStructuredErrors
* - xmlSchemaSetValidStructuredErrors
* - xmlRelaxNGSetParserStructuredErrors
* - xmlRelaxNGSetValidStructuredErrors
*
* Set the global "structured" handler and context for error messages.
* If handler is NULL, the error handler is deactivated.
*
* The structured error handler takes precedence over "generic"
* handlers, even per-context generic handlers.
*
* Since this is a global setting, it's a good idea to deactivate the
* error handler after collecting the errors you're interested in.
*
* For multi-threaded applications, this must be set separately for
* each thread.
*/
libxml2 version: