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.

This question already has an answer here:

How can I get access to the source code of standard shared libraries?

share|improve this question

marked as duplicate by Rinzwind, Radu Rădeanu, Florian Diesch, Seth, dobey Jan 8 at 20:56

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
See askubuntu.com/questions/167468/… –  Rinzwind Jan 8 at 19:27

1 Answer 1

up vote 2 down vote accepted

It depends on the concrete library you're looking for.

As an example, let's take a look at /usr/lib/liba52-0.7.4.so (this was simply the first file in my /usr/lib directory).

First, let's find out what package the file belongs to:

$ dpkg -S /usr/lib/liba52-0.7.4.so
liba52-0.7.4: /usr/lib/liba52-0.7.4.so

So now we know that the package name is liba52-0.7.4. To download the source code, use

$ apt-get source liba52-0.7.4

Note: no need to use sudo. The latter command will create a directory a52dec-0.7.4/ in the working directory. This contains the source code.

share|improve this answer
    
What if it returns two or more packages? and is there any directory inside the Ubuntu source code for these library-related packages? Thanks again –  Hja Jan 8 at 19:47
    
A single file (such as a shared library) should only belong to a single package, not more. I do not understand your second question. As I said, the apt-get source command will create a directory with the package's source code inside the working directory, that is, the directory you're currently in at the moment where you type in the command. –  Malte Skoruppa Jan 8 at 19:51
    
It is weird since running dpkg -S /usr/lib/libical.so.0 on my laptop returns two package names while running it on my desktop returns only one package name...any way... In second question, I am asking whether I can find the packages for these libraries inside an Ubuntu installation disk containing the source code or not? If so, please let me know where... Thank u once again –  Hja Jan 8 at 19:56
    
Which two package names do you get? For the library you mentioned, the corresponding package is libical0. Concerning your second question, no, the source code of libraries is not contained inside the Ubuntu installation disk. –  Malte Skoruppa Jan 8 at 19:58
    
/usr/lib/libical.so.0 and /usr/lib/libical.so.0.48.0 –  Hja Jan 8 at 20:03

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