Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Error Building the PySFML2-cython Bindings  (Read 11096 times)

0 Members and 1 Guest are viewing this topic.

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« on: July 07, 2011, 05:55:24 pm »
As in, this: https://github.com/bastienleonard/pysfml2-cython

I get the following error(s) when running "python setup.py build_ext --inplace --compiler=mingw32":
Code: [Select]
running build_ext
skipping 'sf.cpp' Cython extension (up-to-date)
building 'sf' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o
In file included from sf.cpp:225:0:
SFML/Graphics.hpp:32:27: fatal error: SFML/Window.hpp: No such file or directory
compilation terminated.
error: command 'gcc' failed with exit status 1

That .hpp file does exist in .\SFML\, so I'm not sure why it's saying it doesn't. I'm not really sure where to go from here, so... help please?

Possible things of note:
- Win7 x64
- Cython 0.14.1 installed
- Python 2.7.2 x86 installed at C:\Python27
- SFML2 installed in C:\Program Files (x86)\SFML
- gcc 4.5.2
I got the SFML2 and PySFML2-cython code directly from the git repos today. SFML2 (seemed to) compile(d)/etc fine.

danman

  • Hero Member
  • *****
  • Posts: 1121
    • View Profile
    • Email
Error Building the PySFML2-cython Bindings
« Reply #1 on: July 08, 2011, 01:24:11 am »
Quote
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -IC:\Python27\include -IC:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o


it doesn't speak about a -I C:/Program Files ..... path, so mingw don't use it.
you may need to edit the setup script, or make a link from your SFML include and libs to your mingw installation ;) .
Pointilleur professionnel

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #2 on: July 08, 2011, 03:45:02 am »
I tried making a symlink to the appropriate directories but that didn't work either. I can't see where to edit the gcc includes for this, what file do I edit?

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #3 on: July 10, 2011, 12:21:38 am »
Nevermind, not sure why it didn't occur to me just to try and see if "--include=[...]" would work (and it did).

Edit: removed dumb question >_>

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #4 on: July 11, 2011, 07:16:19 am »
I need to not panic so easily, one month isn't that long I suppose...
---
Okay, so now I'm getting this error with the latest update:
Code: [Select]
C:\Users\NightKev\SFML2\pysfml2-cython-u1>python setup.py build_ext --inplace --compiler=mingw32 --include="c:\Program Files (x86)\SFML\include"
running build_ext
cythoning sf.pyx to sf.cpp
building 'sf' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files (x86)\SFML\include" -IC:\Python27\include -IC:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o
C:\MinGW\bin\g++.exe -mno-cygwin -mdll -static --output-lib build\temp.win32-2.7\Release\libsf.a --def build\temp.win32-2.7\Release\sf.def -s build\temp.win32-2.7\Release\sf.o -LC:\Python27\libs -LC:Python27\PCbuild -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system -lpython27 -lmsvcr90 -o C:\Users\NightKev\SFML2\pysfml2-cython-u1\sf.pyd
g++: build\temp.win32-2.7\Release\libsf.a: No such file or directory
error: command 'g++' failed with exit status 1

Adding "-LC:\Program Files (x86)\SFML\lib" didn't help. There's no libsf.a in SFML\lib anyway (should there be?).

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Error Building the PySFML2-cython Bindings
« Reply #5 on: July 11, 2011, 07:42:35 am »
Don't worry, you were right to report the problem. ;)

If I remember correctly, when I tried to compile on Windows, all I needed to do was to add the headers and libs of SFML in the directories of MinGW (should be something like include/ and lib/).

