It is currently Sat Aug 22, 2020 4:28 am


All times are UTC




Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next
Author Message
 Post subject: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sat May 21, 2011 10:15 pm 

Joined: Sat May 21, 2011 7:47 pm
Posts: 6
I'm having trouble building PolyVox and the bindings successfully.

I'm using MSVC 2008, Python 2.6, SWIG 2.0.3 and Boost 1.46.1

I downloaded PolyVox-SVN1440.zip from the download page.

I had to change MeshDecimator, it uses cbegin() and cend(). These had to be changed to the normal begin() and end().
I then uncommented the CMake command to build the bindings.

I can build this in MSVC successfully. But swig fails when generating the bindings.

Afterward I noticed your post here regarding newer version of PolyVox being broken for bindings which would confirm this. So I won't bother with this version as I want to get this up and running ASAP. I would love to help get this working but I'm not experienced with SWIG or language bindings.

The post also stated to use the previous version if bindings are important to use the previous snapshot, PolyVox-SVN1348. So I've downloaded this and tried it instead.

With this I am unable to build PolyVox in MSVC.
I get the following error:
Code:
2>AStarPathfinder.cpp
2>C:\Users\adam\workspace\c++\PolyVox-SVN1348\library\PolyVoxCore\include\AStarPathfinder.h(66) : error C2061: syntax error : identifier 'function'
2>        C:\Users\adam\workspace\c++\PolyVox-SVN1348\library\PolyVoxCore\include\AStarPathfinder.h(137) : see reference to class template instantiation 'PolyVox::AStarPathfinderParams<VoxelType>' being compiled


I inserted #error directives in the non-boost includes in TypeDef.h and can confirm that the boost includes are being used.

I'm not sure what to do about this.
If this isn't a trivial fix, is there a known version that does build with MSVC 2008 and has working Python bindings?

Thanks for your help =)


Last edited by Soulsick on Sat May 21, 2011 11:47 pm, edited 1 time in total.

Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings
PostPosted: Sat May 21, 2011 10:53 pm 

Joined: Sat May 21, 2011 7:47 pm
Posts: 6
I've been skimming through the diffs of the two verison (1348 - 1440) and can't see anything that could break AStarPathFinder, the only changes are int16 -> int32 so the error is probably from somewhere else. But I just can't see it.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sat May 21, 2011 11:47 pm 

Joined: Sat May 21, 2011 7:47 pm
Posts: 6
DERP! I just found this post
http://thermite3d.org/phpBB3/viewtopic.php?f=14&t=183

Exactly the same problem, please ignore me.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sun May 22, 2011 3:26 am 

Joined: Sat May 21, 2011 7:47 pm
Posts: 6
FYI, anyone having problems with this, I did the following:

Requires MSVC 2008, Boost, CMake, SWIG. I have MSVC 2008 fully patched.

set BOOST_ROOT env dir to the root directory of boost, generally something like "C:\Program Files (x86)\boost\boost_1_46_1"

Removed ALL OTHER python installations. Swig just selects whatever it wants, I couldn't get it to over-ride so this was the only way to actually pick what Python install I wanted to use.

Unzip PolyVox-1348

To fix the function errors generated do the following:
Edit library/PolyVoxCore/TypeDefs.h
Add this to the Boost typedefs block just above the function typedef
#include <boost/function.hpp>

Open an MSVC command prompt

cd <polyvox dir>/build
cmake -D BUILD_TESTING=OFF CMAKE_BUILD_TYPE(Release) ..
(The build type doesn't seem to do anything)

open <polyvox dir>/build/polyvox.sln

select release or debug

build PolyVoxCore
build ZERO_CHECK
reload the project when asked

Fix the include paths of the _PolyVoxCore project:
edit the _PolyVoxCore project
change the include "/include" to "<full path to PolyVox>/libraries/PolyVoxCore/include"

To fix the SWIG generated code demanding stdint.h which doesn't resolve for some reason, do the following:

create a file library/PolyVoxCore/include/stdint.h
add the following to the file:
#include <boost/cstdint.hpp>

build _PolyVoxCore

PolyVox and its bindings should now be built.


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sun May 22, 2011 9:13 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Sorry for the slow reply but I was away for the weekend. Sounds like you got it all sorted out anyway :-)

