tag 454854 patch
thanks

Hi Robert,

first some context:

On 08/12/2007, Martin Michlmayr wrote:
> Package: openscenegraph
> Version: 2.2.0-2
> Usertags: ftbfs-gcc-4.3
> 
> Your package fails to build with GCC 4.3.  Version 4.3 has not been
> released yet but I'm building with a snapshot in order to find errors
> and give people an advance warning.  In GCC 4.3, the C++ header
> dependencies have been cleaned up.  The advantage of this is that
> programs will compile faster.  The downside is that you actually need
> to directly #include everything you use (but you really should
> do this anyway, otherwise your program won't work with any compiler
> other than GCC).  There's some more information about this at
> http://www.cyrius.com/journal/2007/05/10#gcc-4.3-include
> 
> You can reproduce this problem with gcc-snapshot from unstable.  Note
> that Red Hat, Novell and Ubuntu have done some work getting packages
> to build with GCC 4.3 so there might be patches floating around
> somewhere.  I suggest you talk to your upstream.

Please find attached two patches to make osg 2.2 build with gcc 4.3.
Mostly some includes are needed. Some functions can't be static as I
understand it. And there's an extra typedef which doesn't seem to make
the build fail, but triggers many warnings while building, which is a
bit annoying; I've put this one in a separate patch for this reason.

Cheers,

-- 
Cyril Brulebois
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/DisplaySettings.cpp
      2007-12-10 15:28:11.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/DisplaySettings.cpp
      2007-12-10 15:28:21.000000000 +0100
@@ -17,6 +17,7 @@
 #include <osg/ref_ptr>
 
 #include <algorithm>
+#include <cstring>
 
 using namespace osg;
 using namespace std;
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/Image.cpp    
    2007-12-10 15:30:57.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/Image.cpp    
    2007-12-10 15:37:03.000000000 +0100
@@ -25,6 +25,9 @@
 
 #include "dxtctool.h"
 
+#include <cstring>
+#include <cstdlib>
+
 using namespace osg;
 using namespace std;
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/Notify.cpp   
    2007-12-10 15:38:58.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osg/Notify.cpp   
    2007-12-10 15:39:07.000000000 +0100
@@ -14,6 +14,7 @@
 #include <string>
 #include <iostream>
 #include <fstream>
+#include <cstdlib>
 
 using namespace std;
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/Field.cpp  
    2007-12-10 15:44:27.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/Field.cpp  
    2007-12-10 15:44:37.000000000 +0100
@@ -12,6 +12,8 @@
 */
 #include <osgDB/Field>
 
+#include <cstring>
+
 using namespace osgDB;
 using namespace std;
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/FileNameUtils.cpp
      2007-12-10 15:45:15.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/FileNameUtils.cpp
      2007-12-10 15:45:38.000000000 +0100
@@ -13,6 +13,8 @@
 #include <stdlib.h>
 #include <limits.h>
 
+#include <cstring>
+
 #include <osgDB/FileNameUtils>
 
 #ifdef WIN32
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/Registry.cpp
   2007-12-10 15:47:56.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgDB/Registry.cpp
   2007-12-10 15:48:08.000000000 +0100
@@ -29,6 +29,7 @@
 
 #include <algorithm>
 #include <set>
+#include <cstring>
 
 #if defined(__sgi)
     #include <ctype.h>
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgText/DefaultFont.cpp
      2007-12-10 15:54:35.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgText/DefaultFont.cpp
      2007-12-10 15:56:22.000000000 +0100
@@ -18,6 +18,8 @@
 
 #include <osg/Notify>
 
+#include <cstdlib>
+
 using namespace osgText;
 
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgViewer/ViewerBase.cpp
     2007-12-10 16:12:48.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgViewer/ViewerBase.cpp
     2007-12-10 16:12:57.000000000 +0100
@@ -24,6 +24,8 @@
 #include <osgUtil/IntersectionVisitor>
 #include <osgUtil/GLObjectsVisitor>
 
+#include <cstring>
+
 static osg::ApplicationUsageProxy 
