renpy / pygame_sdl2

Reimplementation of portions of the pygame API using SDL2.
GNU Lesser General Public License v2.1
325 stars 63 forks source link

Error trying to build on Windows (pygame_sdl2.event.c) #139

Closed iampham closed 1 month ago

iampham commented 2 years ago

I've followed the instructions listed on the documentation in the README:

  1. I've put pygame_sdl2_windeps into the pygame_sdl2 checkout
  2. I've installed the prerequisite libraries/compilers (future, cython, Microsoft Visual C++, etc.)

As soon as I run python setup.py install, the build runs smoothly until I get the following error:

building 'pygame_sdl2.event' extension
(path stuff)...
pygame_sdl2.event.c
gen3\pygame_sdl2.event.c(11491): error C2065: 'SDL_DISPLAYEVENT': undeclared identifier
gen3\pygame_sdl2.event.c(11575): error C2065: 'SDL_KEYMAPCHANGED': undeclared identifier
gen3\pygame_sdl2.event.c(11887): error C2065: 'SDL_DROPTEXT': undeclared identifier
gen3\pygame_sdl2.event.c(11899): error C2065: 'SDL_DROPBEGIN': undeclared identifier
gen3\pygame_sdl2.event.c(11911): error C2065: 'SDL_DROPCOMPLETE': undeclared identifier
gen3\pygame_sdl2.event.c(11923): error C2065: 'SDL_AUDIODEVICEADDED': undeclared identifier
gen3\pygame_sdl2.event.c(11935): error C2065: 'SDL_AUDIODEVICEREMOVED': undeclared identifier
gen3\pygame_sdl2.event.c(11947): error C2065: 'SDL_SENSORUPDATE': undeclared identifier
gen3\pygame_sdl2.event.c(11971): error C2065: 'SDL_RENDER_DEVICE_RESET': undeclared identifier
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.32.31326\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2

Other files before pygame_sdl2.event.c seem to have built succesfully. The build gets hung on this specific file. Is there any known fix/am I doing something stupid?

Thanks for the help!

DaryeDev commented 2 years ago

Have the same issue. Bump.

renpytom commented 2 years ago

I don't have experience building this with MSVC, so I can't help here. At this point, I'm not expecting pygame_sdl2 to be used outside of Ren'Py.

J-Wedekind commented 1 year ago

Recently I tried to build a new version and stumbled upon the same problems. Can't remember the full process of when I build it for the first time, but I remember it took me about a week of fiddling around and I still got some notes from then:

LNK2001: SDL-devel gotta be properly installed / linked and don't use a virtualenv.

Python.h not found: don't use a virtualenv or copy the include dir containing the python.h from the Python home dir to the root of the virtualenv.

C2065: Install latest VC and C++ BuildTools for your version of VisualStudio and add path to path variables.. also building process seems to favor the newest install in your path, but building may only work on VisualStudio 2015 to 2017 for some reason.

+Also check if your python setuptools is up to date.

I hope for this to help somebody out at least a bit and I'd be glad if someone figures out more.^^

Borohydride commented 1 year ago

I used newer versions of SDL2 source code to replace the files in pygame_sdl2_windeps, and successfully built the wheel.