recastlib icon indicating copy to clipboard operation
recastlib copied to clipboard

how to install

Open mimooh opened this issue 7 years ago • 17 comments

Hi, is this a working solution? How can I install it?

mimooh avatar Jul 03 '18 21:07 mimooh

I think it's still available, because it had been used in production for years, even though it has not been updated for a long time. How to install:

# install boost-python, for debian or ubuntu
apt-get install libboost-python-dev
# install boost-python, for centos or fedora
yum install boost-devel boost-python

# clone source code
git clone https://github.com/layzerar/recastlib.git
cd recastlib
# patch the recast code
cp -rf ./Recast\(Patched\)/Detour/ ./Recast/
# build and install
python setup.py install
# test
cd examples && python simpletest.py

PS: If you want to use this library for Unity3D's NavMesh.asset, you should checkout the branch unity3d.

layzerar avatar Jul 04 '18 01:07 layzerar

d:recastlib$ python setup.py install running install running build running build_ext running install_lib running install_egg_info Removing /usr/local/lib/python2.7/dist-packages/_recast-0.0.0.egg-info Writing /usr/local/lib/python2.7/dist-packages/_recast-0.0.0.egg-info d:recastlib$ cd examples && python simpletest.py Traceback (most recent call last): File "simpletest.py", line 8, in import recast as dt File "/home/mimooh/recastlib/examples/recast.py", line 1, in from _recast import * ImportError: /usr/local/lib/python2.7/dist-packages/_recast.so: undefined symbol: _ZNK13dtQueryFilter10passFilterEjPK10dtMeshTilePK6dtPoly

mimooh avatar Jul 04 '18 09:07 mimooh

@mimooh Sorry, I leave out one step.

# install boost-python, for debian or ubuntu
apt-get install libboost-python-dev
# install boost-python, for centos or fedora
yum install boost-devel boost-python

# clone source code
git clone https://github.com/layzerar/recastlib.git
cd recastlib
# patch the recast code
cp -rf ./Recast\(Patched\)/Detour/ ./Recast/
# build and install
python setup.py install
# test
cd examples && python simpletest.py

layzerar avatar Jul 05 '18 11:07 layzerar

You may also need clean current working tree by running git clean -xfd before you rebuild the module.

layzerar avatar Jul 05 '18 11:07 layzerar

No way! This is working! You wouldn't believe how much time I've spent trying to bring recastdetour into python! There are c++, js, go solutions, but I just couldn't make any progress. The simpletest.py looks easy, returned values without errors, so I'll be inspecting it, but this time I finally hope to get things going. Thanks a lot!

On 05/07/2018, Mel Ts [email protected] wrote:

You may also need clean current working tree by running git clean -xfd before you rebuild the module.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/layzerar/recastlib/issues/1#issuecomment-402689732

mimooh avatar Jul 05 '18 11:07 mimooh

Two questions first:

  1. What would it take to support python3? Could you make it perhaps? :)

  2. Can this package create the navmesh from geometry? Well, I have another tool which produces the binary navmesh from an obj file, but I just hope that binary will be compatible with whatever your package requires as the navmesh input.

On 05/07/2018, Karol Krenski [email protected] wrote:

No way! This is working! You wouldn't believe how much time I've spent trying to bring recastdetour into python! There are c++, js, go solutions, but I just couldn't make any progress. The simpletest.py looks easy, returned values without errors, so I'll be inspecting it, but this time I finally hope to get things going. Thanks a lot!

On 05/07/2018, Mel Ts [email protected] wrote:

You may also need clean current working tree by running git clean -xfd before you rebuild the module.

-- You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub: https://github.com/layzerar/recastlib/issues/1#issuecomment-402689732

mimooh avatar Jul 05 '18 12:07 mimooh

Congratulations!

  1. What would it take to support python3? Could you make it perhaps? :)

Since the glue layer of this project is depending on the Boost-Python, and Boost-Python support Python 3 since version 1.41. Most likely it could work with just adapt simpletest.py to Python 3. It's quite a simple task.

  1. Can this package create the navmesh from geometry? Well, I have another tool which produces the binary navmesh from an obj file, but I just hope that binary will be compatible with whatever your package requires as the navmesh input.

