Hi, I am a high school teacher. I teach Python and C++. I want to teach making simple video games using SFML's python binding. But I noticed there are 2 versions based on SFML2. Which one is recommended?
python-sfml (
http://python-sfml.org/index.html)
pysfml-cython (
http://pysfml2-cython.readthedocs.org/en/latest/)
I have tried to build both. I was successful with the second one (bastienleonard) version. But I have problems building the first one (Sonkun). Here is my info
CentOS 6.4 x86_64
gcc-4.4.7
Python 2.6.6
cmake-2.8.4
Cython-0.17.1
(the setup.py file uses dict comprehension which is 2.7+ feature, so I edited the file
# sources = {k: v.replace('cpp', 'pyx') for k, v in sources.items()}
sources = dict([(k, v.replace('cpp', 'pyx')) for k, v in sources.items()])
#files = {root: [os.path.join(root, fname) for fname in fnames] for root, dirs, fnames in os.walk('include')}
files = dict([(root, [os.path.join(root, fname) for fname in fnames]) for root, dirs, fnames in os.walk('include')])
but I get the following error
$python setup.py build
running build
running build_py
creating build/lib.linux-x86_64-2.6
creating build/lib.linux-x86_64-2.6/sfml
copying src/sfml/__init__.py -> build/lib.linux-x86_64-2.6/sfml
running build_ext
skipping 'src/sfml/system.cpp' Cython extension (up-to-date)
building 'sfml.system' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iinclude -Isrc/sfml -I/usr/include/python2.6 -c src/sfml/system.cpp -o build/temp.linux-x86_64-2.6/src/sfml/system.o
src/sfml/system.cpp:7415: warning: ‘PyObject* __pyx_pw_4sfml_6system_7Vector3_25__div__(PyObject*, PyObject*)’ defined but not used
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iinclude -Isrc/sfml -I/usr/include/python2.6 -c src/sfml/error.cpp -o build/temp.linux-x86_64-2.6/src/sfml/error.o
g++ -pthread -shared build/temp.linux-x86_64-2.6/src/sfml/system.o build/temp.linux-x86_64-2.6/src/sfml/error.o -L/usr/lib64 -lsfml-system -lsfml-graphics -lpython2.6 -o build/lib.linux-x86_64-2.6/sfml/system.so
skipping 'src/sfml/window.cpp' Cython extension (up-to-date)
building 'sfml.window' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -Iinclude -Isrc/sfml -I/usr/include/python2.6 -c src/sfml/window.cpp -o build/temp.linux-x86_64-2.6/src/sfml/window.o
src/sfml/window.cpp:264:27: error: pysfml/system.h: No such file or directory
src/sfml/window.cpp: In function ‘PyObject* __pyx_f_6pysfml_6system_wrap_time(sf::Time*)’:
src/sfml/window.cpp:13622: error: invalid use of incomplete type ‘struct PyTimeObject’
src/sfml/window.cpp:13593: error: forward declaration of ‘struct PyTimeObject’
src/sfml/window.cpp: In function ‘void initwindow()’:
src/sfml/window.cpp:19588: error: invalid application of ‘sizeof’ to incomplete type ‘PyTimeObject’
src/sfml/window.cpp:19589: error: invalid application of ‘sizeof’ to incomplete type ‘PyVector2Object’
src/sfml/window.cpp:19590: error: invalid application of ‘sizeof’ to incomplete type ‘PyVector3Object’
error: command 'gcc' failed with exit status 1