graphics/gdal: gifdataset.cpp:599:23: error: 'PrintGifError'
was not declared in this scope
Rainer Hurling
rhurlin at gwdg.de
Mon Jun 4 19:47:45 UTC 2012
On 04.06.2012 21:34 (UTC+2), O. Hartmann wrote:
> Since the last port update, I get this sticky error in gdal:
>
> libtool: compile: g++46 -O3 -pipe -fno-strict-aliasing -march=native
> -Wl,-rpath=/usr/local/lib/gcc46 -Wall
> -I/usr/ports/graphics/gdal/work/gdal-1.9.0/port
> -I/usr/ports/graphics/gdal/work/gdal-1.9.0/gcore
> -I/usr/ports/graphics/gdal/work/gdal-1.9.0/alg
> -I/usr/ports/graphics/gdal/work/gdal-1.9.0/ogr
> -I/usr/ports/graphics/gdal/work/gdal-1.9.0/ogr/ogrsf_frmts -DOGR_ENABLED
> -I/usr/local/include -I/usr/ports/graphics/gdal/work/gdal-1.9.0/port
> -I/usr/local/include -I/usr/local -I/usr/local/include
> -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr/local
> -I/usr/local/include -I/usr/local/include -I/usr/local
> -I/usr/local/include -I/usr/local -I/usr/local/include -I/usr
> -I/usr/include -c gifdataset.cpp -fPIC -DPIC -o ../o/.libs/gifdataset.o
> gifdataset.cpp: In static member function 'static GDALDataset*
> GIFDataset::CreateCopy(const char*, GDALDataset*, int, char**,
> GDALProgressFunc, void*)':
> gifdataset.cpp:599:23: error: 'PrintGifError' was not declared in this scope
> gifdataset.cpp:625:23: error: 'PrintGifError' was not declared in this scope
I found a solution, presented in another thread some hours ago, see
attachment. I am not filling a PR because gdal 1.9.1 seems to be in
preparation ...
Hope this helps,
Rainer
> gmake[2]: *** [../o/gifdataset.lo] Error 1
> gmake[2]: Leaving directory
> `/usr/ports/graphics/gdal/work/gdal-1.9.0/frmts/gif'
> gmake[1]: *** [gif-install-obj] Error 2
> gmake[1]: Leaving directory `/usr/ports/graphics/gdal/work/gdal-1.9.0/frmts'
> gmake: *** [frmts-target] Error 2
> *** [do-build] Error code 1
>
> Stop in /usr/ports/graphics/gdal.
> *** [build] Error code 1
>
> Stop in /usr/ports/graphics/gdal.
>
> ===>>> make failed for graphics/gdal
> ===>>> Aborting update
>
> Terminated
>
> ===>>> You can restart from the point of failure with this command line:
> portmaster<flags> graphics/gdal
>
>
> Regards,
> Oliver
-------------- next part --------------
--- frmts/gif/gifdataset.cpp.orig 2012-01-04 08:03:28.000000000 +0100
+++ frmts/gif/gifdataset.cpp 2012-06-04 17:21:24.000000000 +0200
@@ -470,6 +470,28 @@
}
/************************************************************************/
+/* GDALPrintGifError() */
+/************************************************************************/
+
+static void GDALPrintGifError(const char* pszMsg)
+{
+/* GIFLIB_MAJOR is only defined in libgif >= 4.2.0 */
+/* libgif 4.2.0 has retired PrintGifError() and added GifErrorString() */
+#if defined(GIFLIB_MAJOR) && defined(GIFLIB_MINOR) && \
+ ((GIFLIB_MAJOR == 4 && GIFLIB_MINOR >= 2) || GIFLIB_MAJOR > 4)
+ /* Static string actually, hence the const char* cast */
+ const char* pszGIFLIBError = (const char*) GifErrorString();
+ if (pszGIFLIBError == NULL)
+ pszGIFLIBError = "Unknown error";
+ CPLError( CE_Failure, CPLE_AppDefined,
+ "%s. GIFLib Error : %s", pszMsg, pszGIFLIBError );
+#else
+ PrintGifError();
+ CPLError( CE_Failure, CPLE_AppDefined, "%s", pszMsg );
+#endif
+}
+
+/************************************************************************/
/* CreateCopy() */
/************************************************************************/
@@ -596,9 +618,7 @@
psGifCT->ColorCount, 255, psGifCT) == GIF_ERROR)
{
FreeMapObject(psGifCT);
- PrintGifError();
- CPLError( CE_Failure, CPLE_AppDefined,
- "Error writing gif file." );
+ GDALPrintGifError("Error writing gif file.");
EGifCloseFile(hGifFile);
VSIFCloseL( fp );
return NULL;
@@ -622,9 +642,7 @@
if (EGifPutImageDesc(hGifFile, 0, 0, nXSize, nYSize, bInterlace, NULL) == GIF_ERROR )
{
- PrintGifError();
- CPLError( CE_Failure, CPLE_AppDefined,
- "Error writing gif file." );
+ GDALPrintGifError("Error writing gif file.");
EGifCloseFile(hGifFile);
VSIFCloseL( fp );
return NULL;
More information about the freebsd-ports
mailing list