0

Python interpreter: 3.7

Python library: pywinhook https://pypi.org/project/pyWinhook/.

Objective: Add some features or functions to pywinhook library.

Tutorial to build this library: This library was done from pyHook library. That is why I am using the following tutorial to build this library https://sourceforge.net/p/pyhook/wiki/PyHook_Build_Instructions/.

Steps done: I downloaded the source code of the library. I installed the MinGW and SWIG. I added the environment variables required.

Issues: When I am executing python setup.py build -cmingw32, I got the following error and I could not continue with the process. If someone could explain to me what I should do. Thanks in advance

The last lines of the execution was:

build\temp.win-amd64-3.7\Release\pywinhook\cpyhook_wrap.o:cpyHook_wrap.c:(.text+0x1bb6): undefined reference to `_imp__PyEval_RestoreThread'
collect2.exe: error: ld returned 1 exit status
error: command 'C:\\MinGW\\bin\\gcc.exe' failed with exit status 1
sergioMoreno
  • 189
  • 1
  • 15

2 Answers2

2

searching for the error: undefined reference to `_imp__PyEval_RestoreThread' collect2.exe: error: ld returned 1 exit status

I got this,it may help.

https://github.com/miniupnp/miniupnp/issues/224

Juan Botero
  • 71
  • 1
  • 2
  • 12
  • 1
    Tks @Juan Botero for your help. I posted my answer below. Sorry for the delayed answer but It took me a lot to understand the error. – sergioMoreno Sep 18 '20 at 13:07
1

After a long search and based on the link shared by @Juan Botero, I realized that I am compiling in 64-bit. The solution was as follows:

  1. Download MinGW-w64 on https://sourceforge.net/projects/mingw-w64/

  2. Add the following statement in the file cygwinccompiler.py, due to I am using an updated version of VB.

    elif msc_ver == '1900': return ['msvcr100']

  3. I run the instruction written in the tutorial and it works.

sergioMoreno
  • 189
  • 1
  • 15