LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices



Reply
 
Search this Thread
Old 06-14-2010, 01:08 PM   #1
firani
LQ Newbie
 
Registered: Jun 2010
Location: Severna Park, MD
Distribution: Red Hat Enterprise Linux v.4
Posts: 1

Rep: Reputation: 0
Post 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

Last edited by firani; 06-14-2010 at 01:10 PM.
 
Old 06-14-2010, 02:05 PM   #2
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,975

Rep: Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343Reputation: 1343
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
 
1 members found this post helpful.
  


Reply

Tags
error, g++, libraries, time


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] XFburn, Slackware 13 64bit, "error while loading shared libraries: libburn.so.4" fearfactory Linux - Software 1 05-16-2010 09:30 PM
"error while loading shared libraries: libstdc++.so.5" shiv_379 Linux - Newbie 6 03-30-2009 03:30 PM
Did something get installed wrong? "error while loading shared libraries" Romanus81 Slackware 4 03-29-2008 12:11 AM
Linux boot hang : "init: error loading shared libraries" colinprice72 Linux - General 0 01-16-2004 10:04 AM
"Error while loading shared libraries" - different solutions? stodge Programming 3 05-11-2003 03:19 AM


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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration