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
Related
I'm new to python, and try to compile python module in HP-UX 11.31.
% CC=gcc python setup.py build
unix
running build
running build_ext
building 'pygoldilocks' extension
gcc -DNDEBUG -O +z -DPYGOLDILOCKS_VERSION=1.0
gcc: +z: not recognized ...
this produces '+z' not recognized.
How to solove it? Can I remove the option '+z'?
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 trying to get cython to realize I have a c compiler in MinGW 32-bit and I've tried everything I can find on the web but it's still not working. I am running Windows 7 Professional 64-bit. Here is what I have tried:
(1) I have Python 2.7 and I just installed MinGW with options gcc and g++ and some other options
(2) I edited the PATH environmental variable so it includes
C:\MinGW\bin;C:\MinGW\MSYS\1.0\local\bin;C:\MinGW\MSYS\1.0\bin
(3) I told Python to use MinGW as the default compiler by creating a file named
C:\Python27\Lib\distutils\distutils.cfg, containing
[build]
compiler = mingw32
(I do have MinGW32 by the way)
(4) I removed all instances of -mno-cygwin from the file C:\Python27\Lib\distutils\cygwincompiler.py
(5) I have a file called setup.py and a module called tryingcython.pyx that is written in python. My setup.py says
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
cmdclass = {'build_ext':build_ext},
ext_modules=[Extension("tryingcython",["tryingcython.pyx"])]
)
So then I open Command Prompt and get into the directory that contains setup.py and tryingcython.pyx, and I type
python setup.py build_ext --inplace --compiler=mingw32
Then it tells me:
running build_ext
skipping 'tryingcython.c' Cython extension (up-to-date)
building 'tryingcython.c' extension
gcc -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c tryingcython.c -o build\
temp.win32-2.7\Release\tryingcython.o
error: command 'gcc' failed: No such file or directory
So I guess Cython can't tell that I have gcc and it can't find it or what, even though I've tried about every single piece of advice I can find online for making it realize that I have MinGW which has gcc included.
Any help/additional ideas on how I can get cython to actually work would be much appreciated.
You are using exactly the same operational system and versions than me.
Try to cal gcc using:
SET input=intput.c
SET output=output.pyd
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O2 -o %output% %input% -lpython27
Usually I put this call in a cythongcc.bat file, in a directory recognized by the PATH environment variable as:
gcc -shared -IC:\Python27\include -LC:\Python27\libs -O3 -mtune=native -o %1.pyd %2.c -lpython27
So that I can , from where my cython .pyx files are, just do:
cython input.pyx
cythongcc input input
To get the compiled .pyd working!
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 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.