Short answer is no, this package only ported the query APIs of RecastNavigation, such as path finding, raycast etc. Fortunately the master branch could load mesh data generated by RecastDemo, you can get RecastDemo from the original RecastNavigation project. And the unity3d branch could load mesh data(NavMesh.asset file) generated by Unity3D. So you can choose one of them.

layzerar avatar Jul 06 '18 04:07 layzerar

I managed to succesfully load into simpletest.py a binary navmesh produced by this tool: https://github.com/arl/go-detour, so it works!

I converted the simpletest.py to python3, but I ran into: mimooh:examples$ python3 simpletest3.py Traceback (most recent call last): File "simpletest3.py", line 8, in import recast as dt File "/home/mimooh/aa/recastlib/examples/recast.py", line 1, in from _recast import * ImportError: /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.58.0: undefined symbol: PyClass_Type

Is this severe, or is there an easy fix?

mimooh avatar Jul 06 '18 09:07 mimooh

It is likely my python3 libboost problem may be general for my Ubuntu 16.04, not your package: https://stackoverflow.com/questions/5539557/boost-and-python-3-x/21460832

I will upgrade to ubuntu 18.04 and report if it fixes the issue.

mimooh avatar Jul 06 '18 10:07 mimooh

Hmmm, doesn't work under ubuntu 18.04. Is it more linux/liboost issue, or your package issue?

lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04 LTS Release: 18.04 Codename: bionic

python3 simpletest.py Traceback (most recent call last): File "simpletest.py", line 8, in import recast as dt File "/home/mimooh/recastlib/examples/recast.py", line 1, in from _recast import * ImportError: /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.65.1: undefined symbol: PyClass_Type

mimooh avatar Jul 06 '18 12:07 mimooh

The recent releases of Ubuntu or Debian contain multiple version of Python. So you may need to change the link flags in setup.py manually if the setup script cann't find the correct version of Boost-Python. For example, you should change the line libraries += ['boost_python'] in setup.py to libraries += ['boost_python-py35'] on Debian Stretch.

layzerar avatar Jul 07 '18 03:07 layzerar

Just update, should be compiled on Python 3.

layzerar avatar Jul 07 '18 05:07 layzerar

Awesome, you libboost wizard! Except it didn't work initially for me, and this fix was needed: if sys.version_info[0] == 3:

  • libraries += ['boost_python3']
  • libraries += ['boost_python-py35']

UPDATE: Various ubuntus have various libboost files. Just make sure there is /usr/lib/x86_64-linux-gnu/libboost_python3.so present (a link to py35 or py37 etc) and then libraries += ['boost_python3'] will do.

mimooh avatar Jul 07 '18 12:07 mimooh

Hi, thanks again for your code. I managed to integrate it in my project and this extremally valuable for us! However, it fails at some more complex geometries. I compare the results against the original and fresh RecastDemo and the orignal seems to handle things better. I guess they have improved the algorithms over these 5 or so years. Hence my question: would would it take to have python+boost+current Recast? I mean, could you try? :)

mimooh avatar Dec 15 '18 14:12 mimooh

Well, it works, no need for a fresher recastDetour code. I thought the navmesh would not always reach from src to dst, but it was only due to max limit of hops (which serves to improve performance). Thanks again, for this lovely piece of code and for making it opensource! We use it in https://github.com/aamks/aamks.

mimooh avatar Dec 18 '18 16:12 mimooh

hello, I have a problem when i run "pythonsimpletest.py " "_recast.cpython-36m-x86_64-linux-gnu.so: undefined symbol: _ZNK13dtQueryFilter10passFilterEjPK10dtMeshTilePK6dtPoly", What happened?

djy4713 avatar Jun 25 '19 08:06 djy4713

@djy4713 please see https://github.com/layzerar/recastlib/issues/1#issuecomment-402687318

layzerar avatar Jun 28 '19 07:06 layzerar