/srv/irclogs.ubuntu.com/2013/03/12/#ubuntu-my.txt

excalibrgasp..08:09
excalibrhyperair: you there?08:28
hyperairno08:29
excalibrany idea why most *.so in /usr/lib have symlinks point back to those *.so?08:35
angchexcalibr: ? just pointing to the latest version.08:36
excalibrbut why the need for symlinks..08:38
hyperairexcalibr: library versioning.08:38
angchso you get the latest dot version/..?08:38
hyperairlibraries typically read the SONAME from within the librar (objdump -p $lib) and add them to the REQUIRED list08:39
hyperairor was it NEEDED08:39
hyperairi think08:39
hyperairer08:39
hyperairsorry08:39
hyperaircompilers read the SONAME from within the library, and add NEEDED entries into the ELF header of the output file08:40
hyperairthe SONAME typically looks like  libfoo.so.108:40
hyperair.1 indicates that this is ABI version 108:40
hyperairwhen this number changes, ABI is broken08:40
hyperairwhen ABI is broken, your program will crash08:40
hyperairso you'll need to recompile it08:41
hyperairhence, libraries are typically stored in one of the LD_LIBRARY_PATHs as libfoo.so.108:41
hyperairand libfoo.so.2 can be co-installed with libfoo.so.108:41
hyperairso you can have legacy apps that still require libfoo.so.1 installed alongside new apps that use libfoo.so.208:42
hyperairwhen you compile, you typically do something like gcc -lfoo ...08:42
hyperair"foo" gets translated by gcc into libfoo.so08:42
hyperairand so libfoo.so will point to the appropriate library08:43
hyperairappropriate library version, i mean08:43
excalibrso when you build and install a custom library, which file should you point to ldconfig to update your lib cache? the symlink or its real .so ? or either is fine?08:43
hyperairyou don't08:43
hyperairyou just dump your library into one of the ld paths, and then run ldconfig08:44
hyperairthat's all ther eis08:44
hyperairin ubuntu we have libfoo.so inside the -dev package08:44
hyperairas in the symlink08:44
hyperairbecause you only need that when compiling08:44
hyperairlibfoo.so.1 is inside the libfoo1 package08:45
hyperairwhich will be depended upon by packages that are compiled against it08:45
excalibrthat's some lengthy explaination :P ok if i understand you correctly, soname inside the library file is what define the lib version, not the number after .so. on its filename?08:59
excalibror not?09:20
angchexcalibr: i think you don't fully grok it.09:22
angchrun a program , program needs foo.so.0. it is symlinked to foo.so.0.1 which is the actual one installed. latest for now. when upgraded to foo.so.0.2, it still points to foo.so.0 but it is now symlinked to foo.so.0.209:23
angchprograms refer to symlink to find the latest version (with same ABI (?).09:24
angchso you don't have to muck with programs to use the latest version.09:24
angchjust dereference the symlink.09:24
excalibrangch: i understand that part what i dont understand is..09:35
excalibri built a lib with soname libfoo.so.0 during compile and named the output file as libfoo.so.4.2 - when i ran ldconfig i notice it created a symlink named corresponding to the soname, libfoo.so.0 which points to libfoo.so.4.209:38
excalibrso that means program that needs libfoo.so.0 can still find the lib right?09:40
excalibrbut actually it can't09:40
angch*shrug* no idea, sorry, not gonna just simple stab at an answer.09:41
excalibror do i totally misunderstood hyperair and your explaination?09:41
angchi totally don't get your question. :-/ sorry.09:42
excalibralamak09:43
hyperairangch: no, you've got it wrong.09:44
hyperairwait09:44
hyperairsorry, read wrongly09:44
hyperairthat's pertty much so09:44
hyperairexcalibr: basically when you compile your program against libfoo.so, you'll do something like gcc foo.c -lfoo09:45
hyperairexcalibr: this makes gcc look into /usr/lib/libfoo.so09:45
hyperairor these days, /usr/lib/x86_64-linux-gnu/libfoo.so09:45
excalibr:D09:45
hyperairlibfoo.so is a symlink to libfoo.so.009:45
hyperairthe linker reads the SONAME field out of libfoo.so.009:46
hyperairwhich you can get by objdump -p /usr/lib/libfoo.so.0 | grep SONAME09:46
hyperairobjdump -p /usr/lib/libkate.so.1| grep SONAME                                                                                                                           [ 5:46PM] SONAME               libkate.so.109:46
hyperair% objdump -p /usr/lib/libkate.so.1| grep SONAME SONAME               libkate.so.109:47
hyperairbah09:47
hyperairwhatever09:47
hyperairafter the first SONAME there's a newline there09:47
angchhyperair: dunno. ldd /bin/ls should give a better picture to explain things, imho.09:47
hyperairangch: no, i want to show the SONAME.09:47
angchok09:47
hyperairas in i'm explaining the anatomy of a library09:47
excalibrhyperair: then when you run the program, does it look for libfoo.so or libfoo.so.0?09:48
angchi'm lost as to the question in the first place...09:48
hyperairexcalibr: so anyway, after whatever's in the SONAME gets added to your application under NEEDED09:48
hyperairwhich you can see when you do ldd /bin/ls09:48
hyperairor objdump -p09:48
hyperairexcalibr: try out the commands i gave you09:48
hyperair objdump -p /bin/ls | grep NEEDED09:48
hyperair  NEEDED               libselinux.so.109:48
hyperair  NEEDED               librt.so.109:48
hyperair  NEEDED               libacl.so.109:48
hyperair  NEEDED               libc.so.609:48
hyperairwhen you run the program, the linker looks for everything that's listed there09:49
hyperairexcalibr: as for your ldconfig question..09:50
hyperairthat's because it's not the file name that matters, it's the SONAME.09:50
hyperairyou must get your SONAME correct09:50
excalibrhyperair: does that mean if the version in lib's soname and one on its filename doesn't match each other, a program that uses the lib could still find the lib and run fine as long as the lib's soname is correct?10:00
hyperairno10:00
excalibrjust now you said filename name doesnt matter?10:01
hyperair"libfoo.so.0" is copied from the SONAME of the library, into a NEEDED entry of your output binary.10:01
hyperairwhen you run your binary, the dynamic loader looks for libfoo.so.0 inside your LD_LIBRARY_PATH10:01
hyperairhowever, if you get your SONAME wrong, e.g..10:02
hyperairyou have /usr/lib/libfoo.so.0, with a SONAME of libbar.so.010:02
hyperairthen your output binary will have a NEEDED entry saying libbar.so.010:02
hyperairso your dynamic loader will look for libbar.so.0 instead of libfoo.so.010:03
hyperairand since the file doesn't exist, it'll fail10:03
excalibrit'll still fail even if you make a symlink named libbar.so.0 pointing to libfoo.so.0?10:06
hyperairoh then it'll work.10:08
hyperairyou have to understand that the loader isn't very smart10:08
hyperairit's simple10:08
hyperairit just looks for /usr/lib/$SONAME10:08
hyperairand the linker just encodes the SONAME from the library into a NEEDED entry of the binary10:09
hyperairexcalibr: http://paste.debian.net/241167/ <-- see this10:15
excalibrhyperair: about that code paste, i got what you're trying to say13:21
hyperairgood13:21
hyperairthen it served its purpose :)13:21
excalibryea thanks so much :)13:26
hyperairno problem :)13:27
=== shah- is now known as EggDrops

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!