LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Linux OS and file format related question. (https://www.linuxquestions.org/questions/linux-newbie-8/linux-os-and-file-format-related-question-157424/)

tusher 03-14-2004 05:09 AM

Linux OS and file format related question.
 
Hi,

I am looking for some documentation/resource that describe .. how linux OS works and how the application interacts with OS after compiling from source code.

Actually i mean to say, what happens when any application or package compiled from source code,

1. what is .pc file ? what about .so file and what does ldconfig command do?

2. why there are two pkgconfig directory ?

/usr/lib/pkgconfig
/usr/local/lib/pkgconfig

3. what does lpdconf command do?

4. what happen if i edit any new path at /etc/ld.so.conf file?

any idea ? plz help.

Thanks,

Oliv' 03-14-2004 07:51 AM

Hello,

I can't answer to all your questions, but I have some answers ;)
1) a .so file is a shared objetc file: A library which is dinamically loaded at program execution. To see the program .so dependencies, do:
ldd program_name

1) and 4) ldconfig is an application which read /etc/ld.so.conf file to know where .so can be located. By default, ldconfig knows that they are by default either in /lib or in /usr/lib, that's why when you install a program with .so located in strange directories (/home/foo/lib for example), you need to edit /etc/ld.so.conf to add this path and then run ldconfig to permanently add this path. There's another solution: it's to use LD_LIBRARY_PATH environnement variable. If you don't do that when you run your program, you will have an error message about a .so which can't be loaded or located ;)

Oliv'

Pres 03-14-2004 08:27 AM

3) lpdconf is very probably a "line printer daemon configure" utility, but I can't be certain as I don't have it. Try the man pages for these things, "man ldpconf" for example.

tusher 03-14-2004 10:55 PM

Hi Oliv',

Thnx for ur reply. u told "There's another solution: it's to use LD_LIBRARY_PATH environnement variable."

but i got from error message and the message suggest to fix PKG_CONFIG_PATH environment variable. I did it with

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH: /what/the/directory/is
command. but once i turned the pc off, it seemd like, the configuration was gone. anyway to make it permanent?

2. do u know difference between this two variable? LD_LIBRARY_PATH and PKG_CONFIG_PATH?

3. what is pkg-config ?

(Thnx Pres, for the lpdconf, but i did a mistake typing ldconfig..so it appears lpdconf.

Thnx all of you once again.

tusher 03-14-2004 11:06 PM

file format related questions.
 
Hi,

can anyone tell me what is .pc and what about .so file format? is they something like .dll file of windows ? if so, whats the difference between .pc and .so?

how to know about all environmental variable used on linux OS ? Is there any documentation of it?

thnx in advance,

ProtoformX 03-14-2004 11:10 PM

.pc tells pkg-config where and what the lib contans
and .so are libs

SciYro 03-14-2004 11:17 PM

.so are like .dll

also remember that some programs use mime type and not extensions to identify programs (windows uses extension only to tell that files are what, its really quite sad as i can rename a picture to something.exe and windows try to run it, sad, really really really sad

type
Code:

export
in the bash prompt, that should list all the environment variable it sees

MS3FGX 03-14-2004 11:46 PM

its really quite sad as i can rename a picture to something.exe and windows try to run it, sad, really really really sad

Kind of like how if I do chmod a+x on a jpeg, Linux will think it is a binary file and try to execute it...

tusher 03-15-2004 01:02 AM

Hi ProtoformX,

so, pkg-config something like registry of windows? or what?

tusher 03-15-2004 01:05 AM

Note, i m not comparing linux and windows, but trying to figure linux's working procedure...Is there any documentation on it? Like, how the Os work..and how later installed source application interact with the OS..where the registry maintains...etc..etc..

thnx.

Oliv' 03-15-2004 12:07 PM

Hi Tusher,

Quote:

anyway to make it permanent
add the command either in /etc/profile script to make it permanent for everyone or in ~/.bash_profile for specific user
Quote:

what is pkg-config ?
Here is a very good def from man page :)
Quote:

The pkg-config program is used to retrieve information about installed libraries in the system. It is typically used to compile and link against one or more libraries.

So pkg-config is used for compilation whereas ldconfig is used for execution. That means PKG_CONFIG_PATH is used to know were I can find pkg-config exec and LD_LIBRARY_PATH is used in addition of /etc/ld.so.conf file and ldconfig utility to find where shared libraries are located.
Hope that I'm clear enough :)

Oliv'

Komakino 03-15-2004 12:26 PM

There are two pkgconfig directories because there needs to be one wherever .so files are stored (i.e. /usr/lib /usr/local/lib could both hold libraries and therefore each needs a pkgconfig directory). The .pc files in the pkgconfig directories hold information about the library so that a programmer can retrieve all the information they need to compile programs using the library more easily. For example, say I was writing a program using glib and needed to know where to find the include files, I could type:
Code:

pkg-config --cflags glib
or include that as part of a Makefile to find exactly what was needed. Try it yourself. Or try:
Code:

pkg-config --list-all
To see all installed libraries.

Tinkster 03-15-2004 12:49 PM

Quote:

Originally posted by tusher
Hi ProtoformX,

so, pkg-config something like registry of windows? or what?
No, not in the least ... it's Gnome's way of telling
programs about relationships between files ...

There may well be systems out there that don't
have any .pc files :}

Quote:

where the registry maintains...
Thanks goodness there's no such abomination in
Linux ... all programs/daemons have their own individual
configuration files, which -as a rule of thumb- are
plain ASCII files.


Cheers,
Tink

XavierP 03-15-2004 01:48 PM

This thread is being merged with your other thread. If you need to expand on a question please post it in your original thread, do not start a new thread.


All times are GMT -5. The time now is 06:49 PM.