Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 04 Jun 2012 21:47:42 +0200
From:      Rainer Hurling <rhurlin@gwdg.de>
To:        "O. Hartmann" <ohartman@zedat.fu-berlin.de>
Cc:        Ports FreeBSD <freebsd-ports@freebsd.org>
Subject:   Re: graphics/gdal: gifdataset.cpp:599:23: error: 'PrintGifError' was not declared in this scope
Message-ID:  <4FCD10DE.5030509@gwdg.de>
In-Reply-To: <4FCD0DE2.8080607@zedat.fu-berlin.de>
References:  <4FCD0DE2.8080607@zedat.fu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------020502040902050401040205
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

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


--------------020502040902050401040205
Content-Type: text/plain; charset=ISO-8859-15;
	name="patch-frmts__gif__gifdataset.cpp"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="patch-frmts__gif__gifdataset.cpp"

--- 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;

--------------020502040902050401040205--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FCD10DE.5030509>