This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

python 2.7.12 pip install with extensions fails with warning: "__BSD_VISIBLE" redefined


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]