Coder Social home page Coder Social logo

Comments (25)

ethanhs avatar ethanhs commented on May 16, 2024

I got the setup.py to run without failing looking for libs, but it isn't finding the include dir I point to. I am building for MS visual c though, so I am not sure about cygwin.

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

How are you pointing it to include directories?

I just modified the code so that it's now possible to set the PYGAME_SDL2_CFLAGS and PYGAME_SDL2_LDFLAGS variables. These are in a GCC-style format, but it should be possible to use them on windows:

CFLAGS:

  • Arguments beginning with -I are treated as include directories.
  • Other arguments are treated as extra compile arguments.

LDFLAGS:

  • Arguments beginning with -L are treated as library directories.
  • Arguments beginning with -l are treated as libraries.
  • Other arguments are treated as extra compile arguments.

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

I was manually appending the path to the include directory of the sdl2 source to include_dirs and extra compile args to extra_compile_args. I may have made a mistake in doing so. I have 2 questions:

  1. Does this project support Python 3? (I am compiling with VS 2010, and testing the setup.py with Python 3. I have so far assumed it does, because I did not see a Python 2 only notice, but if so, I need to change compiler versions.)
  2. I do not see any .lib files in the SDL sources. Any idea what I should be pointing to?

Also, if the aforementioned environment variables aren't set, it will give a file not found. I will make a PR to add exception checking when I get stuff working.

So, it seems it is looking for a symbol as the compilation fails with a linker error, question 2 seems especially important

path\to\pygame_sdl2>py -3 setup.py install
pygame_sdl2.error is out of date.
pygame_sdl2.color is out of date.
pygame_sdl2.controller is out of date.
pygame_sdl2.rect is out of date.
pygame_sdl2.rwobject is out of date.
pygame_sdl2.surface is out of date.
pygame_sdl2.display is out of date.
pygame_sdl2.event is out of date.
pygame_sdl2.locals is out of date.
pygame_sdl2.key is out of date.
pygame_sdl2.mouse is out of date.
pygame_sdl2.joystick is out of date.
pygame_sdl2.pygame_time is out of date.
pygame_sdl2.image is out of date.
pygame_sdl2.transform is out of date.
pygame_sdl2.gfxdraw is out of date.
pygame_sdl2.draw is out of date.
pygame_sdl2.font is out of date.
pygame_sdl2.mixer is out of date.
pygame_sdl2.mixer_music is out of date.
warning: src\pygame_sdl2\mixer_music.pyx:58:0: Overriding cdef method with def method.
pygame_sdl2.scrap is out of date.
pygame_sdl2.render is out of date.
running install
running build
running build_py
creating build
creating build\lib.win32-3.4
creating build\lib.win32-3.4\pygame_sdl2
copying src\pygame_sdl2\__init__.py -> build\lib.win32-3.4\pygame_sdl2
copying src\pygame_sdl2\compat.py -> build\lib.win32-3.4\pygame_sdl2
creating build\lib.win32-3.4\pygame_sdl2\threads
copying src\pygame_sdl2\threads\__init__.py -> build\lib.win32-3.4\pygame_sdl2\threads
copying src\pygame_sdl2\threads\Py25Queue.py -> build\lib.win32-3.4\pygame_sdl2\threads
copying src\pygame_sdl2\sprite.py -> build\lib.win32-3.4\pygame_sdl2
copying src\pygame_sdl2\sysfont.py -> build\lib.win32-3.4\pygame_sdl2
copying src\pygame_sdl2\time.py -> build\lib.win32-3.4\pygame_sdl2
copying src\pygame_sdl2\version.py -> build\lib.win32-3.4\pygame_sdl2
running build_ext
building 'pygame_sdl2.error' extension
creating build\temp.win32-3.4
creating build\temp.win32-3.4\Release
creating build\temp.win32-3.4\Release\gen3
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I. -Isrc -IC:\SDL2\include -IC:\SDL\src -IC:\SDL2\include -IC:\SDL\src -IC:\Python34\include -IC:\Python34\include /Tcgen3\pygame_sdl2.error.c /Fobuild\temp.win32-3.4\Release\gen3\pygame_sdl2.error.obj
pygame_sdl2.error.c
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python34\libs /LIBPATH:C:\Python34\PCbuild /EXPORT:PyInit_error build\temp.win32-3.4\Release\gen3\pygame_sdl2.error.obj /OUT:build\lib.win32-3.4\pygame_sdl2\error.pyd /IMPLIB:build\temp.win32-3.4\Release\gen3\error.lib /MANIFESTFILE:build\temp.win32-3.4\Release\gen3\error.pyd.manifest
   Creating library build\temp.win32-3.4\Release\gen3\error.lib and object build\temp.win32-3.4\Release\gen3\error.exp
pygame_sdl2.error.obj : error LNK2019: unresolved external symbol _SDL_GetError referenced in function ___pyx_pf_11pygame_sdl2_5error_5error___init__
pygame_sdl2.error.obj : error LNK2019: unresolved external symbol _SDL_SetError referenced in function ___pyx_pf_11pygame_sdl2_5error_2set_error
build\lib.win32-3.4\pygame_sdl2\error.pyd : fatal error LNK1120: 2 unresolved externals
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\BIN\\link.exe' failed with exit status 1120 

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

