[GRASS-user] compile grass gdal from svn

Paolo Craveri pcraveri at gmail.com
Thu Jan 29 14:11:58 EST 2009


Hi to all


I have just build gdal and grass (6.5) from their respective  svn sources.

When I start grass, I get this error:

"""
WARNING: Digitization tool is disabled (libgdal1.5.0.so.1: cannot open
shared object file: No such file or directory). Detailed information
in README file.



Traceback (most recent call last):

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 1642, in <module>

    sys.exit(main())

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 1635, in main

    app = GMApp(workspaceFile)

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 1557, in __init__

    wx.App.__init__(self, False)

  File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7912, in __init__

    self._BootstrapApp()

  File "/usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_core.py",
line 7487, in _BootstrapApp

    return _core_.PyApp__BootstrapApp(*args, **kwargs)

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 1573, in OnInit

    workspace = self.workspaceFile)

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 175, in __init__

    self.NewDisplay(show=False)

  File "/usr/local/grass-6.5.svn/etc/wxpython/wxgui.py", line 1201, in
NewDisplay

    auimgr=self._auimgr, showMapDisplay=show)

  File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/wxgui_utils.py",
line 106, in __init__

    Map=self.Map, auimgr=self.auimgr)

  File "/usr/local/grass-6.5.svn/etc/wxpython/gui_modules/mapdisp.py",
line 259, in __init__

    self.MapWindow.ZoomHistory(self.Map.region['n'],

KeyError: 'n'


"""
I have read README already.

There are not others gdal install in the system: all packages from
official Ubuntu repositories have been completely removed by apt.

It seems wx can't find gdal (libgdal1.5.0.so.1 ): but I compiled gdal
from svn source which version is >=1.6.

I compiled following the script attached (not a true scrip, just a
reminder and same notes about what I'm going to do! If it  works it
will be useful). I updated my /etc/ld.so.conf and run ldconfig as
root. I also link grass library into gdal directory and compile
gdal-grass plugin -with-grass=${DIR_INST_GRASS} and
--with-gdal=${DIR_INST_GDAL}/bin/gdal-config.

What's wrong?

-- 
-- 
Paolo C.
Lat. 44° 39' 11.08'' N  Long. 7° 23' 25.26'' E
-------------- next part --------------
#! /usr/bin/env bash

PROGRAM=`basename $0`
CURRENTDIR="`pwd`"
# # # gdal source directory
DIR_SRC_GDAL="/usr/local/src/gdal"
# # # gdal install directory
DIR_INST_GDAL="/usr/local/gdal"
# # # grass source directory
DIR_SRC_GRASS="/usr/local/src/grass6_devel"
# # # grass install directory
DIR_INST_GRASS="/usr/local/grass-6.5.svn"
# # # plugin grass-gdal source directory
DIR_SRC_PLUGIN="/usr/local/src/gdal-grass-1.4.3"
# # # plugin grass-gdal install directory
DIR_INST_PLUGIN="/usr/local/lib/gdalplugins"


# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
ask_yes_no()
{
	local yn=
	while [ "$yn" = "" ]; do
		echo  "$1"
		read yn
		case $yn in
			y|Y)	yn=0 ;;
			n|N)	yn=1 ;;
			e|E)
# 			cd ${CURRENTDIR}
			exit 1 ;;
			*)	yn=
				echo "Invalid response - please answer y or n"
				;;
		esac
	done
	return $yn
}

if ask_yes_no "Update/upgrade system  [Y/N/(E)xit] ?"; then
	sudo apt-get update
	sudo apt-get upgrade
fi

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# # #
# # #      GDAL - Geospatial Data Abstraction Library
# # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 

# # # cleaning
if ask_yes_no "Clean GDAL source [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GDAL}
	make distclean
fi

# # # upgrade from svn
if ask_yes_no "Upgrade GDAL source from svn [Y/N/(E)xit] ?"; then
# # #
# # # 	FIRST INSTALL:
# # # 	sudo mkdir /usr/local/src
# # # 	sudo chown my_user_name:my_user_group /usr/local/src/
# # # 	cd /usr/local/src
# # # 	current development version:
# # # 	svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal   
# # # 	current stable version:
# # # 	svn checkout https://svn.osgeo.org/gdal/branches/1.5/gdal gdal
# # #
# # # 	AFTER FIRST INSTALL:
	cd ${DIR_SRC_GDAL}
	svn up
	cd ${CURRENTDIR}
fi

# # # configure ***WITHOUT GRASS***
if ask_yes_no "Configure GDAL [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GDAL}
     ./configure \
		--with-pg=/usr/bin/pg_config \
		--prefix=${DIR_INST_GDAL}  \
		--with-python \
		--with-ogdi \
		--with-sqlite \
		--with-mysql=/usr/bin/mysql_config \
		--with-libtiff=internal \
		--without-grass \
		--with-libtiff=internal
	cd ${CURRENTDIR}
fi

# # # make
if ask_yes_no "Make GDAL [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GDAL}
	make
	cd ${CURRENTDIR}
fi

# # # make install
if ask_yes_no "Install GDAL [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GDAL}
	sudo make install
	cd ${CURRENTDIR}
fi

