Subject: [Thuban-list] Implementation of GDAL

From: Stephan Holl <[email-masked]>
Date: Mon, 29 Sep 2003 18:45:02 +0200

Dear list,

I recently updated thuban from CVS and I would like to use gdal for
displaying rasters.
What do I have to add, that thuban recognises my gdal-installation? It
lives in /usr/local/lib/.
But the About-Section does not find it...

Thanks for your hints.

Cheers 
	Stephan 
-- 
Stephan Holl

GnuPG Key-ID: 11946A09

 18:41:11 up  4:56,  1 user,  load average: 0.30, 0.15, 0.10

---

From: Bernhard Herzog <[email-masked]>
Date: Mon, 29 Sep 2003 20:49:50 +0200

> But the About-Section does not find it...

For gdal support to work, thuban has to be able to import the python
gdal bindings and the thuban specific gdalwarp module. You may have to
recompile Thuban for the latter to become available.

   Bernhard

-- 
Intevation GmbH                                 http://intevation.de/
Sketch                                 http://sketch.sourceforge.net/
Thuban                                  http://thuban.intevation.org/

---

From: Stephan Holl <[email-masked]>
Date: Tue, 30 Sep 2003 07:25:41 +0200

Hello Bernhard,

At Mon, 29 Sep 2003 20:49:50 +0200 Bernhard Herzog wrote:

>
> > What do I have to add, that thuban recognises my gdal-installation?
> > It lives in /usr/local/lib/.

Thanks for your answer.
The "make install" from gdal installed the python_modules in 
	/usr/lib/python2.2/site-packages/gdal
After that I did a 
	python setup.py install_local
in the thuban-src-dir.
After launching "thuban-src-dir/thuban.py" gdal is still not available.

Is there a needed switch to recompile for gdal-support ?
Thank you

  Stephan Holl

-- 
Stephan Holl

GnuPG Key-ID: 11946A09

 07:21:04 up 54 min,  1 user,  load average: 0.05, 0.15, 0.08

---

From: Bernhard Herzog <[email-masked]>
Date: Tue, 30 Sep 2003 12:50:23 +0200

> After launching "thuban-src-dir/thuban.py" gdal is still not available.

Were there any error messages during the build? Do you have a file
gdalwarp.so in Lib/? Can you import gdalwarp? One way to test the latter
would be to do

   cd Lib; python -c "import gdalwarp"

Maybe you have to put the directory containg the gdal library into the
LD_LIBRARY_PATH

    Bernhard

---

From: Stephan Holl <[email-masked]>
Date: Tue, 30 Sep 2003 13:10:53 +0200

Hello Bernhard,

At Tue, 30 Sep 2003 12:50:23 +0200 Bernhard Herzog wrote:

> gdalwarp.so in Lib/? Can you import gdalwarp? 

No, there were no errors during build, but when I try to load it
manually...

> One way to test the
> latter would be to do

~/cvs/thuban/Lib > python -c "import gdalwarp"
Traceback (most recent call last):
  File "<string>", line 1, in ?
ImportError: ./gdalwarp.so: undefined symbol: __gxx_personality_v0
steph@kermit:~/cvs/thuban/Lib >

That is the resulting error-message. I am no python expert, so do not
know what to do...

Thanks for your help

cheers
  Stephan

-- 
Stephan Holl

GnuPG Key-ID: 11946A09

 13:08:36 up  2:43,  1 user,  load average: 0.01, 0.12, 0.16

---

From: Bernhard Herzog <[email-masked]>
Date: Tue, 30 Sep 2003 15:29:36 +0200

> ImportError: ./gdalwarp.so: undefined symbol: __gxx_personality_v0

This looks like some library was missing when linking gdalwarp.so.
According to google this is probably because gdalwarp.cpp is compiled as
c++ but linked by gcc which doesn't automatically include libstdc++. We
don't have problem because we still mostly use gcc 2.95.

This seems to be a bug in distutils in Python < 2.3. There doesn't seem
to be an easy fix, unfortunately, but there are several options:

 - Use the distutils from Python 2.3 which automatically use the c++
   compiler for linking extensions written in C++

   I just tried this by creating a symbolic link to the directory
   containing distutils in the thuban source directory and then running
   the setup.py script normally (after removing the build subdirectory
   to make sure everything is rebuilt properly)

   ln -s path/to/python/lib/python2.3/distutils/ .
   rm -r build/
   python2.2 setup.py build

   This works for me but all I can easily check is it does indeed call
   the c++ compiler. I don't have a system with gcc 3.0 where all the
   other stuff Thuban requires is already available. The distutils of
   Python 2.3 work fine with Python 2.2 apparently.

 - Do the link step of gdalwarp manually by copying the commandline
   printed by setup.py and replacing the gcc with g++

 - Add "stdc++" to the libraries list in the Extension call for
   Lib.gdalwarp in setup.py (line 1089 or thereabouts)

  Bernhard

---

From: Stephan Holl <[email-masked]>
Date: Sun, 5 Oct 2003 18:02:05 +0200

Hello Bernhard,

At Tue, 30 Sep 2003 15:29:36 +0200 Bernhard Herzog wrote:

> According to google this is probably because gdalwarp.cpp is compiled
> as c++ but linked by gcc which doesn't automatically include
> libstdc++. We don't have problem because we still mostly use gcc 2.95.
> 
> This seems to be a bug in distutils in Python < 2.3. There doesn't
> seem to be an easy fix, unfortunately, but there are several options:
> 
>    containing distutils in the thuban source directory and then
>    running the setup.py script normally (after removing the build
>    subdirectory to make sure everything is rebuilt properly)
> 

Thank you for your quick help with compiling thuban from source.
The problem I was struggeling with was solved by some apt-getting
(python2.3, python2.3.-dev) and setting the correct link as mentioned
above.
Now it works fine.

Gruß
  Stephan

-- 
Stephan Holl

GnuPG Key-ID: 11946A09

 18:00:08 up  7:18,  1 user,  load average: 0.32, 0.13, 0.04