By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
426,012 Members | 988 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 426,012 IT Pros & Developers. It's quick & easy.

ld.so.1: fatal ImportError: ld.so.1 No such file or directory

P: n/a
solaris/linux admins/rookie_developers that battle with this error are
probably all frustrated when it happens. i bet you're also somehow
frustrated by this seemingly unsolvable error :-) ...take it easy,
it'll go away once u've learned how to play around with a few things
on your system and reorganised. i'm particulary a solaris junkie, but
linux is my admiration. the issue here is Not the OS/Software, but
rather the concept. first of all , i've learned that people who
normally hit this error are those that somehow DOWNLOADED some
packages (so-called free/open-source) from the internet with a hope of
using the package to solve some inhouse problem. normally the package
installs FINE but just when you try to run it... BOMB!! and then u
spend 5 days battling with it and NOTHING good comes out of it and
finally, you come here ...still frustrated :-( chill ..it happened to
me plenty of times too. nuff said...

here's a typical extract of the ghost you've seen. you've probably
been battling with this for quite a while...
ld.so.1: fatal
No such file or directory
ImportError: ld.so.1

first you have to appreciate something about dynamic objects. dynamic
objects is a fancy term for programs that use DLLs (both windows and
unix programs can have DLLs). if you're Not familiar with dynamic
objects, then pls read section-3 which is right at the END of this
post. otherwise start with section-1 right here below...

section-1 (John Hunter's opinion)
################################################## #######
This problem typically arises when the program was compiled and
installed in one environment and executed in another. When it was
compiled, the compiler could find libgcc_s.so.1, but when it is
executed, the shared library is not in your LD_LIBRARY_PATH.
You probably do not need to recompile your program (unless it was
compiled on another system or with a cross compiler). First try and
find the dir on your system in which libgcc_s.so.1 resides. Three
suggestions:

If you have gnu findutils, just do 'locate libgcc_s.so.1'. Otherwise,
try:
# ldd /path/to/your_program
This will list the shared libraries that your_program needs and where
they are. If you can't find it that way, try:

# find /usr -name libgcc_s.so.1
or
# find /opt -name libgcc_s.so.1

you've GOT to finnd the missing file! if you still can't find it, I'll
guess that it's not on your system and your_program was compiled on
another machine. If you do find it here's how to modify
LD_LIBRARY_PATH so you can see it when you execute your_program.
Suppose you found it in /some/dir/lib

If you are a csh/tcsh user
# setenv LD_LIBRARY_PATH /some/dir/lib:$LD_LIBRARY_PATH

the line above is One long line, it's NOT two lines, it might be
wrapping on this newsgroup screen, so make sure you type it in as One
long line!..and also same applies to the other ones below.

If you are a bash/bourne/ksh user
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/some/dir/lib

This command above should go in your rc file, eg, ~/.tcshrc, ~/.cshrc,
or ~/.bashrc, ~/.kshrc. Now open up a new shell/xterm, and try typing
your_program again. just run it without any parameters.

If you are still having trouble, make sure that your environment
variable are set correctly with:

If you are a csh/tcsh user
# setenv | grep LD |more

If you are a bash/bourne/ksh/zsh user
# echo $LD_LIBRARY_PATH

You should see the dirs you entered in for LD_LIBRARY_PATH.

Good luck,
John Hunter

section-2 (my opinion)
################################################## #######
in addition to john's stuff above, there is a trick about unix's
symbolic links which i'm gonna base my opinion on. my opinion
therefore applies in the case where the xx.so.x file is actually THERE
on your system but the error still says that
'No such file or directory' even when LD_LIBRARY_PATH is properly set
and exported.

what you have to do is to run the ldd command again (as above in
john's post) and look carefully at what it reports. Not ALL of the
xx.so files should be reported problematic, ONLY SOME of them will be
reported as 'Not found'. now my opinion revolves around the idea of
finding the place/directory where the GOOD ones are sitting. once
you're in this directory, u can then make a symbolic link to the xx.so
that's giving you a problem. NB: the link must be in the
place/directory where the good xx.so files are sitting. this will fool
the OS/ld into thinking that your missing xx.so file is actually now
in the right place. NB: DON'T move your troublesome/missing xx.so file
into the place/directory where the good xx.so files are sitting
....just create a symbolic link in the good directory, the link will
just point to the troublesome/missing file whereever it is sitting.

let's say for instance that the '/etc/maria.so.1' file is giving you
trouble and is being reported as 'No such file found' and u've tried
everything such as setting LD_LIBRARY_PATH and you're tired. now let's
be explicit and say that you get the error when you run the 'python'
command. the command you're running does Not matter, it could be
'openssl' or 'samba' or 'ssh' or 'wget' or 'apache' or even 'java'
itself, the error is the most interesting thing here cuz it's likely
to always be the same (ld.so.1: fatal No such file or directory).
let's assume that u're running the 'python' command. what you would
then do is
# ldd /full/path/to/python_binary
now observer carefuully what the ldd command above reports to you.
it'll show that SOME of the xx.so.x files are Not found. good. now
FORGET the missing one, now look at those that are OK. use the find
command to find onne/more of those ones that are OK, go to the
directory where you found one of them (let's say it's /usr/lib), once
you're there, create a symbolic link to your missing file
(/etc/maria.so.1). i hope you know where your missing xx.so file is
sitting (/etc/maria.so.1), cuz you've probably confirmed taht it DOES
EXIST indeed and you know exactly where it is. so create the link to
it as follows...
# cd /usr/lib
in this case above, /usr/lib is our directory with good xx.so files.
# ln -s /etc/maria.so.1 maria.so.1
in this command above, it might be necessary to use FULL paths.

now make sure that your LD_LIBRARY_PATH is set properly and EXPORTED.
now fire up your 'python' or 'samba' or 'apache' or whatever command
that complained about the missing xx.so.x. what does it say NOW??

it might now complain about ANOTHER xx.so.x (Not the same one as the
first one anymore), well... i guess u've figured out how we've solved
the problem for the first one. do the same for the second one and the
third one and so on. just create a link for it in the directory with
good xx.so files just like the first one. repeat this process for all
your missing xx.so.x (as long as you know that you have them on your
system). yeah, that's all about my suggestion.

should my suggestion fail, well, then you have a lot to read about ld,
etc. Listen, i know man pages are Not the most exciting thing to
read, but you have to read them with an open mind (Don't try to rush
into finding quick answers cuz that's gonna frustrate you more) ...
try section-3 below, but then you're on your own. i'm Not gonna
comment on anything about section-3 below. after you read, hopefully
something will click in your mind about what's happening on your
specific system.

as a semi-final Note: DONT clutter your system, when u make the links
above, do them one-by-one, DON'T use a shell script. DON'T create
links for any xx.so.x files that are NOT causing you trouble. a rule
of thumb is to always keep a text file (Notepad) so that you have a
log of ALL the links you've made cuz this process of creating symbolic
links for UNresolved xx.so.x files will have FUTURE consequences and
you DON'T wonna be caught by suprise in the future when something that
WAS working in the past is NO LONGER working ..while the new stuff is
WORKING just ok :-) it's therefore important to REMEMBER that you once
created an override link for a troublesome library file and this
override link could be the cause of trouble with something else in the
FUTURE, with a clear mindset (keeping logs of ALL previous/original
settings) you could easily reverse the system's config and walk away
clean. so it's important for you to be able to REVERT even when the
problem gets solved today and things seem to be working ok!!

as a final-FINAL Note: i'm not responsible for any files that get
deleted or that disappear from your system when you use my advice cuz
they way i see it, when u use my advice you're somehow
hacking/overriding your system's config. u do this solely at your own
discretion/risk. you came here without my invitation, and you're
reading this without my invitation either. i did Not send u this info
by email, etc. so just keep me out of it.
section-3 (general info on ld)
################################################## #######
http://mirrors.ccs.neu.edu/cgi-bin/u...-cgi?ld.so.1+1
http://www.unidata.ucar.edu/cgi-bin/man-cgi?ld.so.1+1
http://bama.ua.edu/cgi-bin/man-cgi?ld.so.1+1

___________________________________________
Moses Motlhale - Solutions Architect
24th Century Solutions, South Africa.
Jul 18 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
o'seally schreef:
[rant]
___________________________________________
Moses Motlhale - Solutions Architect
24th Century Solutions, South Africa.


Well, I had use CTRL-F to find the references to python --
my first impression was that python was not even referred to in
any way. Still, the question that comes to mind is:

exactly what solution are you trying to find
for exactly what python problem?

Ruud de Jong, private python enthousiast

Jul 18 '05 #2

P: n/a
i'm Not trying to find a solution for a python problem, i'm in fact
posting a solution to the notorius "ld.so.1: fatal ImportError:
ld.so.1 No such file or directory" error that many people are
complaining about on the newsgroups/internet. when they search on
google for this kind of error, they'll find a link to my
comments/advice/suggestions. i would think that would be very helpful
to them.
Jul 18 '05 #3

P: n/a
i checked my original posting again. the word 'python' appears a
couple of times in it, so python is indeed being referred to. read my
original posting slowly/carefully again, you'll see it.
Jul 18 '05 #4

P: n/a
o'seally schreef:
i'm Not trying to find a solution for a python problem, i'm in fact
posting a solution to the notorius "ld.so.1: fatal ImportError:
ld.so.1 No such file or directory" error that many people are
complaining about on the newsgroups/internet. when they search on
google for this kind of error, they'll find a link to my
comments/advice/suggestions. i would think that would be very helpful
to them.


Well,

This was not obvious from a first reading. I read your original post
again, and basically you say:

Problem: fatal ImportError: xx.so.n No such file or directory
Solution: make the file xx.so.n visible through LD_LIBRARY_PATH

Duh. This is essentially identical to the solutions that have been
offered time and again whenever this or a similar problem is reported.
Your post differs from most others because:
* it was not in response to a problem, making it more difficult to
discover the intention of the post;
* you needed over 100 lines of text to provide this solution;
* the liberal use of CAPITALS (which gives your post a rather
spam-like appearance);
* the digression on irrelevant subjects (why bring free or open source
software in the discussion?)

Because of the low signal/noise ratio, I did not recognize this
to be a solution for a problem that happens from time to time.

On the contents of your post: you suggest to create symbolic links
in one of the directories in LD_LIBRARY_PATH to make the required
files visible, instead of appending their directory
to LD_LIBRARY_PATH. Be aware that symbolic links make the
files visible to *all* applications -- you may not always want that.
Manipulating the LD_LIBRARY_PATH environment variable gives you
more flexibility, and you also don't need root privileges to do so.
You can also choose to manipulate LD_LIBRARY_PATH via a shellscript
wrapper for the actual program you want to run; this is especially
useful when there are naming collisions.

Regards,

Ruud.

Jul 18 '05 #5

P: n/a
o'seally schreef:
i checked my original posting again. the word 'python' appears a
couple of times in it, so python is indeed being referred to. read my
original posting slowly/carefully again, you'll see it.


I did not claim that python was not referred to -- I said that
that was my first impression, as you could have read in my
first reaction. No need to read slowly or carefully, you cannot
really miss it -- unless you want to.

Jul 18 '05 #6

P: n/a
Ruud de Jong <ru**********@consunet.nl> wrote in message news:<40**********************@dreader2.news.tisca li.nl>...
o'seally schreef:
i checked my original posting again. the word 'python' appears a
couple of times in it, so python is indeed being referred to. read my
original posting slowly/carefully again, you'll see it.


I did not claim that python was not referred to -- I said that
that was my first impression, as you could have read in my
first reaction. No need to read slowly or carefully, you cannot
really miss it -- unless you want to.


==>it was not in response to a problem, making it more
==>difficult to discover the intention of the post;

google/usenet groups are Not only for *solving problems* or nagging
people about this and then that, and then that, etc. newsgroups are
also useful for sharing information Openly. always bear in mind that
what you find useless and totally unnecessary can come out to be the
most useful advice/opinion for *someone else*, ..cuz even if it might
be infested with a lot of junk, it might contain just One Word of
advice that someone has been needing for many years!
the intention of this post is therefore simple:.. should someone hit
this problem and start searching on google/teoma/etc, he is very
likely to be interested in any place/page that contains the words
equivalent to those in the error he saw. most pages DON'T have enough
detailed info about this error. check it out yourself, try and search
for pages with Detailed info about this specific error and you'll find
very few.

many times even when LD_LIBRARY_PATH is set **and exported** this
problem will still manifest. check the posts around and you'll find
many people that say that they **Have** set and exported
LD_LIBRARY_PATH and it gave no luck. the reason is because it's hard
to tell when ld is running and calling/loading many .so files which in
turn load more .so files ..it's hard to track whether this variable is
up-to-date in all these calls. in fact, many times the updated
LD_LIBRARY_PATH does Not seem to maintain its updated value through
nested/stacked calls that all result from ld's first run/call.
==>you needed over 100 lines of text to provide this solution;

of course i need over 100 lines. does this mean those who benefit from
my solution will have to type a bash/unix script of 100 lines? ..No
no, they'll simply create symbolic links. but then why did i Not just
type one line and say "create symbolic links" ? well, many newbies
Don't necessarily have the in-depth knowledge of doing this
neatly/smoothly. some of them would ask me ...symbolic links to what?
many developers are Not sys admins and therefore they may Not be that
quick/up-to-speed with symbolic links. i realize i Can't cater for
every layman, but at least i should go as low/grassroot as i can.
==>the liberal use of CAPITALS (which gives your post
==>a rather spam-like appearance);

i apologize for my liberal use of caps, sorry for the liberal use of
caps, i simply had to ensure that words like *not*, *can't*, etc are
Not easily skipped by those fast readers. but a person who has spent
nights battling with an ld problem will consider anything that seems
to talk about the error he's battling with. he'll try anything to get
that error fixed, and he'll keep searching even in spam-like places.
well, at least it **appears spam-like**, it is Not quite spam.
==>Duh. This is essentially identical to the solutions
==>that have been offered time and again whenever this or
==>a similar problem is reported.

once again read my post slowly/carefully. the advice about
LD_LIBRARY_PATH is Not what my opinion is centered around. i clearly
stated at the beginning of it that it is someone else's opinion (John
Hunter's opinion). there is a place that's clearly marked as "my
opinion" in addition to John's opinion. my opinion is centered around
symbolic links. now i want you to find out (search the net) and
discover for yourself how many posts are *identical* to my opinion. to
your suprise, you will Not find many. Do it now. ..on the other hand,
talking about identicals ..you'd be surprised to find out how many
places on the net have an **Identical** copy of the unix man pages,
you'll be truly amazed :-)
==>Be aware that symbolic links make the files visible to
==>*all* applications -- you may not always want that, bla bla bla.

once again in my original post i said ...
as a final-FINAL Note: i'm not responsible for any files that get
deleted or that disappear from your system when you use my advice cuz
they way i see it, when u use my advice you're somehow
hacking/overriding your system's config. u do this solely at your own
discretion/risk. you came here without my invitation, and you're
reading this without my invitation either. i did Not send u this info
by email, etc. so just keep me out of it.
==>the digression on irrelevant subjects (why bring
==>free or open source software in the discussion?)

i did Not bring these into the discussion. they're the most
insignificant words in my post. but why didn't i leave them out then??
...well, i have to use words when i type. what would u say if i said
your liberal use of the word 'appearance' in your reply above is a
digression from this topic to something irrelevant? wouldn't you
quickly turn around and say to me ...the word 'appearance' in your
reply above was simply an insignificant word. but what if i picked out
that specific word and dwelled on it? wouldn't you find me
UNbelievable? well, man you have to use words when you type/post. are
you aware that even the word 'you' can be isolated and criticized as a
digression by anyone who reads your post and *chooses* to do so.
_________________________________________________
Moses Motlhale - Solutions Architect
24th Century Solutions, South Africa.
Jul 18 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.