public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined
@ 2016-11-23 17:24 Jason Bell
  2016-11-25  2:50 ` Erik Bray
  2016-11-29  0:01 ` Stephen Paul Carrier
  0 siblings, 2 replies; 4+ messages in thread
From: Jason Bell @ 2016-11-23 17:24 UTC (permalink / raw)
  To: cygwin

Hi -

The newest version of cygwin with python 2.7.12-1 fails when pip
installing packages that require compilation.  For example, pycrypto
fails:

$ pip install pycrypto
Collecting pycrypto
.......
  building 'Crypto.PublicKey._fastmath' extension
  creating build/temp.cygwin-2.6.0-x86_64-2.7
  creating build/temp.cygwin-2.6.0-x86_64-2.7/src
  gcc -fno-strict-aliasing -ggdb -pipe -Wimplicit-function-declaration
-fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/build=/usr/src/debug/python-2.7.12-1
-fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/src/Python-2.7.12=/usr/src/debug/python-2.7.12-1
-fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer
-Isrc/ -I/usr/include/ -I/usr/include/python2.7 -c src/_fastmath.c -o
build/temp.cygwin-2.6.0-x86_64-2.7/src/_fastmath.o
  In file included from /usr/include/python2.7/Python.h:8:0,
                   from src/_fastmath.c:31:
  /usr/include/python2.7/pyconfig.h:1221:0: warning: "__BSD_VISIBLE" redefined
   #define __BSD_VISIBLE 1
   ^
  In file included from /usr/include/sys/config.h:5:0,
                   from /usr/include/_ansi.h:16,
                   from /usr/include/stdio.h:29,
                   from src/_fastmath.c:29:
  /usr/include/sys/features.h:250:0: note: this is the location of the
previous definition
   #define __BSD_VISIBLE  0
   ^
  In file included from /usr/include/python2.7/pyport.h:332:0,
                   from /usr/include/python2.7/Python.h:58,
                   from src/_fastmath.c:31:
  /usr/include/sys/time.h:104:34: error: unknown type name ‘u_int’
   bintime_mul(struct bintime *_bt, u_int _x)
                                    ^
  error: command 'gcc' failed with exit status 1

  ----------------------------------------

I can fix these errors by changing __BSD_VISIBLE from 1 to 0 in
/usr/include/python2.7/pyconfig.h.  Here's a patch:

--- pyconfig.h 2016-11-20 09:38:22.434174700 -0500
+++ pyconfig-bsd-not-visible.h 2016-11-20 09:38:05.391993200 -0500
@@ -1218,7 +1218,7 @@
 #define _XOPEN_SOURCE_EXTENDED 1

 /* Define on FreeBSD to activate all library features */
-#define __BSD_VISIBLE 1
+#define __BSD_VISIBLE 0

 /* Define to 1 if type `char' is unsigned and you are not using gcc.  */
 #ifndef __CHAR_UNSIGNED__

And here's a link to a script that changes the value in one shot:
https://gist.githubusercontent.com/thorrr/271058eeb5f1903213938f89fcbc3a73/raw/15026396047b61102826a8dd92ea591155573f1d/pyconfig-fix.sh

I can confirm this makes several packages I use often work correctly
but I don't know what the other consequences of changing this variable
are.

J

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined
  2016-11-23 17:24 python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined Jason Bell
@ 2016-11-25  2:50 ` Erik Bray
  2016-11-29  0:01 ` Stephen Paul Carrier
  1 sibling, 0 replies; 4+ messages in thread
From: Erik Bray @ 2016-11-25  2:50 UTC (permalink / raw)
  To: cygwin

On Wed, Nov 23, 2016 at 4:24 AM, Jason Bell <jbell9999@gmail.com> wrote:
> Hi -
>
> The newest version of cygwin with python 2.7.12-1 fails when pip
> installing packages that require compilation.  For example, pycrypto
> fails:
>
> $ pip install pycrypto
> Collecting pycrypto
> .......
>   building 'Crypto.PublicKey._fastmath' extension
>   creating build/temp.cygwin-2.6.0-x86_64-2.7
>   creating build/temp.cygwin-2.6.0-x86_64-2.7/src
>   gcc -fno-strict-aliasing -ggdb -pipe -Wimplicit-function-declaration
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/build=/usr/src/debug/python-2.7.12-1
> -fdebug-prefix-map=/usr/src/ports/python/python-2.7.12-1.x86_64/src/Python-2.7.12=/usr/src/debug/python-2.7.12-1
> -fwrapv -Wall -Wstrict-prototypes -std=c99 -O3 -fomit-frame-pointer
> -Isrc/ -I/usr/include/ -I/usr/include/python2.7 -c src/_fastmath.c -o
> build/temp.cygwin-2.6.0-x86_64-2.7/src/_fastmath.o
>   In file included from /usr/include/python2.7/Python.h:8:0,
>                    from src/_fastmath.c:31:
>   /usr/include/python2.7/pyconfig.h:1221:0: warning: "__BSD_VISIBLE" redefined
>    #define __BSD_VISIBLE 1
>    ^
>   In file included from /usr/include/sys/config.h:5:0,
>                    from /usr/include/_ansi.h:16,
>                    from /usr/include/stdio.h:29,
>                    from src/_fastmath.c:29:
>   /usr/include/sys/features.h:250:0: note: this is the location of the
> previous definition
>    #define __BSD_VISIBLE  0
>    ^
>   In file included from /usr/include/python2.7/pyport.h:332:0,
>                    from /usr/include/python2.7/Python.h:58,
>                    from src/_fastmath.c:31:
>   /usr/include/sys/time.h:104:34: error: unknown type name ‘u_int’
>    bintime_mul(struct bintime *_bt, u_int _x)
>                                     ^
>   error: command 'gcc' failed with exit status 1
>
>   ----------------------------------------
>
> I can fix these errors by changing __BSD_VISIBLE from 1 to 0 in
> /usr/include/python2.7/pyconfig.h.  Here's a patch:
>
> --- pyconfig.h 2016-11-20 09:38:22.434174700 -0500
> +++ pyconfig-bsd-not-visible.h 2016-11-20 09:38:05.391993200 -0500
> @@ -1218,7 +1218,7 @@
>  #define _XOPEN_SOURCE_EXTENDED 1
>
>  /* Define on FreeBSD to activate all library features */
> -#define __BSD_VISIBLE 1
> +#define __BSD_VISIBLE 0
>
>  /* Define to 1 if type `char' is unsigned and you are not using gcc.  */
>  #ifndef __CHAR_UNSIGNED__
>
> And here's a link to a script that changes the value in one shot:
> https://gist.githubusercontent.com/thorrr/271058eeb5f1903213938f89fcbc3a73/raw/15026396047b61102826a8dd92ea591155573f1d/pyconfig-fix.sh
>
> I can confirm this makes several packages I use often work correctly
> but I don't know what the other consequences of changing this variable
> are.