We do intend to get the SWIG bindings back into shape fairly soon, as they should be included in the SDK release. Unfortunatly, once they broke, I made the mistake of just commenting them out rather than fixing them then and there. Which meant they went slowly downhill...


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sun May 22, 2011 9:28 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
I made a few fixes to the bindings in Git but they're still not building fully due to SWIG trying to create a setter for a static const member variable. I'll have to do some investigation to work out what's causing this.

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Sun May 22, 2011 9:48 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
You might be able to use:

Code:
#ifdef SWIG
   ...
#else
   ...
#endif


to hide it from SWIG, though of course that's not a great long-term solution. What's the variable anyway? Is it public, and should it be?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Mon May 23, 2011 2:44 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
David Williams wrote:
What's the variable anyway? Is it public, and should it be?

It's PolyVox::Region::MaxRegion which is defined as a class const static. I've no idea why SWIG would be trying to define a 'setter' for it since it's obviously constant. The only similar thing I've found is that SWIG will create setters for const pointers (or perhaps pointers to const data) since semantically they're not really completely constant. I suppose that SWIG might be stupid and not know that static const is the same as const static. I'll switch them round and see if it fixes it tonight.

I don't know if it really needs to be public. I only found one other place where it was accessed but I guess the variable could be made private and a static getter defined for it.

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Mon May 23, 2011 8:43 pm 
Developer
User avatar

Joined: Sun May 11, 2008 4:29 pm
Posts: 198
Location: UK
It turns out that the order of the qualifiers does matter to SWIG so I just swapped them round. Once that's done the Python bindings partially build again so that I cam import PolyVoxCore and play around with e.g. the Vector classes. However some classes aren't being bound (such as SimpleVolume), perhaps due to the warnings I'm getting:
Code:
include/PolyVoxCore/Vector.h:78: Warning(362): operator= ignored
include/PolyVoxCore/SimpleVolume.h:61: Warning(312): Nested class not currently supported (ignored).
include/PolyVoxCore/SimpleVolume.h:131: Warning(312): Nested class not currently supported (ignored).
bindings/SimpleVolumeSampler.i:8: Error: 'Sampler' is not defined as a template. (classforward)
bindings/SimpleVolumeSampler.i:9: Error: 'Sampler' is not defined as a template. (classforward)
bindings/SurfaceExtractor.i:9: Error: Not enough template parameters specified. 2 required.
bindings/SurfaceExtractor.i:10: Error: Not enough template parameters specified. 2 required.
include/PolyVoxCore/Array.h:88: Warning(389): operator[] ignored (consider using %extend)
include/PolyVoxCore/Array.h:90: Warning(389): operator[] ignored (consider using %extend)
include/PolyVoxCore/Array.h:127: Warning(389): operator[] ignored (consider using %extend)
include/PolyVoxCore/Array.h:129: Warning(389): operator[] ignored (consider using %extend)
bindings/CubicSurfaceExtractor.i:10: Error: Not enough template parameters specified. 2 required.
bindings/CubicSurfaceExtractor.i:11: Error: Not enough template parameters specified. 2 required.
bindings/CubicSurfaceExtractorWithNormals.i:11: Error: Not enough template parameters specified. 2 required.
bindings/CubicSurfaceExtractorWithNormals.i:12: Error: Not enough template parameters specified. 2 required.
Most difficult is the second+third one -- it seems that SWIG doesn't support nested classes (which SimpleVolume::Sample is). I wonder what's the best way to progress?

_________________
Matt Williams
Linux/CMake guy


Top
Offline Profile  
Reply with quote  
 Post subject: Re: Issues building PolyVox and Python bindings [SOLVED]
PostPosted: Mon May 23, 2011 10:04 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
Hmmm... that is a problem. I think for now you should just #ifdef out the inner class so that SWIG doesn't see it. In general this inner class should be widely used, but actually I don't think the CubicSurfaceExtractorWithNormals uses it as this aims to be as simple as possible. So you should still find you can wrap that surface extractor for testing purposes.

I'll have a think about a proper solution, and maybe take a look at it at the weekend.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 31 posts ]  Go to page 1, 2, 3, 4  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net