Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
615 views
in Technique[技术] by (71.8m points)

mingw w64 - Error during compilation C code generated by Cython bad reloc address 0x0 in section `.data'

I'm trying to compile C code generated from Python code (hello world) and I'm stuck on one error. I'm using mingw32-w64. After many errors now I'm using this command

gcc -DMS_WIN64 -I Python38include -o test.exe test.c -lpython38 -lm -L Python38libs -shared -Wl,--enable-auto-image-base -Wl,--enable-auto-import

But I'm getting error

C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x28c): undefined reference to `__imp_PyExc_ImportError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x307): undefined reference to `__imp__Py_NoneStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x34c): undefined reference to `__imp_PyExc_AttributeError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x59c): undefined reference to `__imp_PyExc_RuntimeError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xb51): undefined reference to `__imp_PyExc_ImportError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xc23): undefined reference to `__imp_PyExc_NameError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xcb9): undefined reference to `__imp__Py_CheckRecursionLimit'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xd22): undefined reference to `__imp__Py_CheckRecursionLimit'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xd32): undefined reference to `__imp__Py_CheckRecursionLimit'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xd40): undefined reference to `__imp__Py_CheckRecursionLimit'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xd8a): undefined reference to `__imp_PyExc_SystemError'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xfc4): undefined reference to `__imp__Py_FalseStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0xfcd): undefined reference to `__imp__Py_TrueStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x101f): undefined reference to `__imp__Py_FalseStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x1037): undefined reference to `__imp__Py_FalseStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x1044): undefined reference to `__imp__Py_TrueStruct'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x17c0): undefined reference to `__imp_PyModule_Type'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x17d8): undefined reference to `__imp_PyModule_Type'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x18d4): undefined reference to `__imp_PyBaseObject_Type'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x1e92): undefined reference to `__imp_PyExc_DeprecationWarning'
C:UsersJaAppDataLocalTempccqKHihT.o:test.c:(.text+0x1ee9): undefined reference to `__imp_PyExc_TypeError'
c:/users/ja/documents/winbuilds/bin/../lib64/gcc/x86_64-w64-mingw32/4.8.3/../../../../x86_64-w64-mingw32/bin/ld.exe: C:UsersJaAppDataLocalTempccqKHihT.o: bad reloc address 0x0 in section `.data'
collect2.exe: error: ld returned 1 exit status

Using Python 3.8.4 x86_64-w64-mingw32 Windows 10

question from:https://stackoverflow.com/questions/66052936/error-during-compilation-c-code-generated-by-cython-bad-reloc-address-0x0-in-sec

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...