Friday, October 08, 2010

Mac Ports geodjango libgeotiff breakage

At some point in the last few weeks I did a Mac Ports update and gdal, which I use in Django broke.

Here's the exception (which gets silently captured and turned into HAS_GDAL = False):


>>> from django.contrib.gis.gdal.driver import Driver
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/gis/gdal/driver.py", line 5, in
from django.contrib.gis.gdal.prototypes import ds as capi
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 8, in
from django.contrib.gis.gdal.libgdal import lgdal
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/contrib/gis/gdal/libgdal.py", line 37, in
lgdal = CDLL(lib_path)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ctypes/__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
OSError: dlopen(/opt/local/lib/libgdal.dylib, 6): Library not loaded: /opt/local/lib/libgeotiff.1.2.5.dylib
Referenced from: /opt/local/lib/libgdal.dylib
Reason: image not found


So something is linked to s version 1 of libgeotiff and it's been upgraded to 2. Here's what I have installed:


sh-3.2# ls /opt/local/lib/libgeotiff*
/opt/local/lib/libgeotiff.2.0.0.dylib
/opt/local/lib/libgeotiff.dylib
/opt/local/lib/libgeotiff.2.dylib
/opt/local/lib/libgeotiff.la
/opt/local/lib/libgeotiff.a


My workaround for the moment is:


ln -s /opt/local/lib/libgeotiff.dylib /opt/local/lib/libgeotiff.1.2.5.dylib


which seems to work but is obviously risky.

This post is really just a note to myself.

1 comment:

rory solomon said...

Hi Peter,

I came across your blog post because I had the same problem.

You could also try this:
sudo port activate libgeotiff @1.2.5_3
That is still kind of a bandaid solution, but at least you'll have some record of it in macports. (ie, if you later do 'port installed')

cheers -
R