Re: [osg-users] Mac OS runtime problem

2012-07-09 Thread Tobias Duckworth
Hi,

This problem is still present.

It seems that under MacOS OpenSceneGraph can only be built with the llvm 
compilers due to the Objective C portions of code.  I tried configuring gcc to 
compile Objective C but there appear to be some differences between the Apple 
compiler and gcc with respect to Objective C.

What I would like to do is be able to compile my application using gcc and then 
link to OpenSceneGraph - I don't really care whether OpenSceneGraph is built 
with gcc or llvm.

However, if I do build my application using gcc then it crashes.  The code 
segment can be boiled down to the following:


Code:

int main( int argc, char **argv )
{

fprintf(stderr, Creating\n);
osg::ref_ptrosg::DrawElementsUShort p = new osg::DrawElementsUShort();
fprintf(stderr, Created\n);
}




Compiled as follows:


Code:

 /opt/local/bin/gcc-mp-4.8 -o osgtest osgtest.cpp -L /usr/local/lib -losg 
-lOpenThreads -lstdc++ -I /usr/local/include/




And the crash is as follows:


Code:

Tobiass-retina-MacBook:trunk tobiasduckworth$ ./osgtest 
Creating
Created
osgtest(52671) malloc: *** error for object 0x10c7b87e0: pointer being freed 
was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6
Tobiass-retina-MacBook:trunk tobiasduckworth$ 





This problem has been present for an age, and is forcing me to use the Apple 
compilers to build my application, whereas I wish to use gcc.

Has anyone else out there experienced this problem? or have a solution to it 
please?

I would really like to be able to build my application with gcc, but due to 
this problem cannot.

... 

Thank you!

Cheers,
Tobias[/code]

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=48768#48768





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac OS runtime problem

2012-04-27 Thread Tobias Duckworth
Hi Stephan,

I tried building both release and debug versions of OSG with the llvm compiler 
- The debug build had the same problem (presumably built without optimisation).

... 

Thank you!

Cheers,
Tobias

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47353#47353





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] Mac OS runtime problem

2012-04-26 Thread Tobias Duckworth
Hi,

I'm building OpenSceneGraph from the head of the trunk on Mac OS 10.7 Lion 
using CMake.  The build works straight out of the box defaulting to the llvm 
compilers.

I'm using OpenSceneGraph in a project built using gcc-mp-4.7, and so linking to 
the libraries built in the above step from my project.

I'm experiencing a problem with primitive sets at runtime - Namely, a primitive 
set I create causes a crash when it goes out of scope.

I've managed to boil my problem down to a very simple implementation:


Code:

int main(int argc, char *argv[])
{
osg::ref_ptrosg::PrimitiveSet p = new osg::DrawElementsUByte();
return 0;
}





When executed, with the OSG libraries built using llvm, and the program built 
using gcc-mp-4.7, the following happens:


Code:

Tobys-MacBook-Pro:xxx tobiasduckworth$ ./3DRecon.app/Contents/MacOS/3DRecon 
3DRecon(23649,0x7fff7612f960) malloc: *** error for object 0x10e163ec0: pointer 
being freed was not allocated
*** set a breakpoint in malloc_error_break to debug
Abort trap: 6




However, if I build the program using the same compiler (llvm) as OSG, then it 
runs fine.

My program uses OpenMP, so I need to use gcc to get this to compile, otherwise 
I could move to llvm.

I also tried to build OSG using gcc, but this failed due to osgViewer using 
Objective C.

Does anyone have any idea what might be going wrong here?
Should I be able to build OSG using llvm and my application using gcc?

Hoping someone can shed some light,
... 

Thank you!

Cheers,
Tobias

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47314#47314





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac OS runtime problem

2012-04-26 Thread Stephan Maximilian Huber
HI,

have you tried to compile your own code and osg with the llvm-gcc4.2
compiler? llvm-gcc 4.2 should include openMP. (Haven't tested that by
myself)

