Re: [osg-users] [build] Building OpenSceneGraph-3.3.4 with GDAL 2.0

50 views
Skip to first unread message

Tony Vasile

unread,
Jun 25, 2015, 3:01:08 AM6/25/15
to osg-...@lists.openscenegraph.org
Hi,
I get a similar problem with GDAL 2.0 and the OpenSceneGraph 3.2.1

Code:

home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp: In member function ‘virtual osgDB::ReaderWriter::ReadResult ReaderWriterOGR::readFile(const std::string&, const osgDB::ReaderWriter::Options*) const’:
/home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp:137: warning: ‘static OGRSFDriverRegistrar* OGRSFDriverRegistrar::GetRegistrar()’ is deprecated (declared at /usr/local/include/ogrsf_frmts.h:320)
/home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp:137: warning: ‘int OGRSFDriverRegistrar::GetDriverCount()’ is deprecated (declared at /usr/local/include/ogrsf_frmts.h:324)
/home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp:141: error: ‘Open’ is not a member of ‘OGRSFDriverRegistrar’
/home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp:161: warning: ‘virtual const char* OGRDataSource::GetName()’ is deprecated (declared at /usr/local/include/ogrsf_frmts.h:243)
/home/avasile/src/OpenSceneGraph-3.2.1/src/osgPlugins/ogr/ReaderWriterOGR.cpp:165: warning: ‘static void OGRDataSource::DestroyDataSource(OGRDataSource*)’ is deprecated (declared at /usr/local/include/ogrsf_frmts.h:245)

It seems that the GDAL API In 2.0 has changed so the code no longer compiles. If one looks at the appropriate OGR header file there is a comment to indicate that OGRSFDriverRegistrar is also deprecated and should be replace by


Code:

/************************************************************************/
/* OGRSFDriverRegistrar */
/************************************************************************/

/**
* LEGACY class. Use GDALDriverManager in your new code ! This class may be
* removed in a later release.
*
* Singleton manager for OGRSFDriver instances that will be used to try
* and open datasources. Normally the registrar is populated with
* standard drivers using the OGRRegisterAll() function and does not need
* to be directly accessed. The driver registrar and all registered drivers
* may be cleaned up on shutdown using OGRCleanupAll().
*
* @deprecated
*/


The only open calls in
Code:
ogr_api.h

have extra parameters
Code:
OGRDataSourceH CPL_DLL OGROpen( const char *, int, OGRSFDriverH * ) CPL_WARN_UNUSED_RESULT;


to what is called from ReaderWriterOGR.cpp.
...


Thank you!

Cheers,
Tony

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

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

Tony Vasile

unread,
Jun 25, 2015, 4:00:45 AM6/25/15
to osg-...@lists.openscenegraph.org
Hi,

I have this patch so that it compiles but I don't have a ogr source file to test it against. But this allows OpenSceneGraph 3.2.1 to compile.

...


Thank you!

Cheers,
Tony

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



OGR.txt

Robert Osfield

unread,
Jun 26, 2015, 5:51:04 AM6/26/15
to OpenSceneGraph Users
 Hi Tony,

You suggested changed breaks the build for GDAL<2.0.

I have changed the ReaderWriterOGR.cpp to contain both the original code blocks and the ones modified by you with a GDAL_VERSION_MAJOR<2 check.  Attached is the modified file.  Could you try this out, if it works fine I'll check it into svn/trunk and the OSG-3.2 branch.

Robert.

Tony Vasile

unread,
Jun 26, 2015, 7:17:26 AM6/26/15
to osg-...@lists.openscenegraph.org
Hi Robert,
Am I going blind I can see your attachment with your modified patch?

...


Thank you!

Cheers,
Tony

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

Tony Vasile

unread,
Jun 26, 2015, 8:38:52 AM6/26/15
to osg-...@lists.openscenegraph.org
Hi Robert

Not sure if you came up with this but since I couldn't see your version of the patch I recreated it.

...


Thank you!

Cheers,
Tony

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



OGR.txt

Robert Osfield

unread,
Jun 26, 2015, 8:45:36 AM6/26/15
to OpenSceneGraph Users
On 26 June 2015 at 13:39, Tony Vasile <min...@gmail.com> wrote:
Not sure if you came up with this but since I couldn't see your version of the patch I recreated it.

Oppps. Must have missed attaching the file...

You file looks roughly the same.  In my change I cleaned up one of the commented out lines in your code.

Robert.
 
ReaderWriterOGR.cpp
Reply all
Reply to author
Forward
0 new messages