By the way, since Laurent broke a quite large part of the API, it's possible that my changes introduced some bugs. Don't hesitate to report them.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #6 on: July 13, 2011, 04:19:56 am »
Btw, still having this error :? :
Code: [Select]
$ python setup.py build_ext --inplace --compiler=mingw32 --include="c:\Program Files (x86)\SFML\include" "-LC:\program files (x86)\SFML\lib"
running build_ext
cythoning sf.pyx to sf.cpp
building 'sf' extension
creating build
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall "-Ic:\Program Files (x86)\SFML\include" -IC:\Python27\include -IC:\Python27\PC -c sf.cpp -o build\temp.win32-2.7\Release\sf.o
[snip unnecessary warnings]
writing build\temp.win32-2.7\Release\sf.def
C:\MinGW\bin\g++.exe -mno-cygwin -mdll -static --output-lib build\temp.win32-2.7\Release\libsf.a --def build\temp.win32-2.7\Release\sf.def -s build\temp.win32-2.7\Release\sf.o "-LC:\program files (x86)\SFML\lib" -LC:\Python27\libs -LC:\Python27\PCbuild -lsfml-graphics -lsfml-window -lsfml-audio -lsfml-system -lpython27 -lmsvcr90 -o C:\Users\NightKev\SFML2\pysfml2-cython-u1\sf.pyd
g++: build\temp.win32-2.7\Release\libsf.a: No such file or directory
error: command 'g++' failed with exit status 1

(Just in case the warnings I edited out are useful, full log here: http://dl.dropbox.com/u/2674926/log.txt)
Using the latest (as of now) SFML2/PySFML2 commits.

Edit: A friend suggested it might be related to some mingw32 bug with ANSI printf or something, so I tried various combinations of '__USE_MINGW_ANSI_STDIO=1' via 'extra_compile_args' and 'define_macros', but to no avail. Am I forgetting something?

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Error Building the PySFML2-cython Bindings
« Reply #7 on: July 14, 2011, 08:55:11 pm »
As I said, I simply added SFML's headers and libraries to the MinGW folders, and it worked correctly. This would probably be much easier.
But your problem may be that your command-line arguments only refer to the include directory, so the linker can't find the libraries.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #8 on: July 15, 2011, 10:46:24 am »
Even after doing that, it still fails(?) with the same errors. However, I do have two files now (sf.o and sf.def) that appear in the build folder.
I'm a bit confused...

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Error Building the PySFML2-cython Bindings
« Reply #9 on: July 19, 2011, 02:11:11 pm »
Did you try the solution I suggested? It's probably the simplest and there's no reason why it shouldn't work.
I'll try to test yours, but until then I can't really help.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #10 on: July 19, 2011, 02:43:13 pm »
Yeah, the first time I missed the part where you said to put the libraries/headers in the MinGW folders, but then even after I did that I still get the same errors (except now there seem to be two files created, sf.o and sf.def).

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Error Building the PySFML2-cython Bindings
« Reply #11 on: July 26, 2011, 02:37:39 pm »
I think I found a workaround. Go to the directory where the sf.def file was created, and type this:

Code: [Select]
dlltool --def sf.def --output-lib libsf.a

The libsf.a file will be created, and g++ should create the module correctly on the next run.

It seems that either there is a mismatch in Python and MinGW versions, or this is a bug in Python 2.7.
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #12 on: July 26, 2011, 03:24:41 pm »
Well, that worked in creating libsf.a, but now it's failing with this new error (on both runs) using the latest commit: http://dl.dropbox.com/u/2674926/pysfml2%20new%20bug.png

I'll see if using an older commit still does the same thing or not.

bastien

  • Full Member
  • ***
  • Posts: 231
    • View Profile
    • http://bastien-leonard.alwaysdata.net
Error Building the PySFML2-cython Bindings
« Reply #13 on: July 26, 2011, 03:38:04 pm »
I'm using the latest versions of SFML 2 and the binding. As far as I know, SFML doesn't use libiconv. Isn't it a problem with your MinGW installation?
Check out pysfml-cython, an up to date Python 2/3 binding for SFML 2: https://github.com/bastienleonard/pysfml-cython

NightKev

  • Newbie
  • *
  • Posts: 9
    • View Profile
    • http://fraxy.net/
Error Building the PySFML2-cython Bindings
« Reply #14 on: July 26, 2011, 03:49:08 pm »
Well I wasn't getting that error before, and my MinGW hasn't changed since then, so I'm not sure what's going on...

 

anything