LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   At run time get: "Error while loading shared libraries: libgdal.so.1:" (https://www.linuxquestions.org/questions/linux-newbie-8/at-run-time-get-error-while-loading-shared-libraries-libgdal-so-1-a-814085/)

firani 06-14-2010 12:08 PM

At run time get: "Error while loading shared libraries: libgdal.so.1:"
 
I am trying to implement the GDAL I/O libraries as a LINUX Newbie.

When I run the test executable after my compile and link I get the error:

[firani@tautog gdal-1.7.1]$ ./test
./test: error while loading shared libraries: libgdal.so.1: cannot open shared object file: No such file or directory

I do not know how to trace this problem further, but I am still digging.

I first managed to build gdal and my admin person installed it for me. I am trying to compile and link the code below using the following command as a test case (I am not running as su):

g++ -L/home/firani/USGS/gdal/gdal-1.7.1/.libs -lgdal -o./test test.cpp

#include "gdal_priv.h"

int main()
{
GDALDataset *poDataset;
GDALAllRegister();
poDataset = (GDALDataset *) GDALOpen( "urbgd001.dat", GA_ReadOnly );
if( poDataset == NULL )
{
printf("poDataset is null/n.");
}
}

My link libraries exist locally in my own directories as well as in the /usr/local/lib directories:

[firani@tautog gdal-1.7.1]$ locate libgdal
/usr/local/lib/libgdal.so.1
/usr/local/lib/libgdal.so
/usr/local/lib/libgdal.so.1.14.1
/usr/local/lib/libgdal.la
/usr/local/lib/libgdal.a
/home/firani/USGS/gdal/gdal-1.7.1/wince/libgdal.la
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.lai
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.a
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.so.1
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.so.1.14.1
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.la
/home/firani/USGS/gdal/gdal-1.7.1/.libs/libgdal.so
/home/firani/USGS/gdal/gdal-1.7.1/libgdal.la


under /usr/local/lib my libraries look like this:

[firani@tautog lib]$ ls -log *gdal*
-rw-r--r-- 1 78499986 May 21 11:53 libgdal.a
-rwxr-xr-x 1 1134 May 21 11:53 libgdal.la
lrwxrwxrwx 1 17 May 21 11:53 libgdal.so -> libgdal.so.1.14.1
lrwxrwxrwx 1 17 May 21 11:53 libgdal.so.1 -> libgdal.so.1.14.1
-rwxr-xr-x 1 34245042 May 21 11:53 libgdal.so.1.14.home

under my local directory my .libs libraries look like this:
[firani@tautog gdal-1.7.1]$ cd .libs
[firani@tautog .libs]$ ls -log *gdal*
-rw-r--r-- 1 78499986 May 21 11:49 libgdal.a
lrwxrwxrwx 1 13 May 21 11:49 libgdal.la -> ../libgdal.la
-rw-r--r-- 1 1134 May 21 11:49 libgdal.lai
lrwxrwxrwx 1 17 May 21 11:48 libgdal.so -> libgdal.so.1.14.1
lrwxrwxrwx 1 17 May 21 11:48 libgdal.so.1 -> libgdal.so.1.14.1
-rwxr-xr-x 1 34245042 May 21 11:48 libgdal.so.1.14.1

I have played around tih my $Path and $PATH environmenal values trying to point to these locations but have had no luck running after recompiling with any combination

Currently my $PATH looks like:

[firani@tautog .libs]$ echo $PATH
.:/home/firani/USGS/gdal/gdal-1.7.1/.libs/:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/firani/bin

and my my $Path looks like:

[firani@tautog .libs]$ echo $Path
.:/home/firani/USGS/gdal/gdal-1.7.1/.libs/:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin

bathory 06-14-2010 01:05 PM

Hi,

You don't need PATH but LD_LIBRARY_PATH. For the bash shell you can run:
Code:

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
before doing your tests.

Regards


All times are GMT -5. The time now is 06:25 AM.