[gdal-dev] Build on Redhat 7.x

Even Rouault even.rouault at mines-paris.org
Sat Jul 30 11:51:08 EDT 2011


Le samedi 30 juillet 2011 00:48:37, Ian Walberg a écrit :
> Folks,
> 
> We need to be able to guild GDAL on Redhat 7.x as some of the systems we
> deploy to still use it (don't ask)
> 
> Currently we are using 1.4.1 which was the newest version that we could
> get to build some time ago.
> 
> However we now need to add spatialite support so need to build a later
> version.
> 
> Has anyone out there needed to do this?

I have a Virtual Machine with a RedHat 7.3 system on it. I managed to build 
GDAL 1.8.1 with the following fixes :
* apply patch of http://trac.osgeo.org/gdal/changeset/22835
* edit gcore/rasterio.cpp and remove the 3 following lines (so that the 
compiler is detected as broken compiler) :
#define NOT_BROKEN_COMPILER \
        (!(defined(_MSC_VER) && _MSC_VER <= 1200) && !defined(__BORLANDC__) && \
        !defined(__SUNPRO_CC))

Then ./configure --without-libtool --without-curl

(--without-curl because if you have the system curl installed, it is too 
ancient and not supported by GDAL)

The build goes well.

Next, I tried to compile spatialite but before that you need to compile proj4 
and GEOS. However it is impossible to compile GEOS, which heavily uses C++ 
features, with such an ancient and broken C++ compiler as gcc 2.96.

So for fun, I gave a try to build a more recent GCC !

Download
ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-3.4.6/gcc-3.4.6.tar.bz2
and
ftp://ftp.irisa.fr/pub/mirrors/gcc.gnu.org/gcc/releases/gcc-3.4.6/gcc-
g++-3.4.6.tar.bz2

(I didn't dare to try compiling a GCC 4.X)

cd $HOME

tar xjvf gcc-3.4.6.tar.bz2
tar xjvf gcc-g++-3.4.6.tar.bz2

mkdir $HOME/install-gcc-346
cd gcc-3.4.6
./configure --prefix=$HOME/install-gcc-346 --enable-languages=c,c++
make
make install

export PATH=$HOME/install-gcc-346/bin

g++ --version  : you have a working GCC 3.4.6 compiler now !

You'll also need to define
export LD_LIBRARY_PATH=$HOME/install-gcc-346/lib
for the new libstdc++ (I didn't dare to install in system directories, but I 
think you could just copy the libstdc++.so.6 and libgcc_s.so.1 to /usr/lib to 
avoid to define this LD_LIBRARY_PATH )

Then I've managed to compile proj 4.7.0 and geos 3.3.0, and then 
libspatialite-amalgamation-2.4.0 without any problem

cd $HOME
wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz
tar xvzf proj-4.7.0.tar.gz
cd proj-4.7.0
./configure --prefix=/usr
make
make install

cd $HOME
wget http://download.osgeo.org/geos/geos-3.3.0.tar.bz2
tar xjvf geos-3.3.0.tar.bz2
cd geos-3.3.0
./configure --prefix=/usr
make
make install

cd $HOME
wget http://www.gaia-gis.it/spatialite-2.4.0-4/libspatialite-
amalgamation-2.4.0.tar.gz
cd libspatialite-amalgamation
./configure --prefix=/usr
make
make install


And then I rebuilt GDAL with spatialite support :
cd gdal-1.8.1
make clean
./configure --without-libtool --without-curl --with-spatialite=/usr
make
export LD_LIBRARY_PATH=$PWD:$LD_LIBRARY_PATH
export PATH=$PWD/apps:$PATH
export GDAL_DATA=$PWD/data

The autotests for the OGR SQLite/Spatialite driver pass.

PS: With GCC 3.4.6, the patch quoted at the beginning and change in 
gcore/rasterio.cpp are not needed in fact.

Best regards,

Even

> 
> Thanks
> 
> Ian
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list