HTH,
Stephan


Am 26.04.12 11:09, schrieb Tobias Duckworth:
 Hi,
 
 I'm building OpenSceneGraph from the head of the trunk on Mac OS 10.7 Lion 
 using CMake.  The build works straight out of the box defaulting to the llvm 
 compilers.
 
 I'm using OpenSceneGraph in a project built using gcc-mp-4.7, and so linking 
 to the libraries built in the above step from my project.
 
 I'm experiencing a problem with primitive sets at runtime - Namely, a 
 primitive set I create causes a crash when it goes out of scope.
 
 I've managed to boil my problem down to a very simple implementation:
 
 
 Code:
 
 int main(int argc, char *argv[])
 {
 osg::ref_ptrosg::PrimitiveSet p = new osg::DrawElementsUByte();
 return 0;
 }
 
 
 
 
 
 When executed, with the OSG libraries built using llvm, and the program built 
 using gcc-mp-4.7, the following happens:
 
 
 Code:
 
 Tobys-MacBook-Pro:xxx tobiasduckworth$ ./3DRecon.app/Contents/MacOS/3DRecon 
 3DRecon(23649,0x7fff7612f960) malloc: *** error for object 0x10e163ec0: 
 pointer being freed was not allocated
 *** set a breakpoint in malloc_error_break to debug
 Abort trap: 6
 
 
 
 
 However, if I build the program using the same compiler (llvm) as OSG, then 
 it runs fine.
 
 My program uses OpenMP, so I need to use gcc to get this to compile, 
 otherwise I could move to llvm.
 
 I also tried to build OSG using gcc, but this failed due to osgViewer using 
 Objective C.
 
 Does anyone have any idea what might be going wrong here?
 Should I be able to build OSG using llvm and my application using gcc?
 
 Hoping someone can shed some light,
 ... 
 
 Thank you!
 
 Cheers,
 Tobias
 
 --
 Read this topic online here:
 http://forum.openscenegraph.org/viewtopic.php?p=47314#47314
 
 
 
 
 
 ___
 osg-users mailing list
 osg-users@lists.openscenegraph.org
 http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac OS runtime problem

2012-04-26 Thread Tobias Duckworth
Hi Stephen,

Thanks for your response.

Yes I tried using llvm-gcc42 (from Macports) to build OSG yesterday - 
Unfortunately with the same end result.

I didn't know that llvm-gcc42 includes OpenMP, this may be a solution to my 
problem.  Thanks for the hint, I will look into it.

That aside, I'd still like to understand why compiling OSG with llvm and my 
program with gcc causes the observed problem.  Surely I shouldn't have to care 
which compiler the libraries I'm linking against are built with?



... 

Thank you!

Cheers,
Tobias

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47316#47316





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac OS runtime problem

2012-04-26 Thread Tobias Duckworth
Hi,

Further to Stephan's suggestion, since llvm-gcc-4.2 supports OpenMP, I was able 
to get everything running using llvm-gcc-4.2. (Thanks Stephan for the info that 
llvm-gcc-42 now supports OpenMP)

However, it still strikes me as odd that failure occurs when compiling my 
program with gcc and linking to OSG built with llvm.


... 

Thank you!

Cheers,
Tobias

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47319#47319





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Mac OS runtime problem

2012-04-26 Thread Stephan Huber
Hi Tobias,

Am 26.04.12 12:15, schrieb Tobias Duckworth:
 Further to Stephan's suggestion, since llvm-gcc-4.2 supports OpenMP, I was 
 able to get everything running using llvm-gcc-4.2. 
 (Thanks Stephan for the info that llvm-gcc-42 now supports OpenMP)
 
 However, it still strikes me as odd that failure occurs when compiling my 
 program with gcc and linking to OSG built with llvm.


I have no idea. I have the suspicion, that the optimization of llvm is
too aggressive (osg is compiled with -O3), but I'll have to do some more
tests.


cheers,

Stephan
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org