pybox2d / pybox2d

2D Game Physics for Python
Other
481 stars 93 forks source link

Build fails with Ubuntu 14.04 and Python 3.5 #91

Closed arcady-genkin closed 4 years ago

arcady-genkin commented 7 years ago

I am trying to install "gym" package with "pip install", and box2d-py is a dependency that it requires. PIP tries to build box2d-py-2.3.1.tar.gz and fails. I have reproduced the same error by trying to build pybox2d from latest sources checked out from github. Error message below:

root@try14:/tmp/pybox2d# /local/packages/python-3.5/bin/python setup.py build
Using setuptools (version 20.10.1).
running build
running build_py
copying library/Box2D/__init__.py -> build/lib.linux-x86_64-3.5/Box2D
copying library/Box2D/Box2D.py -> build/lib.linux-x86_64-3.5/Box2D
running build_ext
building 'Box2D._Box2D' extension
swigging Box2D/Box2D.i to Box2D/Box2D_wrap.cpp
swig -python -c++ -IBox2D -small -O -includeall -ignoremissing -w201 -globals b2Globals -outdir library/Box2D -keyword -w511 -D_SWIG_KWARGS -o Box2D/Box2D_wrap.cpp Box2D/Box2D.i
Box2D/Common/b2Math.h:66: Warning(302): Identifier 'b2Vec2' redefined by %extend (ignored),
Box2D/Box2D_math.i:47: Warning(302): %extend definition of 'b2Vec2'.
Box2D/Common/b2Math.h:157: Warning(302): Identifier 'b2Vec3' redefined by %extend (ignored),
Box2D/Box2D_math.i:168: Warning(302): %extend definition of 'b2Vec3'.
Box2D/Common/b2Math.h:196: Warning(302): Identifier 'b2Mat22' redefined by %extend (ignored),
Box2D/Box2D_math.i:301: Warning(302): %extend definition of 'b2Mat22'.
Box2D/Common/b2Math.h:270: Warning(302): Identifier 'b2Mat33' redefined by %extend (ignored),
Box2D/Box2D_math.i:372: Warning(302): %extend definition of 'b2Mat33'.
Box2D/Collision/b2DynamicTree.h:43: Warning(312): Nested union not currently supported (ignored).
Box2D/Common/b2Settings.h:144: Warning(506): Can't wrap varargs with keyword arguments enabled
Box2D/Common/b2Math.h:90: Warning(509): Overloaded method b2Vec2::operator ()(int32) is shadowed by b2Vec2::operator ()(int32) const at Box2D/Common/b2Math.h:84.
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/local/packages/python-3.5/include/python3.5m -c Box2D/Box2D_wrap.cpp -o build/temp.linux-x86_64-3.5/Box2D/Box2D_wrap.o -I. -Wno-unused
cc1plus: warning: command line option '-Wstrict-prototypes' is valid for C/ObjC but not for C++ [enabled by default]
Box2D/Box2D_wrap.cpp: In function 'PyTypeObject* _PySwigObject_type()':
Box2D/Box2D_wrap.cpp:1748:3: error: invalid conversion from 'unaryfunc {aka _object* (*)(_object*)}' to 'void*' [-fpermissive]
   };
   ^
Box2D/Box2D_wrap.cpp:1773:3: error: 'cmpfunc' was not declared in this scope
  (cmpfunc)SwigPyObject_compare,     /* tp_compare */ 
   ^
Box2D/Box2D_wrap.cpp:1773:11: error: expected '}' before 'SwigPyObject_compare'
  (cmpfunc)SwigPyObject_compare,     /* tp_compare */ 
           ^
Box2D/Box2D_wrap.cpp:1773:11: error: expected ',' or ';' before 'SwigPyObject_compare'
Box2D/Box2D_wrap.cpp:1819:25: error: 'tmp' was not declared in this scope
     swigpyobject_type = tmp;
                         ^
Box2D/Box2D_wrap.cpp:1825:3: warning: no return statement in function returning non-void [-Wreturn-type]
   }
   ^
Box2D/Box2D_wrap.cpp: At global scope:
Box2D/Box2D_wrap.cpp:1826:3: error: expected unqualified-id before 'return'
   return &swigpyobject_type;
   ^
Box2D/Box2D_wrap.cpp: In function 'PyTypeObject* _PySwigPacked_type()':
Box2D/Box2D_wrap.cpp:1944:3: error: 'cmpfunc' was not declared in this scope
  (cmpfunc)SwigPyPacked_compare,     /* tp_compare */  
   ^
Box2D/Box2D_wrap.cpp:1944:11: error: expected '}' before 'SwigPyPacked_compare'
  (cmpfunc)SwigPyPacked_compare,     /* tp_compare */  
           ^
Box2D/Box2D_wrap.cpp:1944:11: error: expected ',' or ';' before 'SwigPyPacked_compare'
Box2D/Box2D_wrap.cpp:1990:25: error: 'tmp' was not declared in this scope
     swigpypacked_type = tmp;
                         ^
Box2D/Box2D_wrap.cpp:1996:3: warning: no return statement in function returning non-void [-Wreturn-type]
   }
   ^
Box2D/Box2D_wrap.cpp: At global scope:
Box2D/Box2D_wrap.cpp:1997:3: error: expected unqualified-id before 'return'
   return &swigpypacked_type;
   ^
Box2D/Box2D_wrap.cpp:1998:1: error: expected declaration before '}' token
 }
 ^
error: command 'gcc' failed with exit status 1
mbednarski commented 7 years ago

Are you sure, that you have swig installed?

arcady-genkin commented 7 years ago

Yes, I have swig. see: ` agenkin@try14:~$ dpkg -l |grep swig

ii swig 2.0.11-1ubuntu2 amd64 Generate scripting interfaces to C/C++ code ii swig2.0 2.0.11-1ubuntu2 amd64 Generate scripting interfaces to C/C++ code `

kne commented 4 years ago

I believe that swig version is too old, along with this issue. Closing for now, unless you're still struggling after 3 years.