Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#3301 closed defect (fixed)

patch to fix OGR support with cygwin

Reported by: kiorky Owned by: warmerdam
Priority: normal Milestone: 1.7.0
Component: OGR_SRS Version: unspecified
Severity: normal Keywords: proj cygwin
Cc:

Description

Cygwin libraries are prefixed by cyg and not lib ! Here is a patch fixing it.

diff -ur gdal-1.6.1/ogr/ogrct.cpp gdal-1.6.1.new/ogr/ogrct.cpp
--- gdal-1.6.1/ogr/ogrct.cpp    2008-09-16 10:32:39.000000000 +0200
+++ gdal-1.6.1.new/ogr/ogrct.cpp        2009-12-23 21:05:13.562500000 +0100
@@ -69,7 +69,7 @@

 #if (defined(WIN32) || defined(WIN32CE)) && !defined(__MINGW32__)
 #  define LIBNAME      "proj.dll"
-#elif defined(__CYGWIN__) || defined(__MINGW32__)
+#elif defined(__MINGW32__)
 // XXX: If PROJ.4 library was properly built using libtool in Cygwin or MinGW
 // environments it has the interface version number embedded in the file name
 // (it is CURRENT-AGE number). If DLL came somewhere else (e.g. from MSVC
@@ -77,6 +77,8 @@
 // specify the right library name. By default assume that in Cygwin/MinGW all
 // components were buit in the same way.
 #  define LIBNAME      "libproj-0.dll"
+#elif defined(__CYGWIN__)
+#  define LIBNAME      "cygproj-0.dll"
 #elif defined(__APPLE__)
 #  define LIBNAME      "libproj.dylib"
 #else

Change History (5)

comment:1 by kiorky, 14 years ago

A better patch not to ignore the settings value if defined

$ svn diff django-trunk/django/contrib/gis/gdal/libgdal.py     django-trunk/django/contrib/gis/geos/libgeos.py
Index: django-trunk/django/contrib/gis/gdal/libgdal.py
===================================================================
--- django-trunk/django/contrib/gis/gdal/libgdal.py     (revision 11971)
+++ django-trunk/django/contrib/gis/gdal/libgdal.py     (working copy)
@@ -10,6 +10,10 @@
 except (AttributeError, EnvironmentError, ImportError):
     lib_path = None

+if 'cygwin' in sys.platform and not lib_path:
+    lib_path = 'cyggdal-1.dll'
+
+
 if lib_path:
     lib_names = None
 elif os.name == 'nt':
Index: django-trunk/django/contrib/gis/geos/libgeos.py
===================================================================
--- django-trunk/django/contrib/gis/geos/libgeos.py     (revision 11971)
+++ django-trunk/django/contrib/gis/geos/libgeos.py     (working copy)
@@ -18,6 +18,9 @@
 except (AttributeError, EnvironmentError, ImportError):
     lib_path = None

+if 'cygwin' in sys.platform and not lib_path:
+    lib_path = 'cyggeos_c-1.dll'
+
 # Setting the appropriate names for the GEOS-C library.
 if lib_path:
     lib_names = None
@@ -38,6 +41,7 @@
         lib_path = find_library(lib_name)
         if not lib_path is None: break

+
 # No GEOS library could be found.
 if lib_path is None:
     raise ImportError('Could not find the GEOS library (tried "%s"). '
$ ./bin/svndjangopy djangosvn.py
.....
BEGIN - expecting out of range feature id error; safe to ignore.

ERROR 1: Attempt to read shape with feature id (50000) out of available range.
ERROR 1: Attempt to read shape with feature id (50000) out of available range.

END - expecting out of range feature id error; safe to ignore.
............................
BEGIN - expecting IllegalArgumentException; safe to ignore.

ERROR 1: IllegalArgumentException: Points of LinearRing do not form a closed linestring

END - expecting IllegalArgumentException; safe to ignore.

........................
----------------------------------------------------------------------
Ran 57 tests in 0.343s

OK
.....
BEGIN - expecting GEOS_ERROR; safe to ignore.

GEOS_ERROR: ParseException: Expected number but encountered ','
GEOS_ERROR: ParseException: Unknown WKB type 255
GEOS_ERROR: ParseException: Unexpected EOF parsing WKB

END - expecting GEOS_ERROR; safe to ignore.

..............
BEGIN - expecting GEOS_NOTICE; safe to ignore.

GEOS_NOTICE: Duplicate Rings at or near point 60 300

END - expecting GEOS_NOTICE; safe to ignore.

..........................................................
----------------------------------------------------------------------
Ran 77 tests in 0.875s

OK
(minitage-cchb-win)
makina@APEM3 /minitage/django/cchb-win
$ uname -ar
CYGWIN_NT-5.2 APEM3 1.7.1(0.218/5/3) 2009-12-07 11:48 i686 Cygwin

comment:2 by kiorky, 14 years ago

oups wrong window.

comment:3 by kiorky, 14 years ago

Priority: normalhighest

comment:4 by warmerdam, 14 years ago

Component: defaultOGR_SRS
Keywords: proj added
Milestone: 1.7.0
Priority: highestnormal
Resolution: fixed
Status: newclosed

I'm not completely convinced that proj.4 is always (or even by default if built by a user) named cygproj-0.dll on cygwin. However, I have run out of time to dig deeper, so I'm applying the patch as is in trunk for 1.7.0 beta2 (r18520).

comment:5 by warmerdam, 14 years ago

Keywords: cygwin added
Note: See TracTickets for help on using tickets.