[help] Compiling on mac OSX

3dmacuser2

13-10-2005 19:26:08

I've been trying to compile on OSX. This is using the CVS version.

I've managed to get the mapsplitter to work, and now I'm working on the plugin.

I had to change a bunch of the #includes from "ogre.h" to <Ogre/ogre.h> (and all the ones like that), but now I'm running into a few more errors.

1:
OgrePagingLandScapeIntersectionSceneQuery.cpp:51: error: 'class Ogre::PagingLandScapeSceneManager' has no member named 'getEntities'

When I look at PagingLandScapeSceneManager, getEntities() is commented out. Is there a reason it's commented out? Can I uncomment it?

2:
OgrePagingLandScapeIntersectionSceneQuery.cpp:63: error: 'class Ogre::PagingLandScapePageManager' has no member named 'getPagingLandScapeRenderOpsInBox'

Once again, the error is correct.... there is no getPagingLandScapeRenderOpsInBox.


Any ideas?
I'm sure I'll get some more errors after I get passed these, but I would love to get this working on my mac!

tuan kuranes

13-10-2005 20:21:43

"ogre.h" to <Ogre/ogre.h> : are you sure you can't change the compiler include path to Ogre instead ?

I have no getEntities nor getPagingLandScapeRenderOpsInBox calls in OgrePagingLandScapeIntersectionSceneQuery.cpp here. Double check you have latest cvs version.

Are you using Ogre CVS HEAD ? (required to compile cvs plsm2)

3dmacuser2

13-10-2005 20:35:55

Ah, I'm using Ogre 1.0.5 and I got pgsm2 from cvs on the 9th.

I'll upgrade to HEAD and update pgsm2 from cvs.

And yeah, changing the compiler include path would probably be quicker :) I'll do that next time.

Thanks!

tuan kuranes

13-10-2005 20:41:27

Ogre CVS HEAD is harder to compile (freetype and cegui version dependency changed and you must compile them on your own too.)

Perhaps you should try to compile against Ogre SDK using plsm2 SDK compatible source to save you some difficulties. (here)

3dmacuser2

13-10-2005 21:09:00

Is there a mac decompresser for .7z ? If not, would you mind sending me a copy of that in .zip or .tar.gz ?

You're right, I'm getting tons of linker errors compiling CVS HEAD.

Nevermind, found one. I'm going to try it out now.

Thanks for your help!

tuan kuranes

13-10-2005 21:15:23

does this one work http://homepage.mac.com/krmathis/ ?

3dmacuser2

13-10-2005 21:24:39

I got a 7z unarchiver at http://emulation.victoly.com/download/

Ok, so using the source in that file, I'm still getting errors:

In OgrePagingLandScapeIntersectionSceneQuery.cpp:

OgrePagingLandScapeIntersectionSceneQuery.cpp:51: error: 'class Ogre::PagingLandScapeSceneManager' has no member named 'getEntities'

OgrePagingLandScapeIntersectionSceneQuery.cpp:52: error: 'class Ogre::PagingLandScapeSceneManager' has no member named 'getEntities'

OgrePagingLandScapeIntersectionSceneQuery.cpp:63: error: 'class Ogre::PagingLandScapePageManager' has no member named 'getPagingLandScapeRenderOpsInBox'


Thanks!

tuan kuranes

13-10-2005 21:31:53

there's no getEntities calls in the plsm2 sdk compatible source...
make sure you're compiling the SDK source.

3dmacuser2

13-10-2005 21:42:50

This is the full code from OgrePagingLandScapeIntersectionSceneQuery.cpp from the .7z file you linked to:


/***************************************************************************
OgrePagingLandScapeIntersectionSceneQuery.cpp - description
-------------------
begin : Fri Aug 08 2003
copyright : (C) 2003-2005 by Jose A Milan && Tuan Kuranes
email : spoke2@supercable.es && tuan.kuranes@free.fr
***************************************************************************/

/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU Lesser General Public License as *
* published by the Free Software Foundation; either version 2 of the *
* License, or (at your option) any later version. *
* *
***************************************************************************/

#include "OgreEntity.h"

#include "OgreVector3.h"
#include "OgreColourValue.h"

#include "OgreSceneManager.h"
#include "OgreCamera.h"

#include "OgrePagingLandScapeOptions.h"

#include "OgrePagingLandScapeSceneManager.h"

#include "OgrePagingLandScapeData2DManager.h"

#include "OgrePagingLandScapeRaySceneQuery.h"
#include "OgrePagingLandScapeIntersectionSceneQuery.h"
#include "OgrePagingLandScapeCamera.h"
#include "OgrePagingLandScapePageManager.h"
#include "OgrePagingLandScapePage.h"

