[08:34] <coolcat> loot,are u there
[09:02] <sistpoty> hi everyone
[09:03] <sistpoty> anyone around for the library packaging session? (repetition of the session from Thursday)?
[09:05] <Rhi_evil_happ1> hello
[09:05] <RainCT> Hi
[09:05] <Rhi_evil_happ1> hi
[09:05] <sistpoty> hi
[09:06] <sistpoty> you want to hear the library packaging session?
[09:07] <TheMuso> sistpoty: if there is a log from the other one, I am happy to read that, but if this is going ahead in here, I wil idle.
[09:07] <sistpoty> TheMuso: there is a log available, let me look
[09:07] <TheMuso> sistpoty: Thanks.
[09:08] <sistpoty> TheMuso: http://irclogs.ubuntu.com/2008/01/17/%23ubuntu-classroom.html
[09:08] <Rhi_evil_happ1> *looks happy*
[09:08] <TheMuso> sistpoty: Thanks a lot.
[09:09] <sistpoty> TheMuso: and yesterday was part two: http://irclogs.ubuntu.com/2008/01/18/%23ubuntu-classroom.html
[09:09] <TheMuso> right
[09:09] <sistpoty> ok, then let's get started, shall we?
[09:10] <TheMuso> Bookmarked
[09:10] <sistpoty> this session is made up of two parts
[09:11] <sistpoty> in part 1, you'll get to know everything about shared objects
[09:11] <sistpoty> in part 2, we'll package up a sample library and discuss some packaging issues
[09:11] <sistpoty> let's start with part 1
[09:11] <sistpoty> first off, shared objects are useful for two purposes
[09:11] <sistpoty> 1) they can be used as a mechanism for plugins with dlopen
[09:12] <sistpoty> 2) to share code between different projects (a library)
[09:12] <sistpoty> we'll deal with 2) in this session :)
[09:12] <sistpoty> oh, btw.: if there are any questions just ask them right away
[09:13] <sistpoty> a (ELF) shared object is a collection of symbols in different section together with some meta information
[09:13] <sistpoty> a symbol denotes any named entity in C (functions, variables)
[09:13] <sistpoty> let's get an example and see what it will result in

