2

I'm trying to get GDAL installed/up to date on my Ubuntu machine, and I can't seem to get it to work properly. I've been following this process: https://milkator.wordpress.com/2014/05/06/set-up-gdal-on-ubuntu-14-04/, which is the same as the one described in Installing gdal 1.9.0 on linux ubuntu server 10.04?, but when I run make, I get all of these undefined reference errors that all seem to have to do with OpenSSL (at end of question).

I've tried installing openssl, but it's already on the latest version. I've been able to find similar errors elsewhere, but they haven't been very helpful or related (e.g. https://tickets.opscode.com/browse/COOK-1406).

I also haven't been able to get up and running from the ubuntugis ppa in the way that I want. I've been able to install gdal-bin, but gdalinfo --version returns GDAL 1.10.1, released 2013/08/26 (current version is now 1.11.2), which would be less of a problem if it also included the gdal python scripts, like gdal2tiles.py, which are what I'm ultimately after a working version of. They're not in /usr/bin, and I'm not sure where else to look.

I'm honestly not sure whether this is a problem with make, gdal, my machine, or something else entirely.

Errors from make:

make[1]: Entering directory `/home/MY_USER_FOLDER/sourceBuild/gdal-1.11.2/apps'
/bin/bash /home/MY_USER_FOLDER/sourceBuild/gdal-1.11.2/libtool --mode=link  g++  gdalinfo.lo commonutils.lo  /home/MY_USER_FOLDER/sourceBuild/gdal-1.11.2/libgdal.la -o gdalinfo
libtool: link: g++ .libs/gdalinfo.o .libs/commonutils.o -o .libs/gdalinfo  /home/MY_USER_FOLDER/sourceBuild/gdal-1.11.2/.libs/libgdal.so -L/usr/lib -L/home/MY_USER_FOLDER/anaconda3/lib -lgeos_c /home/MY_USER_FOLDER/anaconda3/lib/libsqlite3.so -lodbc -lodbcinst /usr/lib/x86_64-linux-gnu/libexpat.so -lxerces-c -ljasper -lnetcdf /home/MY_USER_FOLDER/anaconda3/lib/libhdf5.so /usr/lib/libmfhdfalt.so /usr/lib/libdfalt.so -lgif /home/MY_USER_FOLDER/anaconda3/lib/libjpeg.so /home/MY_USER_FOLDER/anaconda3/lib/libpng15.so -lpq -lpthread -lrt -lpcre /home/MY_USER_FOLDER/anaconda3/lib/libxml2.so -lm -lz -ldl  -Wl,-rpath -Wl,/home/MY_USER_FOLDER/anaconda3/lib
/usr/lib/libpq.so: undefined reference to `SSL_CTX_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_get_cert_store@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_check_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_num_locks@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_by_id@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_locking_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_certificate_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `TLSv1_method@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_new@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_load_error_strings@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `OPENSSL_config@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_error@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_NAME_get_text_by_NID@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_write@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey_file@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_load_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_load_verify_locations@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_free@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_ex_data@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_verify@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_set_fd@OPENSSL_1.0.0'
/home/jeremy/sourceBuild/gdal-1.11.2/.libs/libgdal.so: undefined reference to `sqlite3_column_table_name'
/usr/lib/libpq.so: undefined reference to `SSL_read@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ERR_reason_error_string@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_connect@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_CTX_ctrl@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_use_PrivateKey@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_STORE_set_flags@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_pending@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_finish@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `ENGINE_load_private_key@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_library_init@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `X509_get_subject_name@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `CRYPTO_set_id_callback@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_shutdown@OPENSSL_1.0.0'
/usr/lib/libpq.so: undefined reference to `SSL_get_peer_certificate@OPENSSL_1.0.0'
collect2: error: ld returned 1 exit status
make[1]: *** [gdalinfo] Error 1
make[1]: Leaving directory `/home/jeremy/sourceBuild/gdal-1.11.2/apps'
make: *** [apps-target] Error 2

UPDATE: I created a virtual machine from a new Ubuntu 14.04 iso, and building from source there didn't give me any trouble. I'm beginning to wonder if it has something to do with my Anaconda installation, since this is the only reference to SSL in my config.log:

/home/jeremy/anaconda3/lib/libcurl.so: undefined reference to `SSLv2_client_method'
  • I have the same problem on my ubuntu 14.04 machine.... – user48893 Mar 13 '15 at 9:29
  • have you installed libssl-dev? and did you tell config where openssl is installed? – Ian Turton Mar 13 '15 at 10:24
  • try ubuntugis-unstable channel sudo sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable – nickves Mar 13 '15 at 10:58
  • @iant I have libssl-dev up to date (sudo apt-get install libssl-dev returns that it's already up to date). I'm not sure how to tell config where openssl is installed in this case, as I don't see references to it in the config files I've looked at. Any tips? – Jeremy G. Mar 14 '15 at 16:27
  • @nickves I added the unstable ppa, and that did get me a newer gdal, but still no python scripts in usr/bin. – Jeremy G. Mar 14 '15 at 16:30
3

You shouldn't need to build from source to get a recent GDAL installed on Ubuntu. Don't bother with the UbuntuGIS-Stable PPA, use UbuntuGIS-Unstable. Unstable in this case does not mean buggy and shouldn't be used, it just means it is updated more frequently. The UbuntuGIS Stable PPA has not even been updated for the most recent Ubuntu LTS (14.04) which was released nearly a year ago...

Once you have added the unstable PPA, you need to install the gdal binaries AND the gdal python bindings:

sudo apt-get install gdal-bin python-gdal

To answer your question as asked... An easy way to get all the build dependencies for gdal if you really need to build from source, (i.e. if you need to modify the build to include ECW or other proprietary format support) is to add the unstable PPA, then install build dependencies via apt-get:

sudo apt-get build-dep gdal
  • Installing both binaries from UbuntuGIS-Unstable worked for me. Thank you! Not sure if this should be a separate thing, but I haven't seen it anywhere else, so here goes. I got gdal2tiles.py running, but in order to get it working, I had to replace 900913 with 3857 in the script. At least on my machine, the script couldn't load EPSG 900913, but as indicated by MappaGnosis' comment here: gis.stackexchange.com/questions/34276/…, 3857 is the current code for the artist formerly known as EPSG:900913. – Jeremy G. Mar 17 '15 at 1:11
1

I had more versions of libsqlite3 due to my anaconda installation. Deleting anaconda dir from my path and re-running ./configure solved my problem.

  • This solved my problem. SD – shaunakde Oct 4 '16 at 17:47
-1

Do this:

apt-get install g++ php5-dev libgdal1-dev git
cd /tmp
git clone https://github.com/geonef/php5-gdal.git && cd php5-gdal
phpize
./configure
make
make install

An then open gdal.ini like that:(it will be created)

sudo nano/etc/php5/mods-available/gdal.ini

and paste this code:

; configuration for GDAL module
extension=gdal.so

Save it with CTRL + X. Then:

sudo php5enmod gdal
service apache2 restart

And then you done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.