namespace Ogre
{

//----------------------------------------------------------------------------
void PagingLandScapeIntersectionSceneQuery::execute(IntersectionSceneQueryListener* listener)
{
// Do movables to movables as before
DefaultIntersectionSceneQuery::execute(listener);
SceneQuery::WorldFragment frag;

// Do entities to world
SceneManager::EntityList::const_iterator a, theEnd;
PagingLandScapeSceneManager *sceneMgr = static_cast<PagingLandScapeSceneManager*>(mParentSceneMgr);
theEnd = sceneMgr->getEntities().end();
for (a = sceneMgr->getEntities().begin();
a != theEnd;
++a)
{
// Apply mask
if ( a->second->getQueryFlags() & mQueryMask)
{
const AxisAlignedBox& box = a->second->getWorldBoundingBox();
std::list<RenderOperation> opList;


PagingLandScapePageManager::getSingleton().getPagingLandScapeRenderOpsInBox (box, opList);


std::list<RenderOperation>::iterator i, iend;
iend = opList.end();
for (i = opList.begin(); i != iend; ++i)
{
frag.fragmentType = SceneQuery::WFT_RENDER_OPERATION;
frag.renderOp = &(*i);
listener->queryResult(a->second, &frag);
}
}
}
}

} // namespace Ogre




And here's getEntities:


...
theEnd = sceneMgr->getEntities().end();
for (a = sceneMgr->getEntities().begin();
a != theEnd;
++a)
...

tuan kuranes

13-10-2005 21:46:55

My fault. This file is not meant to be compiled. I should have removed it from the cvs and distribution for ages.. sorry.

Check the vcproj file with a text editor to make sure you didn't include non compilable files. (it should be the only one...)

3dmacuser2

13-10-2005 22:02:28

Edit: Sorry, just had to include a more recent copy of stl_heap.h!

Edit2: Spoke too soon!

I'm getting errors now in OgrePagingLandScapeOcclusion.cpp

/usr/include/gcc/darwin/4.0/c++/bits/stl_heap.h:279: error: no match for call to '(Ogre::FrontToBackNodeSorterOperator) (Ogre::OcclusionElement*&, Ogre::OcclusionElement*&)'

/usr/include/gcc/darwin/4.0/c++/bits/stl_heap.h:166: error: no match for call to '(Ogre::FrontToBackNodeSorterOperator) (Ogre::OcclusionElement*&, Ogre::OcclusionElement*&)'


I'm confused by this... I don't see where stl_heap.h is even getting called from.

The lines in OgrePagingLandScapeOcclusion.cpp seem to be:


