Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.
find | grep libc.so.6

reveals that it's in /lib/i386-linux-gnu/libc.so.6, but a script I was running expected it to be directly under /lib, so why isn't there at least a symlink?

Would I risk breaking anything if I put a symlink there?

share|improve this question
add comment

3 Answers 3

up vote 14 down vote accepted

libc.so was moved as part of the multiarch work in Ubuntu 11.04. The reason that there can't be a symlink there is that the purpose of multiarch is to make it possible to install both the i386 and amd64 versions of libc at the same time so that you can run 32-bit binaries more easily on 64-bit systems and vice versa (and other similar situations). If the libc6 package contained a symlink to the new location, then the versions of that package for different architectures wouldn't both be installable at the same time (which version of the symlink would dpkg pick?), defeating the entire point of the exercise.

Anything that hardcodes the path to libc.so must be updated to work properly from Ubuntu 11.04 onwards. If the script you're talking about is part of Ubuntu, please report a bug on it and add the multiarch tag.

share|improve this answer
1  
Nice answer, learned something new today (again) :) –  Lekensteyn May 5 '11 at 20:00
    
The processor I'm using doesn't even support 64 bit instructions. Would you say there's any risk associated with manually adding a symlink? Not sure I need to do that, but if. Anyway, this seems to be the correct answer. Thanks. –  Erik B May 5 '11 at 20:30
    
@Erik B: what? Are you telling me you're trying to use a 64 app on a 32 bits processor? That's definitely not going to work. 32 bits apps work fine on a 64 bits processor, but not vice versa. –  Lekensteyn May 6 '11 at 7:41
    
@Lekensteyn that's definitely not what I'm saying. What I'm saying is that I have no use for the 64 bit library. So on my particular system there's not going to be any confusion about whether /lib/libc.so.6 is the 32 or 64 bit library. –  Erik B May 6 '11 at 7:53
3  
If you're never going to use 64-bit packages, I doubt there's any significant risk in adding a symlink, no. –  Colin Watson May 6 '11 at 7:58
add comment

Dynamic libraries are loaded by the kernel, the paths are not hardcoded in a program. A program just says "I need libc.so.6". The system then searches in library paths as defined in /etc/ld.so.conf, including /usr/lib and /lib by default. This file includes additional configuration files in /etc/ld.so.conf.d.

On my 64 bits system, libc.so.6 can be found in /lib/x86_64-linux-gnu/libc.so.6 because of the path defined in /etc/ld.so.conf.d/x86_64-linux-gnu.conf:

# Multiarch support
/lib/x86_64-linux-gnu
/usr/lib/x86_64-linux-gnu

To find out what library is loaded by a program, use ldd as in ldd /bin/bash:

    linux-vdso.so.1 =>  (0x00007ffff1dff000)
    libncurses.so.5 => /lib/libncurses.so.5 (0x00007f9d8b3b8000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f9d8b1b4000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9d8ae1f000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f9d8b61c000)

Putting the symlink would not break anything.

To get a list of directories that are searched, run:

ldconfig -v -N | grep '^/'

-v causes a list of file + directories to be shown, -N prevents the cache (/etc/ld.so.cache) from being recreated.

share|improve this answer
    
Putting the symlink would not break anything, but it wouldn't really do anything good either, right? –  Erik B May 5 '11 at 17:33
    
@Erik B: what program / script are you referring to? I can understand that a script gets confused because the path is hardcoded. But a program does not have to know the path. –  Lekensteyn May 5 '11 at 17:38
    
Is that how it works? I seem to have issues sometimes where programs cannot find libraries installed in /usr/local/lib, but they work fine if I make a symlink from /usr/lib. What causes this behavior? –  crazy2be May 5 '11 at 23:33
    
@crazy2be: can you post the output of ldconfig -v -N | grep '^/' ? –  Lekensteyn May 6 '11 at 7:42
    
@Lekensteyn: Sure: pastebin.com/dtfnw2Tv. It's happened with some programs on almost any system i've used, however, so I assumed it was not related to system configuration. –  crazy2be May 7 '11 at 2:57
show 1 more comment

Just add symlink to the libc.so.6 file as following:

sudo ln -s /lib/i386-linux-gnu/libc.so.6 /lib/libc.so.6

The same goes for other missing files still on the system, in my case Matlab was missing the file, the problem is gone now.

share|improve this answer
add comment

protected by Community Sep 2 '12 at 17:10

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

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