FWIW this patch to pycrypto also fixes it:

https://git.sagemath.org/sage.git/tree/build/pkgs/pycrypto/patches/cygwin/disable-std-c99.patch?id=aaa9b7fc887b64ba1dba7cba16061f598a097b75

The problem only occurs when trying to build with the C99 standard if
Python itself was not.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined
  2016-11-23 17:24 python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined Jason Bell
  2016-11-25  2:50 ` Erik Bray
@ 2016-11-29  0:01 ` Stephen Paul Carrier
  2016-11-29 11:50   ` cyg Simple
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Paul Carrier @ 2016-11-29  0:01 UTC (permalink / raw)
  To: cygwin

>> Hi -
>>
>> The newest version of cygwin with python 2.7.12-1 fails when pip
>> installing packages that require compilation.  For example, pycrypto
>> fails:
>
>FWIW this patch to pycrypto also fixes it:
>
>https://git.sagemath.org/sage.git/tree/build/pkgs/pycrypto/patches/cygwin/disable-std-c99.patch?id=aaa9b7fc887b64ba1dba7cba16061f598a097b75
>
>The problem only occurs when trying to build with the C99 standard if
>Python itself was not.

I fixed this issue by editing /usr/include/python2.7/pyconfig.h to comment
out the second line of:

/* Define on FreeBSD to activate all library features */
#define __BSD_VISIBLE 1

This seemed like the right thing to do since Cygwin isn't FreeBSD, and
the problem went away.

Is this an oversight in python-devel package?  Issue doesn't occur in
32-bit version.

Stephen Carrier
Systems Administrator 
BEAR (Berkeley Evaluation & Assessment Research) Center
Graduate School of Education
University of California, Berkeley
http://BEARcenter.Berkeley.EDU/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined
  2016-11-29  0:01 ` Stephen Paul Carrier
@ 2016-11-29 11:50   ` cyg Simple
  0 siblings, 0 replies; 4+ messages in thread
From: cyg Simple @ 2016-11-29 11:50 UTC (permalink / raw)
  To: cygwin

On 11/28/2016 2:53 PM, Stephen Paul Carrier wrote:
>>> Hi -
>>>
>>> The newest version of cygwin with python 2.7.12-1 fails when pip
>>> installing packages that require compilation.  For example, pycrypto
>>> fails:
>>
>> FWIW this patch to pycrypto also fixes it:
>>
>> https://git.sagemath.org/sage.git/tree/build/pkgs/pycrypto/patches/cygwin/disable-std-c99.patch?id=aaa9b7fc887b64ba1dba7cba16061f598a097b75
>>
>> The problem only occurs when trying to build with the C99 standard if
>> Python itself was not.
> 
> I fixed this issue by editing /usr/include/python2.7/pyconfig.h to comment
> out the second line of:
> 
> /* Define on FreeBSD to activate all library features */
> #define __BSD_VISIBLE 1
> 

The use of a __PRIVATE_DEFINE is highly discouraged.  In sys/features.h
you'll find a comment to that effect.  Python should have used
_BSD_SOURCE but even that is deprecated in favor of _DEFAULT_SOURCE.

> This seemed like the right thing to do since Cygwin isn't FreeBSD, and
> the problem went away.
> 

No but that doesn't mean the functions do not exist.

> Is this an oversight in python-devel package?  Issue doesn't occur in
> 32-bit version.
> 

The oversight would be the use of the private define instead of the
public one.  If you remove the __BSD_VISIBLE and use _DEFAULT_SOURCE
instead does it help?  If not then there is a deeper issue.

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-28 22:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-23 17:24 python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined Jason Bell
2016-11-25  2:50 ` Erik Bray
2016-11-29  0:01 ` Stephen Paul Carrier
2016-11-29 11:50   ` cyg Simple

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).