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

Jürgen Löb gandalf at hni.uni-paderborn.de
Fri Mar 21 04:05:16 PDT 2008


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FileNameUtils.cpp
Type: text/x-c++src
Size: 8170 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080321/03d584ac/attachment-0003.cpp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Registry.cpp
Type: text/x-c++src
Size: 66433 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080321/03d584ac/attachment-0004.cpp 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ViewerEventHandlers.cpp
Type: text/x-c++src
Size: 21183 bytes
Desc: not available
Url : http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080321/03d584ac/attachment-0005.cpp 


More information about the osg-submissions mailing list