[Qgis-user] How to compile gdal with ESRI FileGDB

Eric Goddard egoddard1010 at gmail.com
Wed Nov 14 07:30:07 PST 2012


Below are the steps I use to add File Geodatabase support to gdal. This
worked on Ubuntu 12.04 64-bit, but it doesn't use the deb source packages.
Since you have a 32-bit ubuntu install, you need to download the 32-bit
version of the FileGDB API. I tried to answer your questions as they come
up in the steps I list below, so you may want to read through the whole
thing before starting. Sorry for the length, but I hope it helps!

In terminal:

1. Change directory to wherever you downloaded the FileGDBAPI: *cd
path/to/FileGDBAPI_download*

2. extract the archive:* tar zxvf FileGDB_API_1_2-32.tar.gz* NOTE: Since
you are using 32-bit Ubuntu, you need to download the 32-bit FileGDB API.

3.You need to build the samples to make sure the API works. Change to the
FileGDB_API samples folder: *cd FileGDB_API/samples*

4. type *make*

5. Run a sample to make sure it works. Change directory to the bin folder
inside samples: *cd bin *, and then type *./Querying*. You'll get a bunch
of text in terminal, just make sure it doesn't spit out any errors.

6. If the sample runs successfully, you have a working FileGDB API and you
are ready to compile GDAL. I like to move the FileGDB API to a better
location than the downloads directory, but it is up to you. If you choose
to move it, you can use the paths listed below. If you use your own
location, change the path in the commands below to whatever you used. *sudo
mv <your location>/FileGDB_API /usr/local/*

7. Create a LD configuration file so that gdal is able to find the FGDB
libraries: *sudo echo /usr/local/FileGDB_API/lib >
etc/ld.so.conf.d/fgdb.conf *

An explanation of ld is below.

8. run ldconfig to update the linked libraries: *sudo ldconfig*

You're now ready to download and configure gdal.


1. Download gdal from http://download.osgeo.org/gdal/gdal-1.9.2.tar.gz
2. Extract the contents of the gdal archive: *tar zxvf gdal-1.9.2.tar.gz*

3. Change to the gdal directory: *cd gdal-1.9.2*

4. Now gdal needs to be configured. Your configure line may be different
from the one below depending on the options you want included, but the
important line to include is --with-fgdb=/usr/local/FileGDB_API. This is my
configure line on my system: * ./configure --with-geos=yes --with-sqlite3
--with-python --with-spatialite --with-fgdb=/usr/local/FileGDB_API
--with-postgres --with-odbc --with-libkml=yes --with-curl=yes
--with-mrsid=/usr/local/MrSID_SDK/Raster_DSDK
--with-mrsid_lidar=/usr/local/MrSID_SDK/Lidar_DSDK
--with-openjpeg=/usr/include*

The --with statements let the configuration script know what additional
modules you want to be included in the compile. When you install packages,
such as geos, from the repos the libraries are put in paths that ld (which
is a utility that links libraries so that other applications are able to
find them) knows about. When you compile by hand the general practice is to
compile to /usr/local, which sometimes ld doesn't know about by default.
You let ld know about additional paths by creating a configuration file in
/etc/ld.so.conf.d/ that contains the path of your custom compiled
libraries.

To compile GDAL with the options you want, your line might look something
like this:

*./configure --with-geos=yes --with-sqlite3 --with-python --with-spatialite
--with-fgdb=/usr/local/FileGDB_API --with-postgres --with-odbc *

After configure runs, it will give you a summary that indicates what it was
able to find. Check to make sure that there is a 'yes' beside the options
you want. If there is a no beside something you want to include, you may
need to scroll through the output and find the error to see what went wrong.


5. Now you can run make and make install. *sudo make*. When that finishes,
run *sudo make install*.

6. One more step: you need to let ld know about the gdal libraries. Since
we didn't specify a different path, the configure line above puts them in
/usr/local/lib by default. I let ld know about the libraries by adding a
local.conf file to /etc/ld.so.conf.d/. *sudo echo /usr/local/lib >
/etc/ld.so.conf.d/local.conf*

7. Run ldconfig again: *sudo ldconfig*

*
*

You should be able to open geodatabases in QGIS or any other GIS
application that uses GDAL now. I expanded on notes that I took while doing
the install, but I didn't have my linux laptop with me while writing this.
Let me know if anything doesn't work or if clarification is needed.
On Nov 13, 2012 9:27 AM, "Johan Nilsson" <joni8135 at gmail.com> wrote:

>  I have tried to find how I compile gdal 1.9.2 with ESRIs FileGDB_API, but
> I'm are very uncertain how it work. I have Ubuntu 10.04LTS 32-bit with
> PAE. I another step I downloaded source-code for gdal-1.9.2 and added
> needed packed with:
>
> *cd ~/Desktop/gdal-mod* <--move cursor to the created folder.
> *apt-get source gdal-bin *<--download source-cod from my respositories
> (same as my binary installed on my system, into the folder I stand in
> ~/Desktop/gdal-mod)
> *sudo apt-get build-dep gdal* <--geting dependencies so my system can
> build the package gdal.
>
>
>  From https://github.com/usgin/ncgmp/wiki/Installation-Example I found
> this example
>
> * *
>
>    1.
>
>    *cd ~/downloads *<--change to the folder with the downloaded driver
>    from ESRI*
>    *
>    2.
>
>    *tar xzf FileGDB_API_1_2-64.tar.gz *<--unpacking
>    3.
>
>    *cd ~/downloads/FileGDB_API/lib *<--goes to a file in the unpacked
>    FileGDB*
>    *
>    4.
>
>    *ln -s libfgdbunixrtl.so libfgdblinuxrtl.so <--made a symbolic link in
>    the folder lib because ESRI change the name.*
>    5.
>
>    *cd ../..* <--up 2 levels*
>    *
>    6.
>
>    *tar xvf gdal-1.9.0.tar.gz *<--unpacking, I have a newer file*
>    *
>    7.
>
>    *cd gdal-1.9.0 *
>    8.
>
>    *./configure --with-pg=/usr/bin/pg_config
>    --with-fgdb=/home/ubuntu/downloads/FileGDB_API
>    --with-geos=/usr/local/bin/geos-config
>    --with-static-proj4=/usr/local/lib/libproj.a --with-python *
>    9.
>
>    *make *
>    10.
>
>    *sudo make install*
>
> First a question! If I make a 'make install', and if it don't work, how
> can i change back to my original gdal-bin?
>
> Second. Does this install libFileGDBAPI.so (Read a tutorial, there they
> said that libFileGDBAPI.so should be install in it default directory,
> which I don't know where it is...
>
>
>  6. I have a newer version of gdal (1.9.2) and I have the 32-bit version
> on this machine. The swift '--with' in this example above are not so
> accurate for my system, I think? What does '--with' really do? Does it
> create links in gdal or does it more?
>
> Does someone know which swift '--with ' I should have or are necessary or
> good to have? Do the FileGDB also get compiled at the same time?
>
> I seach my system and change the path in the example: first where I have
> my FileGDB_API and then some other files have also a different path? Do I
> need all this --with, or does a default file add it?
>
> My modified '--with', if it's needed?
>
> ./configure --with-pg=/usr/bin/pg_config
> --with-fgdb=/home/Joni/Desktop/gdal-mod/FileGDB_API
> --with-geos=/usr/bin/geos-config --with-static-proj4=/usr/lib/libproj.a
> --with-python
>
> If I don't add anything more than, my FilGDB_API, there the source-code
> are, does there are any 'Default setting', so It work as now? I had a
> Postgis config-file as in the example. In this example they had compiled
> a geos package, but my system did have libgeos and a geos-config file in
> above blue directory. The '*--with-static-proj4=/usr/local/lib/libproj.a**'
> *have I changed to another *path*, there I find a* **libproj.a** *file.
>
> Hope someone can explain little..
>
> /Cheers
>
> Johan
>
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20121114/6b038545/attachment.html>


More information about the Qgis-user mailing list