2013-09-16 5 views
2

여러분, 감사합니다.Cython hello world 예제가 작동하지 않습니다.

Cython을 테스트 중이며 가장 간단한 경우를 시작했지만 컴파일 할 때 오류가 발생합니다. 사용 : Python 2.7, 최신 cython 및 minGW. cygwinccompiler.py를 편집하고 -mno-cygwin 행을 제거했습니다.

C:\Playground\demo_heeds\cython_test>python setup.py build_ext --inplace 
running build_ext 
skipping 'hello.c' Cython extension (up-to-date) 
building 'hello' extension 
C:\MinGW\bin\gcc.exe -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c he 
llo.c -o build\temp.win-amd64-2.7\Release\hello.o 
writing build\temp.win-amd64-2.7\Release\hello.def 
C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-2.7\Release\hello.o build\t 
emp.win-amd64-2.7\Release\hello.def -LC:\Python27\libs -LC:\Python27\PCbuild\amd 
64 -lpython27 -lmsvcr90 -o C:\Playground\demo_heeds\cython_test\hello.pyd 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x8b): undefined referen 
ce to `_imp__PyOS_snprintf' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x93): undefined referen 
ce to `_imp__Py_GetVersion' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0xfb): undefined referen 
ce to `_imp__PyOS_snprintf' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x114): undefined refere 
nce to `_imp__PyErr_WarnEx' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x12e): undefined refere 
nce to `_imp__PyTuple_New' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x150): undefined refere 
nce to `_imp__PyString_FromStringAndSize' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x18a): undefined refere 
nce to `_imp__Py_InitModule4' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x1a3): undefined refere 
nce to `_imp__PyModule_GetDict' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x1c0): undefined refere 
nce to `_imp__PyImport_AddModule' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x1e7): undefined refere 
nce to `_imp__PyObject_SetAttrString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x208): undefined refere 
nce to `_imp__PyString_FromStringAndSize' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x20e): undefined refere 
nce to `_imp__PyString_InternFromString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x232): undefined refere 
nce to `_imp__PyUnicodeUCS2_DecodeUTF8' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x294): undefined refere 
nce to `_imp__PyObject_SetAttrString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x2af): undefined refere 
nce to `_imp__PySys_GetObject' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x2c6): undefined refere 
nce to `_imp__PyExc_RuntimeError' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x2d1): undefined refere 
nce to `_imp__PyErr_SetString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x2e7): undefined refere 
nce to `_imp__PyFile_WriteString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x300): undefined refere 
nce to `_imp__PyFile_WriteObject' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x315): undefined refere 
nce to `_imp__PyFile_WriteString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x36e): undefined refere 
nce to `_imp__PyDict_SetItem' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x3ef): undefined refere 
nce to `_imp__PyString_FromString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x41a): undefined refere 
nce to `_imp__PyString_FromFormat' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x480): undefined refere 
nce to `_imp__PyCode_New' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x4db): undefined refere 
nce to `_imp__PyMem_Malloc' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x56f): undefined refere 
nce to `_imp__PyMem_Realloc' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x5d9): undefined refere 
nce to `_imp__PyModule_GetDict' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x5f7): undefined refere 
nce to `_imp___PyThreadState_Current' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x602): undefined refere 
nce to `_imp__PyFrame_New' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x618): undefined refere 
nce to `_imp__PyTraceBack_Here' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x676): undefined refere 
nce to `_imp__PyErr_Occurred' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x68b): undefined refere 
nce to `_imp__PyExc_ImportError' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x696): undefined refere 
nce to `_imp__PyErr_SetString' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x6e9): undefined refere 
nce to `_imp__PyFile_SoftSpace' 
build\temp.win-amd64-2.7\Release\hello.o:hello.c:(.text+0x707): undefined refere 
nce to `_imp__PyDict_New'`enter code here` 
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: build\temp 
.win-amd64-2.7\Release\hello.o: bad reloc address 0x0 in section `.data' 
collect2.exe: error: ld returned 1 exit status 
error: command 'gcc' failed with exit status 1 
+1

혹시 64 비트 파이썬이 있지만 32 비트 gcc가 있거나 그 반대의 경우가 있습니까? – nmaier

+1

나는 64 비트 파이썬과 32 비트 gcc를 가지고있다 ... 이것은 당신이 말한대로 문제가 될 수있다 - 고마워요. –

+0

이제 모든 것이 작동합니다 :) –

답변

5

좋아. 주석에서 대답을 잃지 않도록하려면 :

컴파일러는 32 비트 gcc 컴파일러 였고 Python은 64 비트 빌드였습니다. 이것은 작동하지 않습니다.

관련 문제