[09:14] <sistpoty> the section a symbol is gives details about it (e.g. it can be executed, it's read only...)
[09:15] <sistpoty> everyone got the example?
[09:15] <ranf> yes
[09:16] <sistpoty> so let's compile it:
[09:16] <sistpoty> gcc -c example.c -o example.o
[09:16] <sistpoty> this will just result in an ordinary object (not a shared one, we'll look at this in a moment)
[09:16] <sistpoty> let's take a look at the symbols in there
[09:17] <sistpoty> we can use  readelf, nm or objdump for it
[09:17] <sistpoty> let's start with
[09:17] <sistpoty> nm example.o
[09:17] <sistpoty> the rightmost column is the name of the symbol... let's compare it with what's in the c-file
[09:18] <sistpoty> http://paste.ubuntu.com/3667/
[09:19] <sistpoty> for example, the global_function from line 26 will turn into the symbol with the same name
[09:19] <sistpoty> 000000000000006b T global_function
[09:19] <sistpoty> anything odd you can find of the symbol output?
[09:19] <RainCT> if I get less zeros at start that's because I've a different arch or what? :P
[09:20] <sistpoty> RainCT: most probably *g*
[09:20] <persia> I get "static_local_var.2268" rather than static_local_var
[09:20] <sistpoty> persia: excellent
[09:21] <sistpoty> first off the static_local_var comes from line 15
[09:21] <sistpoty> as you cannot have two symbols with the same name in one object
[09:21] <sistpoty> static local variables need to have their name mangled
[09:22] <persia> Is that just by policy, rather than by checking to see if there would be a conflict?
[09:22] <sistpoty> because you can define a static local variable with the same name in two different functions
[09:22] <sistpoty> persia: not too sure if you could produce (somehow) an object with two equally named symbols
[09:23] <sistpoty> the linker wouldn't allow this, but maybe it could be circumvented
[09:23] <sistpoty> however the second symbol would never get looked at
[09:23] <persia> sistpoty: Sorry to not be clear: I just don't see two different static_local_var, so wondered if the compiler just added index codes, rather than doing any conflict check.
[09:23] <sistpoty> (you can link two objects with equally named symbols together, but then the second one is discarded)
[09:24] <sistpoty> persia: the conflict check is getting done by the linker
[09:25] <persia> OK.  So the compiler mangles by policy to avoid conflict issues at link-time?
[09:25] <sistpoty> persia: and I guess that the compiler will just add the index for every static local
[09:25] <sistpoty> I believe so
[09:25] <persia> Thanks for the details :)
[09:26] <sistpoty> at least that's what I'd do as a compiler... because I already new that's a static local, so just add an index and not needing to check for collisions afterwards :)
[09:26] <sistpoty> ok, anything else that's odd with the nm output compared to the c-file?
[09:26] <sistpoty> (line 10 *cough*)
[09:27] <sistpoty> in line 10, we've got a variable local_var, which won't result in any symbol
[09:27] <sistpoty> the reason for this is, that it's locally to the function and will get allocated on the stack
[09:27] <sistpoty> hence there's no need to allocate space for it in the object
[09:28] <sistpoty> now let's make a shared object from the example
[09:28] <persia> Was it not optimised away by the compiler?  It's only used once.
[09:28] <sistpoty> persia: not without -O(something)
[09:28] <persia> Ah.  Right.
[09:29] <sistpoty> gcc -Wl,-z,defs -Wl,-soname,libexample.so.1 -fPIC -shared example.c -o libexample.so
[09:29] <sistpoty> the -Wl,something are options gcc will pass to the linker
[09:30] <sistpoty> the first one is only for sanity (allow no unresolvable symbols)
[09:30] <sistpoty> and the second one defines the soname (we'll come to this bit later on)
[09:30] <sistpoty> -fPIC will result in position independent code, but I won't go into details here
[09:30] <sistpoty> and -shared tells gcc to produce a shared object
[09:30] <sistpoty> let's strip the object
[09:31] <sistpoty> strip libexample.so
[09:31] <sistpoty> take a look at it again
[09:31] <sistpoty> nm libexample.so
[09:32] <sistpoty> at first sight, there don't seem to be any symbol information stored in there
[09:32] <sistpoty> let's try again
[09:32] <sistpoty> nm -D libexample.so
[09:32] <sistpoty> this will display dynamic symbols
[09:33] <sistpoty> now compare the output to the one from example.o
[09:34] <sistpoty> at first, there are a number of symbols starting with an underscore... these are (compiler) internals, so we'll ignore these
[09:34] <sistpoty> let's take a look at the letters before the symbol name
[09:34] <sistpoty> as you can see, there are only capital letters left in the shared object
[09:35] <sistpoty> the capital letter means, that the symbol is a global symbol
[09:35] <sistpoty> i.e. other object files linked against it can see it
[09:35] <sistpoty> if it's lower case, it's only visible inside that particular object
[09:36] <sistpoty> (and hence you can link two objects with symbols that have the same name but are only locally visible together w.o. problems)
[09:37] <sistpoty> as the symbols in shared objects are meant to be used by different programs/libraries, we're only interested in global symbols
[09:37] <sistpoty> let's take a look at the letters in more details
[09:37] <sistpoty> the letters describe in what section the symbol lives in
[09:37] <sistpoty> t -> text section (may be mapped readonly), executable
[09:37] <sistpoty> d -> initialized data (statics, initialized globals)
[09:37] <sistpoty> c -> uninitialized data (uninitialized globals)
[09:38] <sistpoty> r -> read only data (const variables), not necessarily read only though.
[09:38] <sistpoty> and then there is a special one: u
[09:38] <sistpoty> u means it's undefined in this object, and comes from another object
[09:39] <sistpoty> symbols that example.c use (for example stderr) but that are not declared in there, will get the U
[09:40] <sistpoty> if you have a binary, that has undefined symbols, these will get resolved by the loader, as soon as the program is executed
[09:40] <sistpoty> any questions so far?
[09:40] <ranf> What is B?
[09:41] <sistpoty> ranf: b is uninitialized data
[09:42] <sistpoty> ranf: so the global extern_var will live there (the initial value is not getting set)
[09:42] <sistpoty> btw.: you can always look at the manpage of nm to find out about the different letters
[09:42] <sistpoty> ok, let's take a look at the meta-information
[09:43] <sistpoty> objdump -x libexample.so
[09:43] <sistpoty> the interesting parts here are
[09:43] <sistpoty> NEEDED entries
[09:43] <sistpoty> and SONAME
[09:43] <sistpoty> if you prefer less output, you can also look at these with
[09:43] <sistpoty> objdump -p libexample.so
[09:44] <sistpoty> the NEEDED entry refer to the SONAME entry of shared objects, that this shared object directly needs
[09:45] <sistpoty> i.e. all undefined symbols in libexample.so will get resolved to the shared object where these are defined
[09:45] <sistpoty> and each shared object where such a symbol comes from is listed as NEEDED
[09:46] <sistpoty> let's compare this with
[09:46] <sistpoty> ldd libexample.so
[09:46] <sistpoty> ldd will basically do the same thing, that the loader would do
[09:46] <persia> How was libexample.so.1 determined?  I usually see some sort of definition in upstream build systems.
[09:47] <sistpoty> persia: it should match the soname
[09:48] <sistpoty> err, sorry the resulting shared object should match the soname by some rules
[09:48] <sistpoty> here it was just what we gave to gcc, w.o. any big thoughts how to call it
[09:48] <persia> sistpoty: Right.  objdump -x or -p reports "SONAME      libexample.so.1"  I just don't understand where the "1" comes from.
[09:48] <persia> Ah.  Right.  The compilation command.  Sorry.
[09:49] <sistpoty> persia: that's exactly what we gave to gcc: -Wl,-soname,<thatnameisthesoname>
[09:49] <sistpoty> if you look at the output of ldd, you can see that
[09:50] <sistpoty> 1) it resolves the needed entries to path names of the shared objects in question
[09:50] <sistpoty> and 2) that there are more entries, not listed in needed
[09:50] <sistpoty> that's because ldd will do lookups recursively
[09:51] <sistpoty> so it will first find libc.so.6 and look at what's needed by that one as well
[09:51] <sistpoty> and list all of these
[09:51] <sistpoty> let's rather look at a real world example to spot the difference
[09:51] <sistpoty> ldd /usr/lib/libgnome-2.so.0
[09:51] <sistpoty> compared to
[09:52] <sistpoty> objdump -p /usr/lib/libgnome-2.so.0 | grep NEEDED
[09:53] <sistpoty> any questions so far?
[09:53] <sistpoty> ok, now let's also compare
[09:54] <sistpoty> nm -D /usr/lib/libgnome-2.so.0
[09:54] <sistpoty> to
[09:54] <sistpoty> readelf -s /usr/lib/libgnome-2.so.0
[09:54]  * RainCT has to go and will check the log when he's back
[09:54] <sistpoty> (or you can also compare libmyexample.so)
[09:54] <sistpoty> cya RainCT
[09:55] <sistpoty> spot any difference?
[09:56] <sistpoty> if you use readelf -s, you'll see that some symbols have an @ in their name
[09:56] <sistpoty> these are versioned symbols
[09:56] <sistpoty> nm will happily not print out that info
[09:57] <sistpoty> so when looking at shared objects for library packaging, you should prefer readelf -s to nm -D
[09:57] <sistpoty> objdump -T libmyexample.so will also display information about versioned symbols
[09:58] <sistpoty> when we have a library, we're interested to have a stable ABI
[09:59] <sistpoty> a stable ABI means that there won't get any symbols removed, and that the symbols mean the same thing
[09:59] <sistpoty> in contrast a stable API means that we can compile a program with one version of the library and can compile it again with another version
[09:59] <sistpoty> w.o. changing the code of the program
[10:00] <sistpoty> let's try s.th. out
[10:00] <sistpoty> http://www.potyra.de/library_packaging/libmyhello-1.0.1.tar.gz
[10:01] <sistpoty> this is a very simple example library
[10:01] <sistpoty> extract it, and compile it with
[10:01] <sistpoty> make
[10:01] <sistpoty> please also install it (as root) with
[10:01] <sistpoty> make install
[10:01] <sistpoty> no worries, it will only install under /usr/local, and comes with make uninstall as well to remove the craft
[10:02] <sistpoty> no we'll need a program that uses this library as well
[10:02] <sistpoty> now
[10:02] <sistpoty> get http://www.potyra.de/library_packaging/hello_prog-1.0.tar.gz
[10:02] <sistpoty> extract it to a different directory and compile it
[10:03] <sistpoty> everyone got that so far?
[10:04] <sistpoty> oh, be sure to run ldconfig after installing the library package, I always forget this
[10:04] <sistpoty> everyone got a program called hello_prog now?
[10:05] <sistpoty> anyone still following? *g*
[10:05]  * persia has a working hello program (after running ldconfig)
[10:05] <sistpoty> great :)
[10:06] <sistpoty> now for a test, let's uninstall the library again
[10:06] <sistpoty> make uninstall (as root
[10:06] <sistpoty> +)
[10:06] <sistpoty> let's try to execute hello_prog again
[10:07] <sistpoty> it won't work, because the shared object is gone for good
[10:07] <sistpoty> if you try ldd hello_prog, you'll see that it cannot resolve libmyhello.so.1
[10:07] <sistpoty> luckily, upstream has made a new library package, let's try that hot new stuff
[10:08] <sistpoty> http://www.potyra.de/library_packaging/libmyhello-1.0.2.tar.gz
[10:08] <sistpoty> same procedure as with the old libmyhello: compile, install, run ldconfig
[10:09]  * persia complains upstream shouldn't distribute compiled binaries in the tarball
[10:09] <sistpoty> hm? does upstream do that?
[10:10] <persia> sistpoty: Maybe it's just my upstream checking scripts :(
[10:10] <sistpoty> persia: probably (or my make dist is wrong)
[10:10] <sistpoty> ok, let's retry to run hello_prog
[10:11] <sistpoty> at this point the loader cannot resolve a symbol, and will barf out
[10:11] <sistpoty> let's take a look: readelf -s hello_prog
[10:12] <sistpoty> (first run strip, to get rid of the local symbols)
[10:12] <sistpoty> strip hello_prog
[10:12] <sistpoty> readelf -s hello_prog
[10:12] <sistpoty> you can see, that it wants print_hello
[10:12] <sistpoty> let's take a look at what the new library provides
[10:13] <sistpoty> strip the library (to get rid of the local symbols)
[10:13] <sistpoty> and
[10:13] <sistpoty> readelf -s libmyhello.so
[10:14] <sistpoty> there is a function hello, but no function print_hello
[10:14] <sistpoty> compare that to what's in the old libmyhello.so
[10:14] <sistpoty> so upstream obviously removed print_hello and inserted hello
[10:15] <sistpoty> this means, that the change is not ABI compatible (and also not API compatible, because you cannot compile hello_prog against the new versoin)
[10:15] <sistpoty> so obviously if a symbol gets removed, it means that the ABI breaks
[10:15] <sistpoty> let's come back to the SONAME
[10:15] <sistpoty> having the same SONAME means that the ABI is compatible
[10:16] <sistpoty> so you can exchange any library with the same SONAME and the program should still work
[10:16] <sistpoty> if a library isn't ABI compatible any longer, the SONAME must get changed to indicate this
[10:17] <sistpoty> if the SONAME gets changed, so does the names of the library
[10:17] <sistpoty> so you can have two versions of one library installed, that have a different SONAME
[10:17] <sistpoty> any questions so far?
[10:18] <sistpoty> so let's get back to the ABI again...
[10:18] <sistpoty> having the same symbols (or only new symbols) in a newer version is only part of the ABI definition
[10:19] <persia> Is the dual-installation not affected by the symlinks?
[10:19] <sistpoty> persia: no
[10:19] <sistpoty> maybe I should go into details about the symlinks
[10:20] <sistpoty> for one, we have the shared object itself: libmyhello.so.1.0.2
[10:20] <persia> I'd like to know more, but perhaps in section 2 about packaging.  It seems to me the symlink points to the most recently installed, which is non-deteministic.
[10:20] <sistpoty> well, I'll  just explain that now ;)
[10:21] <sistpoty> the first symlink is libmyhello.so.1
[10:21] <sistpoty> this one is actually always the SONAME mangled to some rules
[10:22] <sistpoty> err.. it *is* the SONAME
[10:22] <sistpoty> sorry
[10:22] <sistpoty> if this symlink isn't there, ldconfig would create it
[10:23] <sistpoty> all binaries, that want a specific shared library are resolved by this symlink
[10:23] <sistpoty> because that's what's in the NEEDED entry of the binary
[10:23] <sistpoty> the loader will do that for us, and (looking at ldd output) will also follow that symlink to the "real" shared object
[10:24] <sistpoty> the other symlink is libmyhello.so
[10:24] <sistpoty> this symlink is there, if you want to link a binary against the shared object
[10:24] <sistpoty> gcc -lmyhello
[10:25] <sistpoty> -l<name> will get transformed to lib<name>.so
[10:25] <sistpoty> and that's what the linker will search for
[10:25] <persia> Ah.  That explains why the bare symlink is usually in the -dev package.  Thanks.
[10:25] <sistpoty> so you'll only need this symlink when compiling/linking s.th. against a shared object
[10:25] <sistpoty> exactly
[10:26] <sistpoty> any binaries won't need/see it. and that's the only file with the same name
[10:26] <sistpoty> ok, let's get back to the ABI
[10:27] <sistpoty> the ABI also means that the symbols still mean the same thing
[10:27] <sistpoty> while finding out, if any symbols got removed should be an easy task now, this gets a little bit trickier
[10:27] <Rhi_evil_happ1> hi
[10:27] <sistpoty> the meaning of the symbol is 1) is it a function/variable/what section is it in
[10:27] <sistpoty> hi Rhi_evil_happ1
[10:28] <sistpoty> but also for functions, what signature (number of arguments, type of arguments) need to get passed
[10:28] <Rhi_evil_happy> hi again
[10:29] <sistpoty> if you change the signature of a function of a library, this means that a program linked against it wouldn't agree with the library any longer, about the data that it passes
[10:29] <sistpoty> one way to look at signatures is via the debug information
[10:30] <sistpoty> so (in case you stripped the library), recompile it again w.o. stripping it (make clean && make)
[10:30] <sistpoty> for debug information, gdb is our tool of choice
[10:30] <sistpoty> gdb libmyhello.so
[10:31] <sistpoty> you can look at the function definitions with
[10:31] <sistpoty> info functions
[10:31] <sistpoty> void hello(void);
[10:31] <Rhi_evil_happy> ?
[10:31] <sistpoty> Rhi_evil_happy: maybe you want to read backlog?
[10:32] <persia> Just to confirm. this would provide useful information if the function weren't void, right?
[10:32] <sistpoty> persia: yes
[10:32] <persia> s/useful/visibly useful/
[10:32] <sistpoty> feel free to modify the functions to your liking and experiment ;)
[10:32] <sistpoty> for variables it's
[10:32] <sistpoty> info variables
[10:32] <sistpoty> (however there is no direct variable defined in there)
[10:33] <sistpoty> interesting enough stdin/stdout show up there... I guess that's because these are declared in a header and will get debug symbols in the library...
[10:34] <sistpoty> so to be sure, you'd need to filter out any info from there that's not marked as a symbol
[10:34] <sistpoty> or rather that's not defined in a symbol (nm -D/readelf -s/objdump -T)
[10:34] <sistpoty> now, let's strip the library again and see what info gdb will spit out
[10:35] <sistpoty> stirp libmyhello.so
[10:35] <sistpoty> gdb libmyhello.so
[10:35] <sistpoty> info functions
[10:35] <sistpoty> s/stirp/strip/
[10:36] <sistpoty> now, the info is gone... since all binaries/shared objects are stripped, this cannot get applied to a package in the archive
[10:36] <sistpoty> or at least you'd need the -dbgsym package for it
[10:36] <sistpoty> luckily there exists one tool, that may help there: icheck
[10:37] <sistpoty> afaik, you can use it to create a manifest file with symbols (and their) meaning of a package
[10:37] <sistpoty> I haven't tried it out myself yet though
[10:37] <sistpoty> (package icheck)
[10:38] <sistpoty> there also exists check_symbols in the ubuntu-devscripts package, however we found out that it currently uses nm -D
[10:38] <sistpoty> and thus won't know anything about versioned symbol dependencies
[10:38] <sistpoty> -> better avoid it until its fixed
[10:38] <sistpoty> any questions so far?
[10:39] <sistpoty> ok, small side note: c++ libraries
[10:40] <sistpoty> since you can overload method in c++, (give two functions the same name but different signatures),
[10:40] <sistpoty> these cannot get stored with the name as symbol name
[10:40] <sistpoty> because you'd end up with two symbols with the same name
[10:41] <sistpoty> hence there is some name mangling done by g++, that encodes the signature in the symbol name itself
[10:41] <sistpoty> let's take an example
[10:41] <sistpoty> nm -D /usr/lib/libstdc++.so.6 | less
[10:42] <sistpoty> (there are lot's of symbols with funny names in there)
[10:42] <sistpoty> you can get some human readable output of this with the -C option of nm
[10:42] <sistpoty> nm -C -D /usr/lib/libstdc++.so.6 | less
[10:43] <sistpoty> or c++filt
[10:43] <sistpoty> a nice side effect of this is, that a change of the signature will result in a differently named symbol
[10:44] <sistpoty> and hence in a removed symbol, which you can easily detect looking only at symbols
[10:44] <sistpoty> another side note:
[10:44] <persia> Is this use of guard symbols why C++ gets so hopelessly confused with insufficiently explicit casts to objects passed to overloaded functions?
[10:45] <sistpoty> what do you mean with guard symbols?
[10:45] <sistpoty> however it gets confused due to overload resolution
[10:45] <sistpoty> that means the compile needs to find out which method to call
[10:46] <persia> The output of `nm -CD /usr/lib/libstdc++.so.6 | less` reported "guard ..." in place of _ZZZ09u592.  My terminology error.
[10:46] <sistpoty> I'm not too sure what the guard thingy means
[10:47] <sistpoty> however if the type for an argument exactly matches, this method is chosen by the compiler (i.e. uint64_t as parameter, uint64_t as argument)
[10:48] <sistpoty> if an implicit typecast is involved (e.g. uint32_t as parameter, uint64_t as argument), this is considered a worse case
[10:48] <persia> Thanks.  Somewhat unrelated then :)
[10:48] <sistpoty> iirc, only the number of typecasts involved is getting counted, and the method is chosen for this
[10:49] <sistpoty> persia: maybe it's also about NULL as argument (which's type can be any pointer type) ;)
[10:49] <sistpoty> so void do_stuff(X *arg); and void do_stuff(Y *arg); would be ambiguous when called as do_stuff(NULL);
[10:50] <sistpoty> but let's get back to shared objects
[10:50] <persia> sistpoty: I've only encountered it when porting applications to updated libraries.  Likely off-topic :)
[10:50] <sistpoty> persia: heh, I encountered it yesterday at work, coding c++ *g*
[10:51] <sistpoty> ok, so the SONAME means to be ABI compatible
[10:51] <sistpoty> and by definition, if we only add new features to a library, we don't need to change the SONAME
[10:51] <sistpoty> this leaves one small problem: what if we've added cool new features not breaking the ABI
[10:52] <sistpoty> and a program makes use of these new features
[10:52] <sistpoty> someone could still have the old library installed and install the program
[10:52] <sistpoty> then this program wouldn't work any longer, because it needs symbols not yet defined in thre
[10:52] <sistpoty> there
[10:52] <sistpoty> on the basis of the SONAME, there is no solution to this
[10:53] <sistpoty> historically on unix systems, this was handled by the minor version of a shared library as slangasek told me
[10:53] <sistpoty> however this of course won't work if you move binaries from one system to another (and that's what packaging is about)
[10:54] <sistpoty> we'll see the solution to this in part 2
[10:54] <sistpoty> ok, any questions left?
[10:55] <sistpoty> if there are none, I'm through with part 1 :)
[10:55] <persia> If the minor number is no longer used to track symbol introduction, what is it used to indicate?
[10:55] <sistpoty> heh, no idea actually
[10:56] <sistpoty> maybe it's still used for this
[10:56] <persia> Is it just meaningless on linux/glibc systems then?
[10:56] <sistpoty> yes
[10:56] <sistpoty> i.e. I'm not sure if it's meaningless, but debian/ubuntu systems could live w.o. it ;)(
[10:57] <persia> Actually, only the runtime loader matters.  If this doesn't use it, it is meaningless, even if there is historic semantic value.
[10:58] <sistpoty> right
[10:58] <sistpoty> how about a short break before starting part 2?
[11:00] <sistpoty> ok, I'm just making a short coffee break then :)
[11:14] <sistpoty> re
[11:15] <sistpoty> anyone around for part 2 of the library packaging session?
[11:16] <sistpoty> persia: interested in part 2?
[11:16] <sistpoty> (if not, I'll just point to the logs... less work for me then *g*)
[11:17] <persia> Sure.
[11:18]  * persia reviews the logs again anyway, to forestall some questions
[11:18] <sistpoty> persia: if you're the only one interested, I guess I don't need to go through packaging by example and just skip ahead to questions, ok?
[11:19] <persia> sistpoty: OK.  Hold on a bit while I catch up then :)
[11:19] <sistpoty> sure, just ping me once you're through ;)
[11:21] <persia> sistpoty: question time :)
[11:21] <sistpoty> :)
[11:22] <persia> First, are there any objective criteria about pushing a transition vs. oldlibs support?  Is this just a matter of how much effort the transition is, and based on what is expected to make the release?
[11:23] <sistpoty> hm... I can only say what slangasek wrote yesterday, that it's /usually/ better to transition
[11:23] <sistpoty> I guess one example would be the libdb* stuff, which is an exception
[11:23] <sistpoty> because it's a database library and the database format changed iirc, so it's very hard to transition this one
[11:24] <sistpoty> and would result in a very unsmooth upgrade path
[11:24] <sistpoty> or you'll also like to not get rid of libc* too soon, as many binary only applications still use the old one
[11:24] <persia> Makes sense.  libdb seems a prominent exception, and we've been having fun with WX since feisty.  I'm guessing that it depends on 1) if upstreams are paying attention, 2) bad upgrade paths, 3) truly significant porting effort (that won't complete in several months), and similar release-affecting issues.
[11:25] <sistpoty> sounds sane, yes
[11:26] <persia> Next: do you understand the controversy over binary packages named libfoo1 vs. libfoo1.0.3?  If so, why one over the other (or do you have a pointer to a previous debate)?
[11:27] <sistpoty> hm...
[11:28] <sistpoty> to my understanding, the binary package name should have a unique name in comparison to the soname
[11:28] <sistpoty> so libfoo1 would be useful for libfoo.so.1
[11:28] <sistpoty> while libfoo1.0.3 would be useful for libfoo-1.0.3 (soname)
[11:29] <persia> Hmm.  That would make more sense if the minor version weren't considered meaningless :(
[11:29] <sistpoty> well, the minor version isn't part of the SONAME, otherwise it's no minor version ;)
[11:29] <persia> Does maybe the versioned symbols features allow parallel installation of libfoo-1.0.3 and libfoo-1.0.4?
[11:30] <sistpoty> no, the only warranty for parallel installation is a different SONAME afaik
[11:30]  * persia looks at libmyhello Makefiles again
[11:31] <sistpoty> versioned symbol come in at a different place
[11:31] <sistpoty> let's say, you have libA and libB, which both depend on libC
[11:31] <persia> Ah.  So libfoo1.0.3 would provide libfoo1.0.3.so.(whatever), rather than libfoo1.so.1.0.3 ?
[11:31] <sistpoty> persia: exactly
[11:32] <sistpoty> btw.: the library packging guide has nice examples for this
[11:32] <persia> sistpoty: re: versioned symbols.  Right.  Poor terminology again (and more interesting for package D depending on libA and libB).
[11:32] <sistpoty> right
[11:33] <sistpoty> if you now change libA to require a newer, incompatible version of libC
[11:33] <sistpoty> D will draw in multiple versions of libC
[11:33] <persia> Next question: if an upstream tarball produces 17 libraries, why would one choose e.g. 5 (10) binary packages, rather than 17 (34)?
[11:34] <sistpoty> good question... the only rationale is if these come from the same source and one ABI incompatibility of one shared object will *always* result in ABI incompatibilities of the other shared objects
[11:35] <sistpoty> if you know that this is the case, you can collapse these into one library package (because you'll never end up with only one SONAME getting bumped)
[11:35] <persia> So if there is a stack of binary libraries generated by the same source, and the core library (upon which the others depend) is generally updated for each release, and applications usually use several of the client libraries, one package might be correct, but upstream should be hit with a stick?
[11:37] <sistpoty> well... kind of
[11:37] <sistpoty> it might be correct though... let me think of an example
[11:37] <persia> kdelibs is perhaps an interesting example
[11:37] <sistpoty> if the core library defines some interface types, that are used in the client libraries
[11:38] <sistpoty> you'll automatically get ABI incompatibilities if the core library changes
[11:38] <persia> Err..  No.  That generates lots of binaries.
[11:38] <sistpoty> becaues the signatures will differ
[11:39] <sistpoty> hm... not too sure about kdelibs *g*
[11:39] <persia> Won't that generally be taken care of by the simultaneous recompile of the single source, regardless of how many binary packages are involved?
[11:40] <sistpoty> yes, it will
[11:41] <persia> OK.  I'll put the package split question back on the stack of things to have an opinion about rather than things with an answer then :)
[11:41] <persia> Next question, which may be off-topic:
[11:41] <sistpoty> however if you put (independent) shared objects into a single binary, it means that every program depending on any to rebuild as well
[11:41] <sistpoty> so a good rationale would also be if it's possible to use only one single shared object or if you definitely want all of these
[11:42] <persia> sistpoty: Ah.  Right.  Splitting the binaries and being careful about versioning would decrease the amount of NBS work if clients typically used subsets of the set of libraries exported by the source.  Thanks.
[11:43] <sistpoty> and unmet dependencies
[11:44] <persia> When packaging an application that has internal libraries that are tightly linked to the application itself (and not expected to be used externally (e.g. btanks)), is there a point to exporting the library, or would just putting it in the /usr/lib/ hierarchy (for ldconfig) be sufficient?
[11:44] <persia> (I consider library related unmet deps to be unfinished NBS, but that's just nomenclature)
[11:45] <sistpoty> blatantly: if it comes with headers and you can compile s.th. against the the library in question, it should be packaged as a library
[11:45] <sistpoty> otherwise (e.g. headers alone not sufficient to build against), somewhere under /usr/lib/??? sounds sane
[11:46] <persia> OK.  So headers are the useful defining characteristic.  I'll be reusing that argument next time I am trying to defend a package split.
[11:46] <sistpoty> kind of... usually if you have a shared object only for internal use, there is no much sense for the shared object in the first place ;)
[11:46] <sistpoty> (why not link statically then)
[11:47] <sistpoty> of course apart from plugins... which is a different use case
[11:47] <persia> Argument there would be minimal deviation from upstream build system.
[11:47] <sistpoty> sure, but of course you can ask upstream why they build a shared object *g*
[11:48] <sistpoty> to put it in other words: if upstream is sane and builds a shared object, use library packaging style :)
[11:49] <persia> sistpoty: Thanks a lot for running another session at this time of day (and answering all my questions).  I've packaged a couple libraries before, but have been working out issues empirically, rather than really understanding them.  Your lecture and the session logs have been very helpful in rectifying this.
[11:50] <sistpoty> persia: you're welcome
[11:50] <sistpoty> thanks for listening
[11:50] <sistpoty> and now a small secret: I don't maintain any library myself (though I've packaged one once)
[11:50] <sistpoty> so my big thank goes to slangasek again, who helped to prepare the initial session :)
[11:51] <persia> sistpoty: Would you like to?  I don't use any libjsw clients anymore, and someone should probably be watching to see when it breaks :)
[11:52] <sistpoty> persia: if I only had the time to ... *g*
[11:52] <persia> sistpoty: No worries.  Darren hasn't updated it in a couple years, and it may well disappear soon :)
[11:52] <sistpoty> hehe
[11:56] <james_w> thanks again sistpoty
[11:56] <sistpoty> james_w: and big thanks for organizing the sessions!
[13:15] <Rhi_evil_happy> yo
[17:11] <tenshu> hi all
[17:12] <tenshu> the last classroom session lof is 404
[17:12] <tenshu> anyone could rehost it?
[21:48] <ToyKeeper> tenshu: http://toykeeper.net/tmp/ubuntu-classroom.log
[21:49] <ToyKeeper> (more than just the last session, but you can ignore the previous bits)
[22:29] <tenshu> thx ToyKeeper