[osg-submissions] osg-2.3.5 does not compile with gcc-4.3 (patch)

Robert Osfield robert.osfield at gmail.com
Tue Mar 25 05:23:22 PDT 2008


Hi Jurgen,

I've reviewed you changes, and merged them approximately what you
changes to FileNameUtils.cpp and Registry.cpp.  I add an
#include<limits.h> to ViewerEventHandler.cpp and an #include<memory>
to ReaderWriterGDAL.cpp to get round the auto_ptr<> issue.

I only have gcc 4.1 here so can't test to see if this fixes the
problems you've encountered.  Let me know if something is still
borken.

Good luck with the exams,

Robert.

On Fri, Mar 21, 2008 at 11:05 AM, Jürgen Löb
<gandalf at hni.uni-paderborn.de> wrote:
> Hi,
>
>  the strlen issue can be solved by removing the
>
>  using::std::strlen
>
>  from FileNameUtils and Registry. So they use the C counterparts.
>
>  In ViewerEventHandler we can include values.h and then use MAXINT
>  instead of INT_MAX. On my system values.h belongs to glibc-2.7-r1. I
>  don' t really know if we can assume this to be portable enough.
>
>  The new files are attached.
>
>  For the auto_ptr issue in gdal/ReaderWriterGDAL I don't have a solution
>  yet. Also I didn't find a definition corresponding UINT_MAX in C headers
>  yet. Either there is one, or, a bit crappy, we could left shift INT_MAX
>  and add one, since afaik the int is only a 2 complement of the same bit
>  length as uint. But I wouldn't prefer this solution.
>
>  I'll look further into the remaining two issues, but this may take some
>  time since I also have to learn for an exam at the moment.
>
>  Jürgen
>
>  Robert Osfield schrieb:
>
>
> > Hi Jurgen,
>  >
>  > Could you try replacing the Standard C++ style C includes by ordinary
>  > C counterparts such as string.h etc.  The aim is to fix the compile
>  > but use headers that are guarenteed to work across platforms.  I
>  > realise this is right pain in the butt, but less of pain than it is
>  > breaking the build for otherwise innocent users.
>  >
>  > Robert.
>  >
>  > On Wed, Mar 19, 2008 at 5:36 PM, Jürgen Löb
>  > <gandalf at hni.uni-paderborn.de> wrote:
>  >
>  >> Hi,
>  >>
>  >>  all the errors are due to stricter include handling in newer gcc
>  >>  includes. See: http://gcc.gnu.org/gcc-4.3/porting_to.html
>  >>  Imho there is now other way to get the issues solved, but to add the
>  >>  includes. You're right, if there are systems on which these headers do
>  >>  not exist this causes the build to break on these systems. In that case
>  >>  we should do some preprocessing....
>  >>
>  >>  Jürgen
>  >>
>  >>
>  >>  Detailed errors and headers to include follow:
>  >>
>  >>
>  >>  [ 16%] Building CXX object src/osgDB/CMakeFiles/osgDB.dir/FileNameUtils.o
>  >>  cc1plus: Anmerkung: -freorder-blocks-and-partition funktioniert nicht
>  >>  mit Ausnahmen
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgDB/FileNameUtils.cpp:30:
>  >>  Fehler: »std::strlen« wurde nicht deklariert
>  >>  make[2]: *** [src/osgDB/CMakeFiles/osgDB.dir/FileNameUtils.o] Fehler 1
>  >>  make[1]: *** [src/osgDB/CMakeFiles/osgDB.dir/all] Fehler 2
>  >>  make: *** [all] Fehler 2
>  >>
>  >>  solution:  #include <cstring>
>  >>
>  >>
>  >>  [ 16%] Building CXX object src/osgDB/CMakeFiles/osgDB.dir/Registry.o
>  >>  cc1plus: Anmerkung: -freorder-blocks-and-partition funktioniert nicht
>  >>  mit Ausnahmen
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgDB/Registry.cpp:39:
>  >>  Fehler: »std::strlen« wurde nicht deklariert
>  >>  make[2]: *** [src/osgDB/CMakeFiles/osgDB.dir/Registry.o] Fehler 1
>  >>  make[1]: *** [src/osgDB/CMakeFiles/osgDB.dir/all] Fehler 2
>  >>  make: *** [all] Fehler 2
>  >>
>  >>  solution: #include <cstring>
>  >>
>  >>
>  >>  [ 36%] Building CXX object
>  >>  src/osgViewer/CMakeFiles/osgViewer.dir/ViewerEventHandlers.o
>  >>  cc1plus: Anmerkung: -freorder-blocks-and-partition funktioniert nicht
>  >>  mit Ausnahmen
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgViewer/ViewerEventHandlers.cpp:
>  >>  In member function »unsigned int
>  >>  osgViewer::WindowSizeHandler::getNearestResolution(int, int, int, int)
>  >>  const«:
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgViewer/ViewerEventHandlers.cpp:250:
>  >>  Fehler: »INT_MAX« wurde in diesem Gültigkeitsbereich nicht definiert
>  >>  make[2]: ***
>  >>  [src/osgViewer/CMakeFiles/osgViewer.dir/ViewerEventHandlers.o] Fehler 1
>  >>  make[1]: *** [src/osgViewer/CMakeFiles/osgViewer.dir/all] Fehler 2
>  >>  make: *** [all] Fehler 2
>  >>
>  >>  solution: #include <climits>
>  >>
>  >>
>  >>  [ 70%] Building CXX object
>  >>  src/osgPlugins/gdal/CMakeFiles/osgdb_gdal.dir/ReaderWriterGDAL.o
>  >>  cc1plus: Anmerkung: -freorder-blocks-and-partition funktioniert nicht
>  >>  mit Ausnahmen
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:
>  >>  In member function »virtual osgDB::ReaderWriter::ReadResult
>  >>  ReaderWriterGDAL::local_readImage(const std::string&, const
>  >>  osgDB::ReaderWriter::Options*)«:
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:114:
>  >>  Fehler: »auto_ptr« ist kein Element von »std«
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:114:
>  >>  Fehler: expected primary-expression before »>« token
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:114:
>  >>  Fehler: »dataset« wurde in diesem Gültigkeitsbereich nicht definiert
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:
>  >>  In member function »osgDB::ReaderWriter::ReadResult
>  >>  ReaderWriterGDAL::local_readHeightField(const std::string&, const
>  >>  osgDB::ReaderWriter::Options*)«:
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:568:
>  >>  Fehler: »auto_ptr« ist kein Element von »std«
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:568:
>  >>  Fehler: expected primary-expression before »>« token
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/src/osgPlugins/gdal/ReaderWriterGDAL.cpp:568:
>  >>  Fehler: »dataset« wurde in diesem Gültigkeitsbereich nicht definiert
>  >>  make[2]: ***
>  >>  [src/osgPlugins/gdal/CMakeFiles/osgdb_gdal.dir/ReaderWriterGDAL.o] Fehler 1
>  >>  make[1]: *** [src/osgPlugins/gdal/CMakeFiles/osgdb_gdal.dir/all] Fehler 2
>  >>  make: *** [all] Fehler 2
>  >>
>  >>  solution: #include <memory>
>  >>
>  >>
>  >>  [ 88%] Building CXX object
>  >>  examples/osgdepthpartition/CMakeFiles/example_osgdepthpartition.dir/DistanceAccumulator.o
>  >>  cc1plus: Anmerkung: -freorder-blocks-and-partition funktioniert nicht
>  >>  mit Ausnahmen
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/examples/osgdepthpartition/DistanceAccumulator.cpp:
>  >>  In constructor »DistanceAccumulator::DistanceAccumulator()«:
>  >>  /var/tmp/portage/media-gfx/openscenegraph-2.3.5/work/OpenSceneGraph-2.3.5/examples/osgdepthpartition/DistanceAccumulator.cpp:46:
>  >>  Fehler: »UINT_MAX« wurde in diesem Gültigkeitsbereich nicht definiert
>  >>  make[2]: ***
>  >>  [examples/osgdepthpartition/CMakeFiles/example_osgdepthpartition.dir/DistanceAccumulator.o]
>  >>  Fehler 1
>  >>  make[1]: ***
>  >>  [examples/osgdepthpartition/CMakeFiles/example_osgdepthpartition.dir/all]
>  >>  Fehler 2
>  >>  make: *** [all] Fehler 2
>  >>
>  >>  solution: #include <limits.h>
>  >>
>  >>
>  >>
>  >>  Robert Osfield schrieb:
>  >>  > Hi Jürgen,
>  >>  >
>  >>
>  >>
>  >>> I'm reviewing your changes but am concerned that they might break the
>  >>>
>  >>  > build on older systems like IRIX where the full Standard C++'s c
>  >>  > headers aren't properly supported.
>  >>  >
>  >>  > Could you post the errors you are getting.
>  >>  >
>  >>  > Robert.
>  >>  >
>
>  ----
>  Hiermit widerspreche ich/wir der Nutzung oder Uebermittlung
>  meiner/unserer Daten fuer Werbezwecke oder fuer die Markt- oder
>  Meinungsforschung gem. Par. 28 Abs. 3 Bundesdatenschutzgesetz.
>
>
> _______________________________________________
>  osg-submissions mailing list
>  osg-submissions at lists.openscenegraph.org
>  http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
>
>


More information about the osg-submissions mailing list