[issue12999] _XOPEN_SOURCE usage on Solaris
Charles-François Natali
report at bugs.python.org
Sat Sep 17 09:20:12 CEST 2011
New submission from Charles-François Natali <neologix at free.fr>:
While testing issue #12981, I stumbled on a problem on OpenIndiana buildbot:
"""
test test_multiprocessing crashed -- Traceback (most recent call last):
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/test/regrtest.py", line 1133, in runtest_inner
the_package = __import__(abstest, globals(), locals(), [])
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/test/test_multiprocessing.py", line 38, in <module>
from multiprocessing import util, reduction
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 437, in load_module
return self._load_module(fullname)
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 141, in decorated
return fxn(self, module, *args, **kwargs)
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/importlib/_bootstrap.py", line 342, in _load_module
exec(code_object, module.__dict__)
File "/export/home/buildbot/64bits/custom.cea-indiana-amd64/build/Lib/multiprocessing/reduction.py", line 57, in <module>
raise ImportError('pickling of connections not supported')
ImportError: pickling of connections not supported
"""
Which means that socket.CMSG_LEN isn't defined.
Now, you might wonder how this can work in the C version of multiprocessing.(sendfd|recvfd), which needs CMSG_LEN().
Here's how:
"""
#ifdef __sun
/* The control message API is only available on Solaris
if XPG 4.2 or later is requested. */
#define _XOPEN_SOURCE 500
#endif
"""
And indeed:
http://fxr.watson.org/fxr/source/common/sys/socket.h?v=OPENSOLARIS#L478
"""
#if defined(_XPG4_2)
/*
* The cmsg headers (and macros dealing with them) were made available as
* part of UNIX95 and hence need to be protected with a _XPG4_2 define.
*/
"""
The problem is that socketmodule uses pyconfig.h defines, and _XOPEN_SOURCE isn't defined on Solaris:
http://hg.python.org/cpython/rev/7c947768b435
(it was added explicitely to Modules/_multiprocessing/multiprocessing.h for sendmsg by http://hg.python.org/cpython/rev/419901e65dd2).
So, _XOPEN_SOURCE is needed on Solaris to build socket_sendmsg and friends.
I'm not sure about the best way to proceed, since Martin certainly had good reasons to remove _XOPEN_SOURCE definition entirely on Solaris.
Should we define it only at the top of socketmodule?
----------
nosy: +loewis
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12999>
_______________________________________
More information about the Python-bugs-list
mailing list