void Occlusion::CHCtraversal(PagingLandScapeOctree *octree)
{
if (mIsQueryPoolNotInitiated)
initQueryPool ();

const Vector3 &camPos = mCurrentCam->getPosition();
FrontToBackNodeSorterPriorityQueue traversalStack = FrontToBackNodeSorterPriorityQueue(FrontToBackNodeSorterOperator (camPos));


and:


//this is the algorithm from the paper, conservative way.
void Occlusion::CHCtraversalConservative(PagingLandScapeOctree *octree)
{
if (mIsQueryPoolNotInitiated)
initQueryPool ();

const Vector3 &camPos = mCurrentCam->getPosition();
FrontToBackNodeSorterPriorityQueue traversalStack = FrontToBackNodeSorterPriorityQueue(FrontToBackNodeSorterOperator (camPos));

3dmacuser2

13-10-2005 22:43:14

Is the problem in OgrePagingLandScapeOcclusionSorter.h ?


namespace Ogre
{

//comparator for priority queue
class FrontToBackNodeSorterOperator
{

public:
FrontToBackNodeSorterOperator(const Vector3& position) : pos(position) {};
inline bool operator()(const OcclusionElement*& a, const OcclusionElement*& b) const
{
// could check if both distance == 0 then order visible first ?
return vectorToBoxDistance (*a, pos) > vectorToBoxDistance (*b, pos);
}


I've got to admit that I am very inexperienced with C++, but shouldn't there be some code between the brackets there? Is this why it won't compile?

tuan kuranes

14-10-2005 07:41:36

it's stl related problem.
FrontToBackNodeSorterOperator is the comparator for a Priority Queue (which can be based on a heap, depending on STL implementations).

So problem in this stl implementation seems to be the const qualifier of the parameters :

try changing this

inline bool operator()(const OcclusionElement*& a, const OcclusionElement*& b) const

into this

inline bool operator()(OcclusionElement*& a, OcclusionElement*& b)

3dmacuser2

15-10-2005 22:47:01

Great! That worked!

So, onto the next error :)

Thanks again for all this help, when I get it all working, if you want I'll add all these changes to CVS so it will be mac compatible.

So the next error is :

OgrePagingLandScapeOctreeSceneManager.cpp:1002: error: no matching function for call to 'Ogre::PagingLandScapeOctree::traversal(Ogre::ViewFrustumCullingTraversalDirect)'

Refering to this line:

case VIEW_FRUSTUM_DIRECT:
{
mPagingLandScapeOctree->traversal (ViewFrustumCullingTraversalDirect (mOcclusion));



What do you think?

tuan kuranes

16-10-2005 13:12:57

ViewFrustumCullingTraversalDirect temp (mOcclusion);
mPagingLandScapeOctree->traversal (temp);

3dmacuser2

17-10-2005 01:54:11

Awesome!

I had to make some more changes, add some declarations and casts, and get rid of some identical symbols, but I managed to get it to compile and link!

I'll let you know if I can get the samples working :)

tuan kuranes

17-10-2005 08:48:51

Please post patches.

On Vc 7.1 there's not even a warning on the whole compilation...

As compilers have differents features and bugs, it's hard to make cross platform compiling effective without having the platform, that's why I need platform contributors.

3dmacuser2

17-10-2005 19:17:50

Ok, here's the error I'm reachin while compiling the sample:


Terrainlistener.h:43: error: no match for 'operator=' in 'i = ((CustomPagingLandscapeListener*)this)->CustomPagingLandscapeListener::mStaticGeometryList. std::map<_Key, _Tp, _Compare, _Alloc>::erase [with _Key = Ogre::String, _Tp = Ogre::StaticGeometry*, _Compare = std::less<Ogre::String>, _Alloc = std::allocator<std::pair<const Ogre::String, Ogre::StaticGeometry*> >](i)'


Occuring on this section:


virtual ~CustomPagingLandscapeListener ()
{
StaticGeometryList::iterator i = mStaticGeometryList.begin ();
while (i != mStaticGeometryList.end())
{
mSceneMgr->removeStaticGeometry(i->second);
i = mStaticGeometryList.erase(i);
//++i;
}
mStaticGeometryList.clear();
}

tuan kuranes

18-10-2005 07:24:41

new CVS just fixed that.

you can safely remove the erase line and uncomment the ++i.

3dmacuser2

18-10-2005 18:39:56

Ok, I got the samples to compile.

Unfortunately, it doesn't run. Here's ogre.log:


[Session started at 2005-10-18 10:26:05 -0700.]
Creating resource group General
Registering ResourceManager for type Material
Registering ResourceManager for type Mesh
Registering ResourceManager for type Skeleton
Loading library OgrePlatform.bundle
OverlayElementFactory for type Panel registered.
OverlayElementFactory for type BorderPanel registered.
OverlayElementFactory for type TextArea registered.
Registering ResourceManager for type Font
ArchiveFactory for archive type FileSystem registered.
ArchiveFactory for archive type Zip registered.
DevIL version: Developer's Image Library (DevIL) 1.6.5
DevIL image formats: bmp dib cut dcx dds gif ico cur jpg jpe jpeg lif mdl mng jng pcx pic pix png pbm pgm pnm ppm psd pdd psp pxr sgi bw rgb rgba tga vda icb vst tif tiff wal xpm raw
Registering ResourceManager for type HighLevelGpuProgram
Loading library RenderSystem_GL
OpenGL Rendering Subsystem created.
Loading library Plugin_ParticleFX
Particle Emitter Type 'Point' registered
Particle Emitter Type 'Box' registered
Particle Emitter Type 'Ellipsoid' registered
Particle Emitter Type 'Cylinder' registered
Particle Emitter Type 'Ring' registered
Particle Emitter Type 'HollowEllipsoid' registered
Particle Affector Type 'LinearForce' registered
Particle Affector Type 'ColourFader' registered
Particle Affector Type 'ColourFader2' registered
Particle Affector Type 'ColourImage' registered
Particle Affector Type 'ColourInterpolator' registered
Particle Affector Type 'Scaler' registered
Particle Affector Type 'Rotator' registered
Loading library Plugin_BSPSceneManager
Registering ResourceManager for type BspLevel
Loading library Plugin_OctreeSceneManager
TerrainSceneManager: Registered a new PageSource for type Heightmap
Loading library Plugin_CgProgramManager
Loading library Plugin_PagingLandScapeSceneManager2
Termination handler: uncaught exception!
*-*-* OGRE Shutdown
*** ERROR: An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 9
Function: DynLib::load
Description: Could not load dynamic library Plugin_PagingLandScapeSceneManager2. System Error: Unknown Error.
File: /Users/natmartin/Projects/ogre_cvs/ogrenew/Mac/XCode/Ogre/../../../OgreMain/src/OgreDynLib.cpp
Line: 82
Stack unwinding: <<beginning of stack>>

PagingLandscapeTest has exited with status 255.

tuan kuranes

18-10-2005 19:51:49

Is plugins.cfg pointing to the good pslm2 plugin position in the filesystem ?

3dmacuser2

18-10-2005 23:02:57

Ah, it was a capitalization problem (I was using Landscape instead of LandScape)

I'm almost there, and this sounds like an ogre error now.... I'll keep working on it:

Parsing script Splatting6.material
Parsing script Splatting7.material
Parsing script SplattingShader.material
Parsing script PagingLandScape.overlay
Parsing script PagingLandScape2.overlay
Finished parsing scripts for resource group PLSM2
Texture: flare.png: Loading 1 faces(PF_R8G8B8,256x256x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
WARNING: Mesh instance 'grassblades' was defined as manually loaded, but no manual loader was provided. This Resource will be lost if it has to be reloaded.
Texture: cursor.png: Loading 1 faces(PF_R8G8B8A8,32x32x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,32x32x1.
/Users/natmartin/Projects/ogre_cvs/ogrenew/Mac/XCode/Ogre/../../../PlatformManagers/SDL/src/OgreSDLInput.cpp:352: failed assertion `mKeyboardBuffer && "SDLInput::isKeyDownImmediate called before SDLInput::capture has initialized it"'

PagingLandscapeTest has exited due to signal 6 (SIGABRT).

3dmacuser2

18-10-2005 23:19:32

OK, I just had to change the location of mInputDevice->capture();

Now, I actually got far enough that I saw some blue sky for a second!

Then it crashed with this:

Mesh: Loading MySecondTree.mesh.
Texture: tree1leaves.png: Loading 1 faces(PF_R8G8B8A8,256x256x1) with 5 hardware generated mipmaps from Image. Internal format is PF_A8R8G8B8,256x256x1.
Texture: tree1wood.jpg: Loading 1 faces(PF_R8G8B8,256x256x1) with 5 hardware generated mipmaps from Image. Internal format is PF_X8R8G8B8,256x256x1.
Termination handler: uncaught exception!
/Users/natmartin/Projects/ogre_cvs/ogrenew/Mac/XCode/Ogre/../../../OgreMain/src/OgreMemoryManager.cpp:1091: failed assertion `au != __null'

PagingLandscapeTest has exited due to signal 6 (SIGABRT).


Any ideas?

3dmacuser2

19-10-2005 01:17:19

I thought the error might be because I hadn't run the mapsplitter yet. When I run the mapsplitter, with all the cfg files in the same directory as it, I get this error:


nmartin:~/Downloads/OgreSDK/media/datasrcs natmartin$ ./MapSplitter
Testing libpng version 1.2.5
with zlib version 1.1.3

libpng version 1.2.5 - October 3, 2002
Copyright (c) 1998-2002 Glenn Randers-Pehrson
Copyright (c) 1996-1997 Andreas Dilger
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
library (10205): libpng version 1.2.5 - October 3, 2002 (header)
pngtest (10205): libpng version 1.2.5 - October 3, 2002 (header)
sizeof(png_struct)=1312, sizeof(png_info)=288
Testing pngtest.png:Could not find input file pngtest.png
Testing pngtest.png: FAIL
Testing pngtest.png:Could not find input file pngtest.png
Testing pngtest.png: FAIL
Testing pngtest.png:Could not find input file pngtest.png
FAIL

tuan kuranes

19-10-2005 07:36:34

Yes you have to run it prior to demo. but it shouldn't crash. can you post the stack ?

that's not './MapSplitter' output but 'pngtest' output !?

3dmacuser2

19-10-2005 20:52:42

How can I get the stack after it crashes?

Yeah, I expected that if I ran without runing mapsplitter it would give me some sort of error, but I expected it to relate to resources, not a memory crash.


And as for mapsplitter, that's exactly what gets printed in my terminal when I run mapsplitter. Do you have any idea why it would be running pngtest instead? Does it do a pngtest first or something?

tuan kuranes

19-10-2005 21:10:16

about stack gdb should give it to you when segfault happens ?

don't know if it exist in osx but you can try

which MapSplitter
locate MapSplitter
ldd MapSplitter

and post output fo each of these

3dmacuser2

19-10-2005 21:18:26

nmartin:~/Downloads/OgreSDK/media/datasrcs natmartin$ which MapSplitter
/usr/bin/MapSplitter



locate MapSplitter gives the location of every file which contains MapSplitter.... and that's a lot.

And ldd doesn't exist.


Trying GDB when I have a chance.

tuan kuranes

20-10-2005 04:50:06

/usr/bin/MapSplitter ? that's rather strange.


and does locate MapSplitter gives a location where Plugins.cfg is too ?
(locate Plugins.cfg)
if yes this is the MapSplitter to run.

3dmacuser2

20-10-2005 19:35:52

That's just where I placed MapSplitter.

I first tried it in the same directory as plugins.cfg and all the datasrcs.
It did the same thing in both places.

tuan kuranes

20-10-2005 20:35:55

mapsplitter should be in the same director as paginglandscapedemo near resources.cfg, plugins.cfg, etc...

could you run gdb on mapsplitter et see where it goes ?

tiennou

08-11-2005 10:51:32

Hi there !

I'm trying to compile PLSM from CVS, I got Ogre CVS Head and it almost compile. I just get one error :
(I am not at my own computer now, but I remember)

In filetutil.c :
free was not declared in this scope.

I changed the #include <malloc.h> to <malloc/malloc.h> (that's the default place on Mac and ifdef'ed __APPLE__ to be sure.
Now I don't really know what to do, that's the only place I've seen this error (Ogre compiled just fine).

If someone could give me light on this, thanks ;-)

tuan kuranes

08-11-2005 15:43:07

try enclosing functions prototype in fileutils.h and functions in in fileutils.cpp with


#ifdef __cplusplus
extern "C" {
#endif


function, functions headers.

#ifdef __cplusplus
}/* end extern C definitions */
#endif

tiennou

09-11-2005 16:22:08

OK, I found out that I was building an Application instead of a bundle, so now everything compiles fine. I just get a batch of warnings that seems to appear more than once, and I'm wondering if it's correct or not.

Here are they :
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreController.h: In instantiation of 'Ogre::ControllerFunction<Ogre::Real>':
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgrePredefinedControllers.h:157: instantiated from here
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreController.h:48: warning: 'class Ogre::ControllerFunction<Ogre::Real>' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgrePredefinedControllers.h:158: warning: 'class Ogre::AnimationControllerFunction' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgrePredefinedControllers.h:180: warning: 'class Ogre::ScaleControllerFunction' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgrePredefinedControllers.h:220: warning: 'class Ogre::WaveformControllerFunction' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreEventTarget.h:50: warning: 'class Ogre::EventTarget' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgrePositionTarget.h:48: warning: 'class Ogre::PositionTarget' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreRenderQueueListener.h:48: warning: 'class Ogre::RenderQueueListener' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreRenderTargetListener.h:69: warning: 'class Ogre::RenderTargetListener' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogrenew/OgreMain/include/OgreCompositorChain.h:142: warning: 'class Ogre::CompositorChain::RQListener' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapeOcclusionTraversal.h:11: warning: 'class Ogre::ConstTraversalConst' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapeOcclusionTraversal.h:22: warning: 'class Ogre::TraversalConst' has virtual functions but non-virtual destructor
/Volumes/myExtHD/SourceCode/ogreaddons/paginglandscape/PlugIns/PagingLandScape2/include/OgrePagingLandScapeOcclusionTraversal.h:33: warning: 'class Ogre::Traversal' has virtual functions but non-virtual destructor


Now I'm trying to build the Samples. I'm having problem with the things to build. There are two things called MapEditor, and I don't understand what's the difference between them.

Thanks...

tuan kuranes

09-11-2005 16:32:59

mapeditor is a broken till end of the month gui map - object - etc...
and maplsplitter is needed to convert any map into a PLSM2 paged map.

tiennou

14-11-2005 16:08:15

I managed to compile the PagingLandscapeSceneManager Plugin. I tried to run it using a small sample application (empty from tutorials), but I get an exception from Ogre when I try to run it... (DynLib::**I don't remember**).
Is there something else I need to add to get it running ?

What do I need (what files from the source) to compile the MapSplitter ?

Thanks

tuan kuranes

15-11-2005 08:20:49

do you have a correct plugins.cfg, resources.cfg ?

ave a look at makefile.am or vcproj files in a text editor to get file list.