I was trying to install cython on windows 7 using python setup.py install. But it encountered an error:
C:\Cython-0.16>C:\Python27\python setup.py install
running install
running build
running build_py
running build_ext
building 'Cython.Plex.Scanners' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Pytho
n27\PC -c Cython\Plex\Scanners.c -o build\temp.win32-2.7\Release\cython\plex\sca
nners.o
cc1.exe: error: unrecognized command line option '-mno-cygwin'
error: command 'gcc' failed with exit status 1
I am using Python 2.7, I have MinGW and Cygwin installed on the system. I tried to google it. But there isn't a similar problem.
I used mingw-get-inst-20120426.exe to install the MinGW version 4.5.
-mno-cygwin in Python\Lib\distutils\cygwinccompiler.py causes this problem: see Compiling with cython and mingw produces gcc: error: unrecognized command line option '-mno-cygwin' or http://korbinin.blogspot.com/2013/03/cython-mno-cygwin-problems.html. My Python distribution (Anaconda)'s cygwinccompiler.py does not have that though. Anyway, after removing all -mno-cygwin in the definition of the Mingw32CCompiler class you should be able to compile.
Related
Im trying to crate a cryptosystem on the raspbian OS. Chose python and pycrypto because the OS comes with python 3.2.3 pre-installed. Moved the "pycrypto-2.6.1.tar.gz" to the folder where python files are located and extracted there. Suposed to build using the command "python setup.py build" and then install.
But during the build phase, keep getting the error:
"pi#raspberrypi /usr/lib/python3.2/pycrypto-2.6.1 $ python setup.py buildrunning build
running build_py
running build_ext
running build_configure
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Hash._MD2' extension
gcc -pthread -fno-strict-aliasing -fwrapv -Wall -Wstrict-prototypes -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python2.7 -c src/MD2.c -o build/temp.linux-armv6l-2.7/src/MD2.o
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1
"
Not able to figure out whether I am supposed to change the pathing. Could somebody give an insight in to this?
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
The libgmp-dev package provides the necessary files to support building the optimized module here:
apt-get install libgmp-dev
src/MD2.c:31:20: fatal error: Python.h: No such file or directory
compilation terminated.
If you search for fatal error: Python.h: No such file or directory, the very first Google result is for this StackOverflow question, which tells you that you need to install the python-dev package:
apt-get install python-dev
In general, if you are building software from source you will need the corresponding -dev package for any required libraries; these packages provide header files (foo.h) and the unversioned shared libraries necessary for linking.
I am developing linux python applications, but they are too packaged to be deployed in windows environment.
I use to do everything from linux development platform.
At the moment, however I need cross compiling python chaco library for win32.
I need to give as arguments, the mingw32 compiler, and the python dll located in ~/.wine/drive_c/...
I have got some problems using it with mingw32.
In the environment, I have got python win32 setted up in wine drive.
python setup.py build --compiler=mingw32
running build
running build_py
running egg_info
writing requirements to Chaco.egg-info/requires.txt
writing Chaco.egg-info/PKG-INFO
writing namespace_packages to Chaco.egg-info/namespace_packages.txt
writing top-level names to Chaco.egg-info/top_level.txt
writing dependency_links to Chaco.egg-info/dependency_links.txt
writing manifest file 'Chaco.egg-info/SOURCES.txt'
running build_ext
building 'enthought.chaco.contour.contour' extension
gcc -mno-cygwin -mdll -O -Wall -DNUMPY -I/usr/lib/python2.6/dist-packages/numpy/core/include -I/usr/include/python2.6 -c enthought/chaco/contour/cntr.c -o build/temp.linux-x86_64-2.6/enthought/chaco/contour/cntr.o
cc1: error: unrecognized command line option "-mno-cygwin"
cc1: error: unrecognized command line option "-mdll"
error: command 'gcc' failed with exit status 1
from your linux cmdline , the command to compile would be similar to :
i586-mingw32msvc-gcc -mdll -O -Wall -DNUMPY -I/home/xxx/.wine/drive_c/Python26/include -I/home/xxxx/.wine/drive_c/Python26/Lib/site-packages/numpy/core/include -c enthought/chaco/contour/cntr.c -o build/temp.linux-x86_64-2.6/enthought/chaco/contour/cntr.o
I am trying to build a source using python's distutils. I have created a simple setup.py following an example, and building it as suggested works fine:
python setup.py build
Now it is possible to build a source with a desired compiler; a list of compilers can be found as
python setup.py build_ext --inplace --help-compiler
List of available compilers:
--compiler=bcpp Borland C++ Compiler
--compiler=cygwin Cygwin port of GNU C Compiler for Win32
--compiler=emx EMX port of GNU C Compiler for OS/2
--compiler=mingw32 Mingw32 port of GNU C Compiler for Win32
--compiler=msvc Microsoft Visual C++
--compiler=unix standard UNIX-style compiler
However, if I try to use, for example, the mingw32 compiler as follows
python setup.py build --compiler=mingw32
I get the following error output:
building 'demo' extension
creating build
creating build/temp.linux-i686-2.7
gcc -mno-cygwin -mdll -O -Wall -DMAJOR_VERSION=1 -DMINOR_VERSION=0 -I/usr/local/include -I/usr/include/python2.7 -c demo.c -o build/temp.linux-i686-2.7/demo.o
cc1: error: unrecognized command line option ‘-mno-cygwin’
cc1: error: unrecognized command line option ‘-mdll’
error: command 'gcc' failed with exit status 1
What is the cause for this problem? Am I doing something wrong? Do I need to specify something else? Am I using wrong versions (Ubuntu 12.04, python 2.7.3, Distutils 1.0a4)?Do I need to 'remove' the offending options?
I don't think you really have MinGW on Ubuntu.
As you already quote,
--compiler=mingw32 Mingw32 port of GNU C Compiler for Win32
You should try --compiler=unix instead.
could you try installing python development headers and then run your command .
sudo apt-get install python-dev
sudo apt-get install libevent-dev
I'm using Python 2.7 in Windows Powershell (I set the environment so I can use Python).
I have Cython installed (using the Windows installer).
I'm trying to follow the tutorial on the Cython website by making a simple "Hello World" extension, but when I try to build the extension I get this error:
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
How do I resolve this so that I may optimize my python code by C extensions?
Here is the rest of the error code:
Windows PowerShell
Copyright (C) 2009 Microsoft Corporation. All rights reserved.
PS C:\Users\Pinky> cd Programming
PS C:\Users\Pinky\Programming> python setup.py build_ext --inplace
running build_ext
skipping 'helloworld.c' Cython extension (up-to-date)
building 'helloworld' extension
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c helloworld.c -o build\temp.win32-2.7\Relea
se\helloworld.o
writing build\temp.win32-2.7\Release\helloworld.def
C:\MinGW\bin\dllwrap.exe -mdll -static --output-lib build\temp.win32-2.7\Release\libhelloworld.a --def build\temp.win32-
2.7\Release\helloworld.def -s build\temp.win32-2.7\Release\helloworld.o -LC:\Python27\libs -LC:\Python27\PCbuild -lpytho
n27 -lmsvcr90 -o C:\Users\Pinky\Programming\helloworld.pyd
helloworld.exp: file not recognized: File format not recognized
collect2: ld returned 1 exit status
dllwrap: gcc exited with status 1
error: command 'dllwrap' failed with exit status 1
PS C:\Users\Pinky\Programming>
I am trying to install M2Crypto on CentOS by compiling from the source.
i am doing a python setup.py build
But I get the following error,
/usr/local/lib/python2.6/distutils/dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
warnings.warn(msg)
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/local/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_m2crypto.i:28: Error: Unable to find 'openssl/opensslv.h'
SWIG/_evp.i:9: Error: Unable to find 'openssl/opensslconf.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf.h'
error: command 'swig' failed with exit status 1
Please advise ...
Prasanna
The following should work:
env SWIG_FEATURES="-cpperraswarn -includeall -D__`uname -m`__ -I/usr/include/openssl" python setup.py build
Edit: and openssl-devel package is of course also required.
I just had this problem. In M2Crypto's INSTALL file:
Note about Fedora Core -based Distributions
----------------------------------------------------
Fedora Core (and RedHat, CentOS etc.) have made changes to OpenSSL
configuration compared to many other Linux distributions. If you can not
build M2Crypto normally, try the fedora_setup.sh script included with
M2Crypto sources.
My solution was to get the sources from PyPI or from the source. Then in the M2Crypto directory:
$ chmod +x fedora_setup.py
$ ./fedora_setup.py install
If you're using a virtualenv, change the path of the python interpreter in that file, or activate your environment before building.
The only dependency that I had that wasn't satisfied on my system was openssl-devel.
Install openssl-devel.
Follow Brian's instruction, and make sure you have install openssl-devel. if you experience error like this:
./fedora_setup.sh build
running build
running build_py
running build_ext
building 'M2Crypto.__m2crypto' extension
swigging SWIG/_m2crypto.i to SWIG/_m2crypto_wrap.c
swig -python -I/usr/include/python2.6 -I/usr/include -includeall -o SWIG/_m2crypto_wrap.c SWIG/_m2crypto.i
SWIG/_evp.i:12: Error: Unable to find 'openssl/opensslconf-i686.h'
SWIG/_ec.i:7: Error: Unable to find 'openssl/opensslconf-i686.h'
error: command 'swig' failed with exit status 1
You are running i386 operating system on 64 bit hardware. arch =´uname -m´ will yields i686. The easiest way is to work around this is to create a symbolic link.
sudo ln -s /usr/include/openssl/opensslconf-i386.h /usr/include/openssl/opensslconf-i686.h
Or if you experience errors like:
./fedora_setup.sh build
running build
running build_py
running build_ext
SWIG/_m2crypto_wrap.c:27555: error: ‘Swig_var__evp_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_get’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27564: error: ‘Swig_var__dh_err_set’ undeclared (first use in this function)
SWIG/_m2crypto_wrap.c:27576: error: ‘Swig_var__rsa_err_get’ undeclared (first use in this function)
...
Some headers are missing, just issue the following command and try again:
sudo yum install python-devel
I had this problem now (in 2018), I solved it by installing openssl-devel, gcc and make
yum install gcc gcc-c++ make openssl-devel