Volumes Of Fun
http://www.volumesoffun.com/phpBB3/

Linux Version of PolyVox
http://www.volumesoffun.com/phpBB3/viewtopic.php?f=2&t=30
Page 1 of 2

Author:  David Williams [ Sat Mar 28, 2009 12:47 pm ]
Post subject:  Linux Version of PolyVox

I installed Kubuntu 8.10 in VirtualBox today so that I can make sure things stay working under Linux. It means I can be running Windows and Linux at the same time which should make it quicker to catch any problems which get introduced. The library did build (though I had to comment out the idle() and isHomogeneous() functions) but the example application didn't even try to build.

Matt, do you know why this is? I didn't expect the example would compile quite yet but it didn't even try... I'll have another go tomorrow.

Author:  milliams [ Sat Mar 28, 2009 1:17 pm ]
Post subject:  Re: Linux Version of PolyVox

In examples/OpenGL/CMakeLists.txt there's an "IF (WIN32)" around most of the stuff, specifically the "ADD_EXECUTABLE()" call.

About the need to comment stuff out, I think I know how to solve one of the problems but I'm not sure on the other one yet.

Author:  milliams [ Sat Mar 28, 2009 2:52 pm ]
Post subject:  Re: Linux Version of PolyVox

Ok, the two build errors seem to be:

BlockData.inl:157 references a variable(?) called firstVoxel as
Code:
if(*currentVoxel != firstVoxel)
Now, the only declaration of a 'firstVoxel' I can find is
Code:
VolumeIterator<VoxelTypefirstVoxel(void);      
which is a public method of the Volume class. However, in BlockData<VoxelType>::isHomogeneous(), it is called in its raw form, not on a Volume object. Is this a relic from the refactoring where firstVoxel used to be part of the old Block class?


The second occurs in Volume.inl:241 where is reads
Code:
Block block = m_pBlocks[i];
which, since m_pBlocks is defined as
Code:
Block<VoxelType>* m_pBlocks;
the Block needs to be
Code:
Block<VoxelType> block = m_pBlocks[i];
Does this make sense?

Author:  David Williams [ Sun Mar 29, 2009 8:46 pm ]
Post subject:  Re: Linux Version of PolyVox

milliams wrote:
In examples/OpenGL/CMakeLists.txt there's an "IF (WIN32)" around most of the stuff, specifically the "ADD_EXECUTABLE()" call.


Ah, cool, I missed that. I removed the check and it fails to compile as expected. But I can deal with that now :-) Sorry for the stupid question - I was in a hurry and thought it was easier to ask!

milliams wrote:
Is this a relic from the refactoring where firstVoxel used to be part of the old Block class?


Nope, it's even stupider than that... I decalred 'firstVal' a few lines earlier, and then tried to access it as 'firstVoxel' a few lines later. Clearly invalid code, but it compiles fine on windows because I never actually called that function and template code only gets compiled if it's actually used. So I don't know why it does get compiled on GCC, but it means I have to fix it which is good discipline anyway ;-)

Author:  milliams [ Sun Mar 29, 2009 10:32 pm ]
Post subject:  Re: Linux Version of PolyVox

David Williams wrote:
milliams wrote:
In examples/OpenGL/CMakeLists.txt there's an "IF (WIN32)" around most of the stuff, specifically the "ADD_EXECUTABLE()" call.
Ah, cool, I missed that. I removed the check and it fails to compile as expected. But I can deal with that now :-) Sorry for the stupid question - I was in a hurry and thought it was easier to ask!
That's ok. I think I've commented it out in SVN now anyway (rev. 791).

David Williams wrote:
I decalred 'firstVal' a few lines earlier, and then tried to access it as 'firstVoxel' a few lines later. Clearly invalid code, but it compiles fine on windows because I never actually called that function and template code only gets compiled if it's actually used. So I don't know why it does get compiled on GCC, but it means I have to fix it which is good discipline anyway ;-)
I can only assume it does a sort of cursory check of the code. It makes sense since there's no way (that I can think of) that any instance of the template could make that valid code. Either way, you're right that the code shuold not be compiled and from a brief search of GCC docs, it shouldn't be trying to compile that method. Whatever the reason, it's good that it's uncovered a future problem :)