# # # Is directory, where binary have been installed, in PATH variable?
if ask_yes_no "Check if PATH variable contains path to GDAL binaries [Y/N/(E)xit] ?"; then
	echo "GDAL binary are here ...${DIR_INST_GDAL}/bin"
	echo ""
	cd "${DIR_INST_GDAL}/bin"
	ls -l
	echo "PATH variable:"
	echo "$PATH"
fi

if ask_yes_no "You can change PATH variable now...[Y/N/(E)xit] ?"; then
	gedit $HOME/.bashrc
fi

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# # #
# # #      GRASS GIS (Geographic Resources Analysis Support System) 
# # #
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #  



# # # cleaning
if ask_yes_no "Clean GRASS source[Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GRASS}
	make distclean
	cd ${CURRENTDIR}
fi

# # # upgrade from svn
if ask_yes_no "Upgrade GRASS from svn [Y/N/(E)xit] ?"; then
# # #
# # # 	FIRST INSTALL: (6.5.0 development branch)
# # # 	Note: development here is discouraged and
# # # 	should take place in GRASS 7.
# # # 
# # # 	svn checkout https://svn.osgeo.org/grass/grass/branches/develbranch_6 grass6_devel
# # # 	To switch from SVN 'trunk' (now GRASS 7 development)
# # # 	to 'develbranch_6' (now GRASS 6.4 development) use
# # # 	cd /path/to/your/local/copy/trunk
# # #     svn switch https://svn.osgeo.org/grass/grass/branches/develbranch_6 .
# # #
# # # 	AFTER FIRST INSTALL:
	cd ${DIR_SRC_GRASS}
	svn up
	cd ${CURRENTDIR}
fi

# # # configure  GRASS
if ask_yes_no "Configure GRASS [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GRASS}
# # # 	--with-gdal="${DIR_INST_GDAL}/bin/gdal-config" \
	# # # CFLAGS="-O2 -march=pentium-m -Wall" LDFLAGS="-s"
	# # # CFLAGS="-ggdb -Wall -Werror-implicit-function-declaration"
	CFLAGS="-g -Wall" LDFLAGS="-s" ./configure \
		--with-gdal="${DIR_INST_GDAL}/bin/gdal-config" \
		--with-tcltk-includes=/usr/include/tcl8.5 \
		--with-postgres=yes \
		--with-postgres-includes=/usr/include/postgresql \
		--with-sqlite \
		--with-cxx \
		--with-blas \
		--with-lapack \
		--with-cairo \
		--with-fftw \
		--with-freetype=yes \
		--with-freetype-includes=/usr/include/freetype2 \
		--with-readline \
		--with-opengl-includes=/usr/include/GL \
		--with-mysql \
		--with-mysql-includes=/usr/include/mysql \
		--with-python=/usr/bin/python2.5-config \
		--with-wxwidgets=/usr/bin/wx-config \
		--enable-largefile=yes \
		--with-proj-includes=/usr/include \
		--with-proj-share=/usr/share/proj \
		--with-proj-libs=/usr/lib
	cd ${CURRENTDIR}
fi

# # # make
if ask_yes_no "Make GRASS [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GRASS}
	make
	cd ${CURRENTDIR}
fi

# # # make vdigit nviz
if ask_yes_no "Make vdigit and nviz [Y/N/(E)xit] ?"; then
# # # symbolic link (overwrite if exists)
	sudo ln -s -f /usr/lib/python2.5/site-packages/wx-2.8-gtk2-unicode/wx/_gdi_.so \
		/usr/local/lib/libgdi.so 
	cd "${DIR_SRC_GRASS}/gui/wxpython/vdigit"
	make
	cd "${DIR_SRC_GRASS}/gui/wxpython/nviz"
	make
	cd ${CURRENTDIR}
fi

# # # make install
if ask_yes_no "Install GRASS [Y/N/(E)xit] ?"; then
	cd ${DIR_SRC_GRASS}
	sudo make install
	cd ${CURRENTDIR}
fi

# # # check/set/modify shared library
if ask_yes_no "Check ld.so.conf [Y/N/(E)xit] ?"; then
	echo ""
	echo "REMEMBER: ${DIR_INST_GRASS}/lib must be shared!"
	echo ""
	cat /etc/ld.so.conf
fi
# # # /etc/ld.so.conf
if ask_yes_no "Modify ld.so.conf [Y/N/(E)xit] ?"; then
	sudo gedit /etc/ld.so.conf
	sudo ldconfig
fi

# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
# # #
# # #      PLUGIN GDAL - GRASS
# # #      http://download.osgeo.org/gdal/gdal-grass-1.4.3.tar.gz
# # #        
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 


if ask_yes_no "Compile gdal-grass plugin [Y/N/(E)xit] ?"; then
# # # 	FIRST INSTALL
# # # 	cd /usr/local/src
# # # 	tar xfvz gdal-grass-1.4.3.tar.gz
# # # 	AFTER FIRST INSTALL:
	cd ${DIR_INST_GDAL}/lib
	# # # link GRASS libs to the lib/ folder
	sudo ln -sf ${DIR_INST_GRASS}/lib/*.so .
	cd ${DIR_SRC_PLUGIN}
	make distclean

  	./configure --with-grass=${DIR_INST_GRASS} \
		--with-gdal=${DIR_INST_GDAL}/bin/gdal-config
		
	make
# # # sudo mkdir /usr/local/lib/gdalplugins # # # first install
	sudo cp *.so ${DIR_INST_PLUGIN}
fi


More information about the grass-user mailing list