Problem with pyconfig.h in python36 which is already solved for python27

Stefan Metzmacher metze at samba.org
Mon Jan 28 22:37:08 UTC 2019


Hi koobs,

>> in Samba we recently switched to use python3 by default. But this breaks
>> the build on FreeBSD (at least 11.1 and 12.0). In order to be most
>> portable, we have a policy in Samba to include <Python.h> as the
>> first header when creating python bindings. It means pyconfig.h and
>> various system headers are included before our own config.h.
>> A detailed way to reproduce this can be found at the end of this mail.
>>
>> The problem is that pyconfig.h defines
>> _POSIX_C_SOURCE, __BSD_VISIBLE, _XOPEN_SOURCE and _XOPEN_SOURCE_EXTENDED.
>>
>> This seems to be fixed for python27 in this commit:
>> https://github.com/freebsd/freebsd-ports/commit/4b17dd9aeb9b28759551f38bf0f6b0edcac88607
>>
>> which added lang/python27/files/patch-pr192365.
>>
>> Could this be fixed for all python versions?
> 
> Hi Stefan,
> 
> The commit was added via:
> 
> x11-toolkits/py-wxPython30 build fails
> https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=192365
> 
> A similar issue (if not the same), reported upstream here:
> 
> https://bugs.python.org/issue17120
> 
> I don't see any issues with carrying the same change in other python
> ports, *but* we'd all like to see it resolved permanently upstream.
> 
> In order of preference, to progress we'd need:
> 
> 1) Upstream patches submitted against master, 3.7, 3.6, 2.7 so upstream
> can resolve this completely, commits/merges from which we can backport
> to our python ports.
> 
> or
> 
> 2) Patches against lang/pythonXY ports similar to python27, which may
> not be suitable for upstreaming *as is* (freebsd-specific?)
> 
> Along with either of those, create a new bug in Bugzilla to track this
> too, with summary like "lang/python3*: <summary of issue>" adding bug
> 192365 to "See Also"
> 
> I'm happy to put in the cycles to backport commits from (1) if we can
> get the root of the issue solved upstream.
> 
> Thanks for the detailed report.

Thanks for the hints.

I the meantime I noticed
https://en.cppreference.com/w/c/string/byte/memset
which states that __STDC_WANT_LIB_EXT1__ should be explicitly defined
in order to get memset_s().

I'm going to fix Samba by using -D__STDC_WANT_LIB_EXT1__=1 instead of
defining it in Samba's lib/replace/replace.h.
That means __STDC_WANT_LIB_EXT1__ is also defined if Python.h is the
first header.

Thanks!
metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-python/attachments/20190128/05f8967c/attachment.sig>


More information about the freebsd-python mailing list