Author:  David Williams [ Sun Mar 29, 2009 10:47 pm ]
Post subject:  Re: Linux Version of PolyVox

Ok, I've made some progress on Linux. It builds the library but then can't find it when linking the example:

david@david-desktop:~/thermite/trunk/PolyVox/build$ make
[ 66%] Built target PolyVoxCore
[ 66%] Built target PolyVoxUtil
Linking CXX executable OpenGLExample
/usr/bin/ld: cannot find -lPolyVoxCore.lib
collect2: ld returned 1 exit status
make[2]: *** [examples/OpenGL/OpenGLExample] Error 1
make[1]: *** [examples/OpenGL/CMakeFiles/OpenGLExample.dir/all] Error 2
make: *** [all] Error 2

Actually, it is looking for the wrong thing (.lib) extension. Any ideas?

Author:  milliams [ Sun Mar 29, 2009 11:08 pm ]
Post subject:  Re: Linux Version of PolyVox

Ahh, that's because you're doing
Code:
TARGET_LINK_LIBRARIES(OpenGLExample ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} debug PolyVoxCore_d.lib optimized PolyVoxCore.lib)
explicitly. You should only have to do
Code:
TARGET_LINK_LIBRARIES(OpenGLExample ${QT_LIBRARIES} ${OPENGL_gl_LIBRARY} debug PolyVoxCore_d optimized PolyVoxCore)
as it should find the correct file itself based on the system cmake is run on. This means you shouldn't need the LINK_DIRECTORIES() command or the ADD_DEPENDENCIES(OpenGLExample PolyVoxCore) line either as that should be implicit when you have the PolyVoxCore target in the TARGET_LINK_LIBRARIES() macro.

Author:  milliams [ Mon Mar 30, 2009 12:04 pm ]
Post subject:  Re: Linux Version of PolyVox

Ok, in the process of slowly working through the bindings I'm uncovering a few more problems like this. This is since when the bindings are created, it has to compile real instantiations of the templates so that the target languages can understand them as real types. Right now, I'm getting an error at
Code:
template <uint32 Size, typename Type>
inline bool Vector<Size, Type>::operator==(const Vector<Size, Type> &rhs) const throw()
{
  bool equal = true;
  for(uint32 ct = 0; ct < Size; ++ct)
  {
    if(m_tElements[ct] != rhs(ct))
    {
      equal = false;
      break;
    }
  }
return equal;
}
It doesn't like the 'rhs(ct)' bit (in either GCC or VS2008).

Hmm, now I've had a look, it seems that it should just be 'rhs.getElement(ct)'?

Author:  milliams [ Mon Mar 30, 2009 1:09 pm ]
Post subject:  Re: Linux Version of PolyVox

[update]
That change seems to work and then the example builds completely. However, I do get a seg fault when trying to run it. The backtrace is:
Code:
#0  0x0000000000000000 in ?? ()
#1  0x000000000043acb6 in BuildOpenGLSurfacePatch (isp=@0x71ec10)
    at /home/matt/thermite/PolyVox/examples/OpenGL/OpenGLVertexBufferObjectSupport.cpp:34
#2  0x000000000043b378 in OpenGLWidget::setVolume (this=0x7fffffffd8f0, volData=<value optimized out>)
    at /home/matt/thermite/PolyVox/examples/OpenGL/OpenGLWidget.cpp:59
#3  0x00000000004393e1 in main (argc=1, argv=0x7fffffffdb88)
    at /home/matt/thermite/PolyVox/examples/OpenGL/main.cpp:51

Author:  David Williams [ Mon Mar 30, 2009 5:32 pm ]
Post subject:  Re: Linux Version of PolyVox

milliams wrote:
Hmm, now I've had a look, it seems that it should just be 'rhs.getElement(ct)'?


Yes, but you could probably just use 'rhs.m_tElements[ct]' as it's a member of the same class. That's obviously something which got refactored but never compiled...

I'll have a look into the segfault later, it'll be great if it works under Linux!

Page 1 of 2 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/