View the Most Wanted LQ Wiki articles.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 06-14-2010, 01:08 PM   #1
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:"

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: 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;
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

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
lrwxrwxrwx 1 17 May 21 11:53 ->
lrwxrwxrwx 1 17 May 21 11:53 ->
-rwxr-xr-x 1 34245042 May 21 11:53

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 -> ../
-rw-r--r-- 1 1134 May 21 11:49 libgdal.lai
lrwxrwxrwx 1 17 May 21 11:48 ->
lrwxrwxrwx 1 17 May 21 11:48 ->
-rwxr-xr-x 1 34245042 May 21 11:48

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

and my my $Path looks like:

[firani@tautog .libs]$ echo $Path

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

Rep: Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394Reputation: 1394

You don't need PATH but LD_LIBRARY_PATH. For the bash shell you can run:
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
before doing your tests.

1 members found this post helpful.


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:" fearfactory Linux - Software 1 05-16-2010 09:30 PM
"error while loading shared libraries:" 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 05:31 AM.

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