I don't know how to build SDL with MSVC. I think it's possible, and that the SDL sources have some sort of "solution file."

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

I can build the sources from the solution file, but not from the setup.py. when I build it I get a dll and a bunch of .obj files (object files).

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

Well, it finds all the SDL headers now. The problem is that it is looking for stdint.h, which isn't included in Windows, of course. I will see if I can add it and continue.

from pygame_sdl2.

kne avatar kne commented on May 16, 2024

@ironmanmark20 Did you manage to get this going? I started building conda packages of pygame_sdl2 for Linux and OS X which seem to work well, but I'm not having much luck on Windows.

For reference, my prebuilt packages: https://anaconda.org/kne/pygame_sdl2/files
And the conda recipe: https://github.com/kne/conda-recipes/tree/master/pygame_sdl2/dev

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

@kne , no I had no success, unfortunately, I will try again, because honestly I've forgotten what stopped me. If your interested, maybe we can work out the problems together.

It looks like it may be toublesome to get some of the dependencies like libpng, but I'll do my best.

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

At least from my perspective, the problem isn't so much building on windows - I do that nightly for Ren'Py. It's figuring out how to place the SDL2 DLLs in the right place so Python can find them.

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

@renpytom Ah, I see. Could you provide an explanation of how you have it set up?

kne and I don't find it particularly obvious.

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

It's pretty easy to get things compiled - I use gcc on windows to compile all the dependencies, then SDL2, then pygame. For Ren'Py, I then use a packaging script to build a python distribution that has all the files in the right place - but that's not a general solution.

from pygame_sdl2.

kne avatar kne commented on May 16, 2024

If we're being honest, I think, 'easy' is when you can rely on a package manager for all the dependencies and not have to manage and compile them yourself. Unfortunately, we don't get that with Windows.

@renpytom Would you be able to at least list the dependencies and their version numbers you use for SDL2? Once I get it going with my conda recipe, I can put together some build instructions. I don't think the DLL location should be an issue for conda, at least.

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

I spent today getting a way to build pygame_sdl2 on windows set up. It should now be possible to build by cloning renpy/pygame_sdl2, by cloning renpy/pygame_sdl2_windeps into it (so the directory pygame_sdl2/pygame_sdl2_windeps exists), and then simply doing:

python setup.py build

So far, I've only tried getting this working with 32-bit Python 3.5 on Windows 10, using Visual Studio 2015. I'd appreciate feedback from anyone who gets this working or fails.

Python 2.7 should work as well, but I'm getting an error about a missing vcvarsall.bat that is preventing me from building any Python binary there using MSVC. (I suspect it's an easy fix, but I need to call it a night.)

from pygame_sdl2.

kne avatar kne commented on May 16, 2024

@renpytom - great! Thanks for spending the time to put that together. I'll try to get you some feedback soon.

As far as Visual Studio goes, from what I've read (and personal experience poking around getting the other packages to build) you need VS 2008 for Python 2.7 and VS 2010 for Python 3.x (the ABI changed significantly between those versions and as such they're incompatible). In addition to that, you need the Windows SDK for each to get the respective x64 compilers. vcvarsall then has a bug in which it looks for the wrong amd64 batch file and it needs modification for both versions. It's a really ugly process altogether...

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

@renpytom that rocks! I think the only major issue for 2.7 is that if you build for VC9 (Visual Studio 2008) it is missing stdint.h, but 2010 and higher have it. The solution for your missing vcvarsall is to install the Python tools for VS 2008.here.

And you added it, thanks!

from pygame_sdl2.

Thraka avatar Thraka commented on May 16, 2024

Anyone have a windows build for download? I hate having to install tons of dependencies just to build a file 😭 Thanks!

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

What python are you running? I have some experimental wheels building.

from pygame_sdl2.

Thraka avatar Thraka commented on May 16, 2024

The latest from the website

edit: 3.5.1

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

32 or 64-bit?

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

@renpytom while you are at it, could you do Python 2.7 32bit? I would greatly appreciate it!

from pygame_sdl2.

Thraka avatar Thraka commented on May 16, 2024

32 right now, any real reason to run 64?

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

@Thraka I know some people do so for eg, C extensions. If I have a library that is x86-64, then Python should be too. Some Python programs have very high memory usage, so people use it for that too.

from pygame_sdl2.

Thraka avatar Thraka commented on May 16, 2024

@ironmanmark20 Sure I can see that on data analysis and number crunching, but not for gaming :) But who knows I may be wrong :P

from pygame_sdl2.

renpytom avatar renpytom commented on May 16, 2024

We are now producing nightly builds of pygame_sdl2 at:

http://nightly.renpy.org/pygame_sdl2/

This includes wheels for 32- and 64-bit versions of Python 2.7 and Python 3.5. I've also added windows build instructions to the README file. So I think I can, finally, close this bug.

Please let me know if this works out for everyone.

from pygame_sdl2.

ethanhs avatar ethanhs commented on May 16, 2024

Thanks so much @renpytom, that looks great! Downloading now.

from pygame_sdl2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.