ViewerBase_e0(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_CONFIG_FILE 
<filename>","Specify a viewer configuration file to load by default.");
 static osg::ApplicationUsageProxy 
ViewerBase_e1(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_THREADING 
<value>","Set the threading model using by Viewer, <value> can be 
SingleThreaded, CullDrawThreadPerContext, DrawThreadPerContext or 
CullThreadPerCameraDrawThreadPerContext.");
 static osg::ApplicationUsageProxy 
ViewerBase_e2(osg::ApplicationUsage::ENVIRONMENTAL_VARIABLE,"OSG_SCREEN 
<value>","Set the default screen that windows should open up on.");
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgViewer/ViewerEventHandlers.cpp
    2007-12-10 16:15:50.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgViewer/ViewerEventHandlers.cpp
    2007-12-10 16:15:59.000000000 +0100
@@ -12,6 +12,7 @@
 */
 
 #include <stdlib.h>
+#include <limits.h>
 
 #include <fstream>
 #include <osgViewer/Viewer>
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/hdr/hdrwriter.cpp
 2007-12-10 17:06:14.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/hdr/hdrwriter.cpp
 2007-12-10 17:06:26.000000000 +0100
@@ -32,6 +32,7 @@
 #include <string>
 #include <math.h>
 #include <ctype.h>
+#include <cstdlib>
 
 
 bool HDRWriter::writeRLE(const osg::Image *img, std::ostream& fout)
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/gdal/ReaderWriterGDAL.cpp
 2007-12-10 20:45:01.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/gdal/ReaderWriterGDAL.cpp
 2007-12-10 20:45:09.000000000 +0100
@@ -15,6 +15,8 @@
 
 #include "DataSetLayer.h"
 
+#include <memory>
+
 #define SERIALIZER() OpenThreads::ScopedLock<OpenThreads::ReentrantMutex> 
lock(_serializerMutex)  
 
 // From easyrgb.com
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/Inventor/ConvertToInventor.cpp
    2007-12-10 20:53:04.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/Inventor/ConvertToInventor.cpp
    2007-12-10 20:53:25.000000000 +0100
@@ -256,7 +256,7 @@
 
 
 template<>
-static void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 
4>(SbColor *dest, GLubyte *src, int num, int numItemsUntilMinusOne)
+void osgArray2ivMField_composite_template_worker<SbColor, GLubyte, 4>(SbColor 
*dest, GLubyte *src, int num, int numItemsUntilMinusOne)
 {
   for (int i=0; i<num; i++, src+=4)
     dest[i].setValue(src[0]/255.f, src[1]/255.f, src[2]/255.f);
@@ -264,7 +264,7 @@
 
 
 template<>
-static void osgArray2ivMField_composite_template_worker<SbVec3f, float, 
2>(SbVec3f *dest, float *src, int num, int numItemsUntilMinusOne)
+void osgArray2ivMField_composite_template_worker<SbVec3f, float, 2>(SbVec3f 
*dest, float *src, int num, int numItemsUntilMinusOne)
 {
   for (int i=0; i<num; i++, src+=2)
     dest[i].setValue(src[0], src[1], 0.f);
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/lwo/ReaderWriterLWO.cpp
   2007-12-10 21:01:18.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/lwo/ReaderWriterLWO.cpp
   2007-12-10 21:01:30.000000000 +0100
@@ -42,6 +42,8 @@
 #include "old_lw.h"
 #include "old_Lwo2.h"
 
+#include <memory>
+
 class ReaderWriterLWO : public osgDB::ReaderWriter
 {
 public:
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/directx.cpp
     2007-12-10 21:09:16.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/directx.cpp
     2007-12-10 21:09:25.000000000 +0100
@@ -30,6 +30,7 @@
 
 #include <iostream>
 #include <sstream>
+#include <cstring>
 
 #include <math.h>
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/mesh.cpp
        2007-12-10 21:17:48.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/mesh.cpp
        2007-12-10 21:27:01.000000000 +0100
@@ -29,6 +29,8 @@
 #include "directx.h"
 
 #include <iostream>
+#include <cstdlib>
+#include <cstring>
 
 #include <osg/Notify>
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/types.cpp
       2007-12-10 21:33:32.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/x/types.cpp
       2007-12-10 21:33:40.000000000 +0100
@@ -29,6 +29,7 @@
 #include "types.h"
 
 #include <iostream>
+#include <cstdlib>
 
 using namespace std;
 
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/examples/osgdepthpartition/DistanceAccumulator.cpp
       2007-12-11 00:35:31.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/examples/osgdepthpartition/DistanceAccumulator.cpp
       2007-12-11 00:35:43.000000000 +0100
@@ -22,6 +22,7 @@
 #include <osg/Projection>
 #include <algorithm>
 #include <math.h>
+#include <limits.h>
 
 /** Function that sees whether one DistancePair should come before another in
     an sorted list. Used to sort the vector of DistancePairs. */
--- 
a/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/ive/DataTypeSize.h
        2007-12-10 16:58:51.000000000 +0100
+++ 
b/openscenegraph-build/openscenegraph-2.2.0/OpenSceneGraph/src/osgPlugins/ive/DataTypeSize.h
        2007-12-10 16:59:05.000000000 +0100
@@ -12,7 +12,7 @@
 
 //Don't know where else to put this
 namespace ive{
-typedef enum IncludeImageMode { 
IMAGE_REFERENCE_FILE=0,IMAGE_INCLUDE_DATA,IMAGE_INCLUDE_FILE,IMAGE_COMPRESS_DATA
 };
+enum IncludeImageMode { 
IMAGE_REFERENCE_FILE=0,IMAGE_INCLUDE_DATA,IMAGE_INCLUDE_FILE,IMAGE_COMPRESS_DATA
 };
 }
 
 #endif 

Attachment: pgpksUGLJdNev.pgp
Description: PGP signature

Reply via email to