Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 490034 - [10.0] dev-lang/python-3.2.5-r3: build fails on Gentoo/FreeBSD 10.0. Modules/_posixsubprocess.c:738:22: error: 'O_CLOEXEC' undeclared (first use in this function)
Summary: [10.0] dev-lang/python-3.2.5-r3: build fails on Gentoo/FreeBSD 10.0. Modules/...
Status: RESOLVED OBSOLETE
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 488214
  Show dependency tree
 
Reported: 2013-11-01 10:53 UTC by Yuta SATOH
Modified: 2017-06-22 10:42 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
sample patch for Python-3.2.5/Modules/_posixsubprocess.c (490034.patch,753 bytes, patch)
2013-11-01 11:00 UTC, Yuta SATOH
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuta SATOH 2013-11-01 10:53:06 UTC
HAVE_PIPE2 is defined on FreeBSD 10.0.
Parts of the problem requires O_CLOEXEC.

Problem code)
Python-3.2.5/Modules/_posixsubprocess.c

#ifdef HAVE_PIPE2
    Py_BEGIN_ALLOW_THREADS
    res = pipe2(fds, O_CLOEXEC);
    Py_END_ALLOW_THREADS
    if (res != 0 && errno == ENOSYS)
    {
        {
#endif


_XOPEN_SOURCE is set to 600 by configure.
When _XOPEN_SOURCE is 600, _POSIX_C_SOURCE 200112 and __POSIX_VISIBLE 200112 are defined by sys/cdefs.h.

However, to get O_CLOEXEC, __POSIX_VISIBLE >= 200809 is required to define on FreeBSD.



Reproducible: Always

Steps to Reproduce:
1. emerge =dev-lang/python-3.2.5-r3
2.
3.

Actual Results:  
building '_posixsubprocess' extension
x86_64-gentoo-freebsd10.0-gcc -pthread -fPIC -DNDEBUG -O2 -pipe -mtune=generic -fwrapv -DNDEBUG -O2 -pipe -mtune=generic -fwrapv -IInclude -I. -I/var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Include -I/var/tmp/portage/dev-lang/python-3.2.5-r3/work/x86_64-gentoo-freebsd10.0 -c /var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Modules/_posixsubprocess.c -o build/temp.freebsd-10.0_beta1-Gentoo-amd64-3.2/var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Modules/_posixsubprocess.o
/var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Modules/_posixsubprocess.c: In function 'subprocess_cloexec_pipe':
/var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Modules/_posixsubprocess.c:738:22: error: 'O_CLOEXEC' undeclared (first use in this function)
     res = pipe2(fds, O_CLOEXEC);
                      ^
/var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Modules/_posixsubprocess.c:738:22: note: each undeclared identifier is reported only once for each function it appears in

<snip>

Python build finished, but the necessary bits to build these modules were not found:
_tkinter           ossaudiodev        spwd
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_posixsubprocess

running build_scripts
creating build/scripts-3.2
copying and adjusting /var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Tools/scripts/pydoc3 -> build/scripts-3.2
copying and adjusting /var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Tools/scripts/idle3 -> build/scripts-3.2
copying and adjusting /var/tmp/portage/dev-lang/python-3.2.5-r3/work/Python-3.2.5/Tools/scripts/2to3 -> build/scripts-3.2
changing mode of build/scripts-3.2/pydoc3 from 644 to 755
changing mode of build/scripts-3.2/idle3 from 644 to 755
changing mode of build/scripts-3.2/2to3 from 644 to 755
renaming build/scripts-3.2/pydoc3 to build/scripts-3.2/pydoc3.2
renaming build/scripts-3.2/idle3 to build/scripts-3.2/idle3.2
renaming build/scripts-3.2/2to3 to build/scripts-3.2/2to3-3.2
gmake: *** [sharedmods] Error 1
 * ERROR: dev-lang/python-3.2.5-r3::gentoo failed (compile phase):
 *   emake failed




FYI,
x86_64-gentoo-freebsd10.0/pyconfig.h:#define HAVE_PIPE2 1
x86_64-gentoo-freebsd9.0/pyconfig.h:/* #undef HAVE_PIPE2 */

configure.ac
if test $define_xopen_source = yes
then
  AC_DEFINE(_XOPEN_SOURCE, 600,
            Define to the level of X/Open that your system supports)


sys/cdefs.h
http://svnweb.freebsd.org/base/stable/10/sys/sys/cdefs.h?revision=256281&view=co
/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
#ifdef _XOPEN_SOURCE
#if _XOPEN_SOURCE - 0 >= 700
#define	__XSI_VISIBLE		700
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		200809
#elif _XOPEN_SOURCE - 0 >= 600
#define	__XSI_VISIBLE		600
#undef _POSIX_C_SOURCE
#define	_POSIX_C_SOURCE		200112
#elif _XOPEN_SOURCE - 0 >= 500
<snip>
/*
 * Deal with all versions of POSIX.  The ordering relative to the tests above is
 * important.
 */
#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
#define	_POSIX_C_SOURCE		198808
#endif
#ifdef _POSIX_C_SOURCE
#if _POSIX_C_SOURCE >= 200809
#define	__POSIX_VISIBLE		200809
#define	__ISO_C_VISIBLE		1999
#elif _POSIX_C_SOURCE >= 200112
#define	__POSIX_VISIBLE		200112
#define	__ISO_C_VISIBLE		1999
#elif _POSIX_C_SOURCE >= 199506
<snip>

fcntl.h
http://svnweb.freebsd.org/base/stable/10/sys/sys/fcntl.h?revision=256281&view=co
#if __POSIX_VISIBLE >= 200809
/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
#define	O_TTY_INIT	0x00080000	/* Restore default termios attributes */

#define	O_CLOEXEC	0x00100000
#endif


Note,
python-2.x does not require O_CLOEXEC.
python-3.3.2, Set _XOPEN_SOURCE to 700. (Issue #12852)
Comment 1 Yuta SATOH 2013-11-01 11:00:39 UTC
Created attachment 362382 [details, diff]
sample patch for Python-3.2.5/Modules/_posixsubprocess.c

If you don't want to change source code, please add the following line to src_configure() of ebuild.

use elibc_FreeBSD && export ac_cv_func_pipe2=no
Comment 2 Arfrever Frehtes Taifersar Arahesis 2013-11-01 23:32:28 UTC
Is problem present in Python 3.3 or 3.4?

Is it sufficient to backport configure.in part of http://hg.python.org/cpython/rev/92842e347d98 ?:

--- a/configure.in
+++ b/configure.in
@@ -408,8 +408,7 @@
   AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
    	    Define to activate Unix95-and-earlier features)
 
-  AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE Stds 1003.1-2001)
-  
+  AC_DEFINE(_POSIX_C_SOURCE, 200809L, Define to activate features from IEEE Stds 1003.1-2008)
 fi
 
 #
Comment 3 Yuta SATOH 2013-11-02 08:58:07 UTC
(In reply to Arfrever Frehtes Taifersar Arahesis from comment #2)
> Is problem present in Python 3.3 or 3.4?

no.
It was fixed in python 3.3.

> Is it sufficient to backport configure.in part of
> http://hg.python.org/cpython/rev/92842e347d98 ?:
> 
> --- a/configure.in
> +++ b/configure.in
> @@ -408,8 +408,7 @@
>    AC_DEFINE(_XOPEN_SOURCE_EXTENDED, 1,
>     	    Define to activate Unix95-and-earlier features)
>  
> -  AC_DEFINE(_POSIX_C_SOURCE, 200112L, Define to activate features from IEEE
> Stds 1003.1-2001)
> -  
> +  AC_DEFINE(_POSIX_C_SOURCE, 200809L, Define to activate features from IEEE
> Stds 1003.1-2008)
>  fi
>  
>  #

will also need the following code.
http://hg.python.org/cpython/rev/cf66578d03d1

--- a/configure.in
+++ b/configure.in
@@ -397,7 +397,8 @@ esac
 
 if test $define_xopen_source = yes
 then
-  AC_DEFINE(_XOPEN_SOURCE, 600, 
+  # X/Open 7, incorporating POSIX.1-2008
+  AC_DEFINE(_XOPEN_SOURCE, 700,
             Define to the level of X/Open that your system supports)
 
   # On Tru64 Unix 4.0F, defining _XOPEN_SOURCE also requires
Comment 4 Yuta SATOH 2017-06-22 10:42:24 UTC
python-3.2.5 is no longer in the tree.
closing.