error installing answerable on cygwin

Asked 1 years ago, Updated 1 years ago, 112 views

Cygwin encountered an error installing an answer.

Infile included from/usr/include/python 2.7/pyport.h:332:0 ,
                 from /usr/include/python 2.7/Python.h:58,
                 from src/MD2.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
----------------------------------------
Rolling back uninstall of pycrypto
Command"/usr/bin/python-u-c" import setup tools,
tokenize;__file__='/tmp/pipe-b                                                                                              
build-v0y9C7/pycrypto/setup.py';exec(compile(getattr(tokenize, 'open', open)(__fi)                                                                                              
le__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record/tmp/pi                                                                                              
p-0H8nOx-record/install-record.txt --single-version-external-managed --compile                                                                                              
" failed with error code 1 in /tmp/ pip-build-v0y9C7/pycrypto/

It seems that the installation of pycrypto is out of order.

python cygwin ansible

2022-09-30 21:14

2 Answers

/usr/include/sys/time.h

by adding u_int to be redefined in the Installation is complete.

vi/usr/include/sys/time.h

#ifndefu_int
typedef unsigned intu_int;
#endif


2022-09-30 21:14

The answer is, "What's that good?" But I've built a pycrypto in cygwin before, so I looked it up.
It may be unnecessary as it seems to have already been resolved, but I will post it to share information.

When I build the source of pycrypto-2.6.1, I get the same error.
(cygwin was updated the other day)

$python setup.py build
warning —GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
File included from /usr/include/python 2.7/Python.h: 8:0 ,
                 from src/MD2.c:31:
/usr/include/python 2.7/pyconfig.h:1216:0: Warning: "__BSD_VISIBLE" has been redefined
 #define__BSD_VISIBLE1
 ^
File included from /usr/include/sys/config.h:5:0 ,
                 from /usr/include/_ansi.h:16,
                 from/usr/include/string.h:10,
                 from src/MD2.c:30:
/usr/include/sys/features.h:250:0:Note: This is where the previous declaration is located
 #define__BSD_VISIBLE0
 ^
File included from /usr/include/python 2.7/pyport.h:332:0 ,
                 from /usr/include/python 2.7/Python.h:58,
                 from src/MD2.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 don't think there was any problem when I installed the same version about a year ago...

As far as the error is concerned, it seemed to be a python problem in cygwin rather than a python problem, so I looked it up a little bit, but when I built the python expansion module,

  • Include a standard library header before "Python.h".
  • Added "-std=c99" option

It appears that an error occurs if the condition is present.

$cathoge.c
# include <string.h>
# include <Python.h>

$ gcc-choge.c-std=c99`python-config --cflags` 
File included from /usr/include/python 2.7/Python.h: 8:0 ,
                 from hoge.c:2:
/usr/include/python 2.7/pyconfig.h:1216:0: Warning: "__BSD_VISIBLE" has been redefined
 #define__BSD_VISIBLE1
 ^
File included from /usr/include/sys/config.h:5:0 ,
                 from /usr/include/_ansi.h:16,
                 from/usr/include/string.h:10,
                 from hoge.c:1:
/usr/include/sys/features.h:250:0:Note: This is where the previous declaration is located
 #define__BSD_VISIBLE0
 ^
File included from /usr/include/python 2.7/pyport.h:332:0 ,
                 from /usr/include/python 2.7/Python.h:58,
                 from hoge.c:2:
/usr/include/sys/time.h:104:34:Error: Unknown type name 'u_int'
 bintime_mul (struct bintime*_bt, u_int_x)
                                  ^

It seems to have already been resolved, but it's a little uncomfortable to fiddle with the header of the system, so I'll make other suggestions.

Cygwin has a package called python-crypto, so install it from setup.exe.

However, there seems to be no package for python3.
(I think that's why I built and installed it myself in the past.)

Download and deploy the source code for pycrypto-2.6.1 and comment out as there is an option for "-std=c99" around line 118 of "setup.py".

 if self.compiler.compiler_type in ('unix', 'cygwin', 'mingw32'):
            # Tell GCC to compile using the C99 standard.
            #self.__add_compiler_option("-std=c99")#Comment here

Install.

python setup.py install

Now I think I can install it.(I only built it myself)


2022-09-30 21:14

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.