Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. $ python setup.py build
  2. running build
  3. running build_ext
  4. building 'MyLib' extension
  5. c:MinGW64binx86_64-w64-mingw32-gcc.exe -mdll -O -Wall -Ic:Python27libsite-packagesnumpycoreinclude -Ic:Python27include -Ic:Python27PC -c MyLib.c -o buildtemp.win-amd64-2.7Releasemylib.o
  6. MyLib.c: In function 'initMyLib':
  7. MyLib.c:631:5: warning: implicit declaration of function 'Py_InitModule4_64' [-Wimplicit-function-declaration]
  8. writing buildtemp.win-amd64-2.7ReleaseMyLib.def
  9. c:MinGW64binx86_64-w64-mingw32-gcc.exe -shared -s buildtemp.win-amd64-2.7Releasemylib.o buildtemp.win-amd64-2.7ReleaseMyLib.def -Lc:Python27libs -Lc:Python27PCbuildamd64 -lpython27 -o buildlib.win-amd64-2.7MyLib.pyd
  10. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x13d): undefined reference to `__imp_PyExc_ValueError'
  11. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1275): undefined reference to `__imp_PyExc_ValueError'
  12. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1eef): undefined reference to `__imp_PyExc_ImportError'
  13. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1f38): undefined reference to `__imp_PyExc_AttributeError'
  14. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1f4d): undefined reference to `__imp_PyCObject_Type'
  15. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1f61): undefined reference to `__imp_PyExc_RuntimeError'
  16. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1fc7): undefined reference to `__imp_PyExc_RuntimeError'
  17. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x1ffe): undefined reference to `__imp_PyExc_RuntimeError'
  18. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x2042): undefined reference to `__imp_PyExc_RuntimeError'
  19. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x206c): undefined reference to `__imp_PyExc_RuntimeError'
  20. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x208a): more undefined references to `__imp_PyExc_RuntimeError' follow
  21. buildtemp.win-amd64-2.7Releasemylib.o:MyLib.c:(.text+0x20a7): undefined reference to `__imp_PyExc_ImportError'
  22. collect2.exe: error: ld returned 1 exit status
  23. error: command 'x86_64-w64-mingw32-gcc' failed with exit status 1
  24.  
  25. gendef.exe python33.dll
  26.  
  27. dlltool.exe --dllname python33.dll --def python33.def --output-lib libpython33.a
  28.  
  29. mv libpython33.a C:/Python33/libs
  30.  
  31. g++ -c myExtension.cpp -I/other/includes
  32.  
  33. g++ -DMS_WIN64 -c myExtension_wrap.cxx -IC:/Python33/include
  34.  
  35. g++ -shared -o _myExtension.pyd myExtension.o myExtension_wrap.o -lPython33 -lOtherSharedLibs -LC:/Python33/libs -LC:/path/to/other/shared/libs
  36.  
  37. python setup.py -c mingw32
  38.  
  39. gcc -c libmypy.c -IC:Users{user_name}Anaconda3pkgspython-3.6.4-h6538335_1include
  40. gcc -shared -o libmypy.dll libmypy.o -LC:Users{user_name}Anaconda3pkgspython-3.6.4-h6538335_1libs -lPython36
  41.  
  42. from ctypes import *
  43. m = cdll.LoadLibrary(r"C:{path_to_dll}libmypy.dll")
  44. print(m.hello())
  45.  
  46. import distutils.cygwinccompiler
  47. distutils.cygwinccompiler.get_msvcr = lambda: []
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement