pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: libxml2 and deprecated API calls



Chavdar Ivanov <ci4ic4%gmail.com@localhost> writes:

> On Mon, 18 Sept 2023 at 01:46, Greg Troxel <gdt%lexort.com@localhost> wrote:
>>
>> It looks like libxml2 does not enable deprecated APIs and thus
>> xmlCleanupPredefinedEntities is not available.
>> However py-libxml2 seems to want to use it.  This results in (on macOS):
>>
>>   $ echo 'import libxml2' | python3.11
>>   Traceback (most recent call last):
>>     File "<stdin>", line 1, in <module>
>>     File "/opt/pkg/lib/python3.11/site-packages/libxml2.py", line 1, in <module>
>>       import libxml2mod
>>   ImportError: dlopen(/opt/pkg/lib/python3.11/site-packages/libxml2mod.so, 2): Symbol not found: _xmlCleanupPredefinedEntities
>>     Referenced from: /opt/pkg/lib/python3.11/site-packages/libxml2mod.so
>>     Expected in: flat namespace
>>    in /opt/pkg/lib/python3.11/site-packages/libxml2mod.so
>>
>> I haven't tried other systems yet, but I wonder if anyone else is seeing
>> this.
>
> On pkgsrc head, NetBSD aarch64 -current, it is not seen:
>
> $ nm /usr/pkg/lib/python3.11/site-packages/libxml2mod.so | grep xm
> lCleanup
> 0000000000031c90 T libxml_xmlCleanupCharEncodingHandlers
> 0000000000031ce0 T libxml_xmlCleanupEncodingAliases
> 0000000000031d10 T libxml_xmlCleanupGlobals
> 0000000000031d60 T libxml_xmlCleanupInputCallbacks
> 0000000000031d90 T libxml_xmlCleanupOutputCallbacks
>                  U xmlCleanupCharEncodingHandlers@LIBXML2_2.4.30
>                  U xmlCleanupEncodingAliases@LIBXML2_2.4.30
>                  U xmlCleanupGlobals@LIBXML2_2.5.8
>                  U xmlCleanupInputCallbacks@LIBXML2_2.4.30
>                  U xmlCleanupOutputCallbacks@LIBXML2_2.4.30
>                  U xmlCleanupParser@LIBXML2_2.4.30

Thanks; that was helpful.

The problem is that setup.py has icky search path processing, and ends
up -I/usr/include to get native iconv before -I$prefix/include to get
pkgsrc libxml2, and reads native libxml2 which has legacy enabled.

I don't understand whether wrappers are supposed to help this case, or
whether we just need to patch setup.py.in to be sure that the libxml2 -I
arg is first, to avoid the old/bad system one shadowing the pkgsrc one.

I did get it to build with hand-patching mid-build.  I am a little
relucant to whack this hard right now but might code and test it
locally.

I left a big comment in py-libxml2/Makefile to help the next person; the
SUBST stuff there was hard to follow until one read the libxml2 build
system enough to understand.


Home | Main Index | Thread Index | Old Index