tech-pkg archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: python311 vs expat
>>> This change broke both macOS and SunOS:
>>>
>>> bac7175966909 (adam 2026-03-04 06:51:45 +0000 44) CONFIGURE_ARGS+= --without-system-expat # requires expat_config.h
>>>
>>> It means that python311 has both:
>>>
>>> CONFIGURE_ARGS+= --with-system-expat
>>> CONFIGURE_ARGS+= --without-system-expat # requires expat_config.h
>>>
>>> I don't understand how this can work. Does this even work on NetBSD?
>>>
>>> I think it's clearly a regression on any other system, so if this is a NetBSD-specific hack then it needs to go in an .if OPSYS section, and I'd recommend a very good comment explaining why we have both --with and --without because that makes no sense to me.
>>
>> The problem is, not every operating system provides 'expat_config.h', but pkgsrc thinks the external expat is fine.
>
> I just tried building after providing an empty expat_config.h, and it
> built fine.
Not on macOS, and other systems with newer expat.
With this patch:
--- Modules/pyexpat.c.orig 2026-03-20 09:03:43.917376558 +0000
+++ Modules/pyexpat.c
@@ -8,7 +8,6 @@
#include <stdbool.h>
#include "structmember.h" // PyMemberDef
-#include "expat_config.h"
#include "expat.h"
#include "pyexpat.h"
I get:
/dist/work/lang/python311/work/Python-3.11.15/Modules/pyexpat.c:1227:9: error: use of undeclared identifier
'XML_SetAllocTrackerActivationThreshold'
1227 | XML_SetAllocTrackerActivationThreshold
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
building '_multibytecodec' extension
That's because newer expat.h depends on features defined in expat_config.h. In this particular case XML_SetAllocTrackerActivationThreshold is guarded with "# if defined(XML_DTD) || (defined(XML_GE) && XML_GE == 1)", and XML_DTD, XML_GE, and XML_GE are defined in expat_config.h.
> So either provide that (manually for this package, or from the
> expat/buildlink3.mk file), or just remove the include from
> Modules/pyexpat.c - I don't see it using anything from that header
> (the '#if's in it only check XML_COMBINED_VERSION, which is not
> provided by that header anyway).
I can commit PREFER.expat=pkgsrc solution, if no objection.
Adam
Home |
Main Index |
Thread Index |
Old Index