I was very upset by one comment from Ardour’s lead developer Paul Davis in a recently reported “bug” about the un-bundling of libraries from Ardour in Gentoo. I was, to be honest, angry after reading his comment, and I was tempted to answer badly for a while; but then I decided my health was more important and backed away, thought about it, then answered how I answered (which I hope is diplomatic enough). Then I thought it might be useful to address the problem in a less concise way and explain the details.
Ardour is bundling a series of libraries; like I wrote previously, there are problems related to this and we dealt with them by just unbundling the libraries, now Ardour is threatening to withdraw support from Gentoo as a whole if we don’t back away from that decision. I’ll try to address his comments in multiple parts, so that you can understand why it really upset me.
First problem: the oogie-boogie crashes<
It’s a quotation from Adam Savage from MythBusters, watch the show if you want to actually know the detail; I learnt about it from Irregular Webcomic years ago, but I have only seen it about six months ago, since in Italy it only passes on satellite pay TV, and the DVDs are not available (which is why they are in my wishlist).
Let’s see what exactly Paul said:
Many years ago (even before Gentoo existed, I think) we used to distribute Ardour without the various C++ libraries that are now included, and we wasted a ton of time tracking down wierd GUI behaviour, odd stack tracks and many other bizarre bugs that eventually were traced back to incompatibilities between the way the library/libraries had been compiled and the way Ardour was compiled.
I think that I now coined a term for my own dictionary, and will call this the syndrome of oogie-boogie bugs, for each time I hear (or I’m found muttering!) “we know of past bad behaviour”. Sorry but without documentation, these things are like unprovable myth, just like the one Adam commented upon (the “pyramid power”). I’m not saying that these things didn’t happen, far form that I’m sure they did, the problem is that they are not documented and thus are unprovable, and impossible to dissect and correct.
Also, I’m not blaming Paul or the Ardour team to be superficial, because, believe it or not, I suffer(ed, hopefully) from that syndrome myself: some time ago, I reported to Mart that I had maintainer mode-induced rebuilds on packages that patched both
Makefile.in, and that thus the method of patching both was not working; while I still maintain that it’s more consistent to always rebuild autotools (and I know I have to write on why is that), Mart pushed me into proving it, and together we were able to identify the problem: I was using XFS for my build directory, which has sub-second mtime precision, while he was using ext3 with mtime precise only to the second, so indeed I was experiencing difficulties he would never have been able to reproduce on his setup.
Just to show that this goes beyond this kind of problem, since I joined Gentoo, Luca told me to be wary about suggesting use of
-O0 when debugging because it can cause stuff to miscompile. I never accepted his word for it because that’s just how I am, and he didn’t have any specifics to prove it. Turns out he wasn’t that wrong after all, since if you build FFmpeg with
-O0 and Sun’s compiler, it cannot complete the link. The reason for this is that with older GCC, and Sun’s compiler, and others I’m sure,
-O0 turns off the DCE (Dead Code Elimination) pass entirely, and cause branches like
if (0) to be compiled anyway. FFmpeg relies on the DCE pass to always happen. (there is more to say about relying on the DCE pass but that’s another topic altogether).
So again, if you want to solve bugs of this kind, you have to just do like the actual Mythbusters: document, reproduce, dissect, fix (or document why you have to do something rather than just saying you have to do it). Not having the specifics of the problem, makes it an “oogie-boogie” bug and it’s impossible to deal with it.
Second problem: once upon a time
Let me repeat one particular piece of the previous quote from Paul Davis (emphasis mine): “Many years ago (even before Gentoo existed, I think)”. How many years ago is that? Well, since I don’t want to track down the data on our own site (I have to admit I found it appalling that we don’t have a “History” page), I’ll go around quoting Wikipedia. If we talk about Gentoo Linux with this very name, the 1.0 version has been released on 2002, March 31 (hey it’s almost seven years go by now). If we talk about Daniel’s project, Enoch Linux 0.75 was released in December 1999, which is more than nine years ago. I cannot seem to be able to confirm Paul’s memories since their Subversion repositories seems to have discarded the history information from when they were in CVS (it reports the first commit in 2005, which is certainly wrong if we consider that Wikipedia puts their “Initial Release” in 2004).
Is anything the same as it was at that time? Well, most likely there are still pieces of code that are older than that, but I don’t think any of those are in actual use nowadays. There have been, in particular, a lot of transitions since then. Are difficulties found at that time of any relevance nowadays? I sincerely don’t think so. Paul also don’t seem to have any documentation of newer happenings of this, and just says that they don’t want to spend more time on debugging these problems:
We simply cannot afford the time it takes to get into debugging problems with Gentoo users only to realize that its just another variation on the SYSLIBS=1 problem.
I’ll go around that statement in more details in the next problem, but for now let’s accept that there has been no documentation of new cases, and that all that it goes here is bad history. Let’s try to think about what that bad history was. We’re speaking about libraries, first of all, what does that bring us? If you’re an avid reader of my blog, you might remember what actually brought me to investigate bundled libraries in the first place: symbol collisions ! Indeed this is very likely, if you remember I did find one crash in xine due to the use of system FFmpeg, caused by symbol collisions. So it’s certainly not a far-fetched problem.
The Unix flat namespace to symbols is certainly one big issue that projects depending on many libraries have to deal with; and I admit there aren’t many tools that can deal with that. While my collision analysis work has focused up to now to identify the areas of problem, it only helps in the big scheme of things to find possible candidate to collision problems. This actually made me think that I should adapt my technique to identify problems in a much smaller scale, giving one executable in input and identifying duplicated symbols. I just added this to my TODO map.
Anyway, thinking about the amount of time passed since Gentoo’s creation (and thus what Paul think is when the problems started to happen), we can see that there is at least one big “event horizon” in GNU/Linux since then (and for once I use this term, because it’s proper to use it here): the libc5 to libc6 migration ; the HOWTO I’m linking, from Debian, was last edited in 1997, which puts it well in the timeframe that Paul described.
So it’s well possible that people at the time went to use libraries built for one C library with Ardour built with a different one, which would have created, almost certainly, subtle and difficult to identify (for a person not skilled with linkers at least) issues. And it’s certainly not the only possible cause of similar crashes, or even worse unexpected behaviour. If we look again at Paul’s comment, he speaks of “C++ libraries”; I know that Ardour is written in C++ and I think I remember some of the libraries being built being written in C++ too; I’m not sure if he’s right at calling all of them “C++ libraries” (C and C++ are two different languages, even if the foreign calling convention glue is embedded in the latter’s language), but given even a single one is as such, it can open a different Pandora’s vase.
See, if you look at GCC’s history, it wasn’t long before Enoch 0.75 release that a huge paradigm shift initiated for Free Software compilers. The GNU C Compiler, nowadays the GNU Compiler Collection, forked the Experimental/Enhanced GNU Compiler System (EGCS) in 1997, which was merged back into GCC with the historical release 2.95 in April 1999. EGCS contained a huge amount of changes, a lot related to C++. But even that wasn’t near perfection; for many, C++ support was mostly ready from prime time only after release 3 at least, so there were wild changes going on at that time. Libraries built with different versions of the compiler at the time might as well had wildly differently built symbols with the same name, and even worse, they would have been using different STL libraries. Add to the mix the infamous 2.96 release of GCC as shipped by RedHat, I think the worse faux-pas in the history of RedHat itself, with so many bugs due to backporting that a project I was working with at the time (NoX-Wizard) officially unsupported it, suggesting to use either 2.95 or 3.1. We even had an explicit
#error out if the 2.96 release was used!
A smaller scale paradigm shift has happened with the release of GCC 3.4 and the change from
libstdc++.so.6 which is what we use nowadays. Mixing libraries using the two ABIs and the STL versions caused obvious and non-obvious crashes; we still have software using the older ABI, and that’s why we have
libstdc++-v3 around; Mozilla, Sun and Blackdown hackers certainly remember that time because it was a huge mess for them. It’s one very common (and one of my favourite) arguments against the use of C++ for mission-critical system software.
Also, GCC’s backward compatibility is near non-existent: if you build something with GCC 4.3, without using static libraries, executing it on a system with GCC 4.2 will likely cause a huge amount of problems (forward compatibility is always ensured though). Which adds up to the picture I already painted. And do we want to talk about the visibility problem? (on a different note I should ask Steve for a dump of my old blog to merge here, it’s boring not remembering that one post was written on the old one).
I am thus not doubting at all of Paul’s memories regarding problems with system libraries and so on so forth. I also would stress another piece of his comment: “eventually were traced back to incompatibilities between the way the library/libraries had been compiled and the way Ardour was compiled”. I understand he might not actually just refer to the compiler (and compiler version) used in the build; so I wish to point out two particular GCC options:
These two options enable or disable two C++ language features: exceptions handling and run-time type information. I can’t find any reference to that in the current man page, but I remember that it warned that mixing code built with and without it in the same software unit was bad. I wouldn’t expect it to be any different now sincerely. In general the problem is solved because each piece of software builds its own independent unit, in the form of executable or shared object, and the boundary between those is subject to the contract that we call ABI. Shared libraries built with and without those options are supposed to work fine together (I sincerely am not ready to bet though), but if the lower-level object files are mixed together, bad things may happen, and since we’re talking about computers, they will, in the moment you don’t want them to. It’s important to note here for all the developers not expert with linkers that static libraries (or more properly, static archives) are just a bunch of object files glued together, so linking something statically still means linking lower-level object files together.
So the relevance of Paul’s memories is, in my opinion, pretty low. Sure shit happened, and we can’t swear that it’ll never happen again (most likely it will), but we can deal with that, which brings me to the next problem:
Third problem: the knee-jerk reaction
Each time some bug happens that is difficult to pin down, it seems like any developer tries to shift the blame. Upstream. Downstream. Sidestream. Ad infinitum. As a spontaneous reflex.
This happens pretty often with distributions, especially with Gentoo that gives users “too much” freedom with their software, but most likely in general, and I think this is the most frequent reason for bundling libraries. By using system libraries developers lose what they think is “control” over their software, which in my opinion is often just sheer luck. Sometimes developers admit that their reasons are just desire to spend the less time possible working on issues, some other times they try to explicitly move the blame on the distributions or other projects, but at the end of the day the problem is just the same.
Free software is a moving target; you might developer software against a version of a library, not touch the code for a few months, it works great, and then a new version is released and your software stops working. And you blame the new release. You might be right (new bug introduced), or you might be wrong (you breached the “contract” called API, some change happened and something that was not guaranteed to work in any particular way changed the way it worked, and you relied on the old behaviour). In either case, the answer “I don’t give a damn, just use the old version” is a sign of something pretty wrong with your approach.
The Free Software spirit should be the spirit of collaboration. If a new release of a given dependency breaks your software, you should probably just contact the author and try to work out between the two project what the problem is; if it’s a bug introduced, make sure there is a testsuite, and that the testsuite includes a testcase for the particular issue you found. Writing testcases for bugs that happened in the past is exactly why testsuites are so useful. If the problem is that you relied on a behaviour that has changed, the author might know how not to rely on that and have code that work as expected, or might take steps to make sure nobody else tries that (either by improving documentation or changing the interface so that the behaviour is not exposed). Bundling the dependency citing multiple problems and giving no option is usually not the brightest step.
I’m all for giving working software to users by default, so I can understand bundling the library by default; I just think that it should either be documented why that’s the case or give a chance of not using it. Someone somewhere might actually be able to find what the problem is. Just give him a chance. In my previous encounter with Firefox’s SQLite, I received a mail from Benjamin Smedberg:
Mozilla requires a very specific version of sqlite that has specific compiled settings. We know that our builds don’t work with later or earlier versions, based on testing. This is why we don’t build against system libsqlite by design.
They know based on testings that they can’t work with anything else. What does that testing consists of, I still don’t know. Benjamin admitted he didn’t have the specifics, and relied me to Shawn Wilsher who supposedly had more details, but he never got back at me with those details. Which is quite sad since I was eager to find what the problem was because SQLite is one of the most frequent oogei-boogei sources. I even noted that the problem with SQLite seems to lie upstream, and I still maintain that in this case; while I said before that it’s a knee-jerk reaction, I also have witnessed to more than a few project having problems with SQLite, myself I had my share of headaches because of that. But this should really start make us think that maybe, just maybe, SQLite needs help.
But we’re not talking about SQLite here, and trust me that most upstreams will likely help you out to forwardport your code, fix issues and so on so forth. Even if you, for some reason I don’t want to talk about now, decided to change the upstream library after bundling, often times you can get it back to a vanilla state by pushing your changes upstream. I know it’s feasible even for the most difficult upstreams, because I have done just that with FFmpeg, with respect to xine’s copy.
But just so that we’re clear, it does not stop with libraries, the knee-jerk reaction happens with CFLAGS too; if you have many users reporting that using wild CFLAGS break your software, the most common reaction is to just disallow custom CFLAGS, while the reasoned approach would be to add a warning and then start to identify the culprit; it might be your code assuming something that is not always true, or it might be a compiler bug, in either case the solution is to fix the culprit instead of just disallowing anybody from making use of custom flags.
Solution: everybody’s share
So for now I dissected Paul’s comment into three main problems; I could probably write more about each of them, and I might if the points are not clear, but the post is already long enough (but I didn’t want to split it down because it would take too long to be available), and I wanted to reach a conclusion with a solution, which is what I already posted in my reply to the bug.
The solution to this problem is to give everybody something to do. Instead of “blacklisting Gentoo” like Paul proposed, they should just do the right thing and leave us to deal with the problems caused by our choices and our needs. I have already pointed out some of these in my three-parts article for LWN (part 1, part 2 and part 3). This means that if you get user reporting some weird behaviour, using the Gentoo ebuild, your answer should not be “Die!” but “You should report that to the Gentoo folks over at their bugzilla”. Yes I know it is a much longer phrase and that it requires much more typing, but it’s much more user friendly and actually provides us all with a way to improve the situation.
Or you could also do the humble thing and ask for help. I already said that before, but if you got problem with anything I have written about, and have a good documentation of what the problem is, you can write me; of course I don’t always have time to fix your issues, sometimes I don’t even have time to look at them in a timely fashion I’m afraid, but I never sent away someone because I didn’t like them. The problem is that most of the time I’m not asked at all.
Even if you might end up asking me some question that would be very silly if you knew the topic, I’m not offended by those; just like I’d rather not be asked to learn all about the theory behind psychoacoustic to find why libfaad is shrieking my music, I don’t pretend that Paul knows all the inside out of linking problems to find out why the system libraries cause problems. I (and others like me) have the expertise to identify relatively quickly a collision problem; I should also be able to provide tools to identify that more quickly. But if I don’t know of the problem, I cannot magically fix it; well, not always at least .
So Paul, this is an official offer; if you can give me the details of even a single crash or misbehaviour due to the use of system libraries, I’d be happy to look into it.
Open source bundles libraries even more on Windows. Part of this is a tool gap though because the ideal approach would be for things like GTK to install side-by-side DLLs. However, GTK for Windows is built on Linux. There is no MSI builder for Linux, and MSIs are the only supported way to install side-by-side assemblies. If you try to have a single GTK installation, you run into DLL hell where some applications won’t work with that version of GTK. Consequently, applications bundle local copies of GTK. This becomes a servicing issue because a security issue in that version of GTK will likely go uncorrected.There’s also a C runtime issue because mingw links against msvcrt.dll, but applications aren’t supposed to link against it anymore. This can lead to issues when multiple C runtimes are used in one application.
hi, thank you for your hard work diego, its alwaysa a blessing to read your posts about things i have only a slight idea of! i hope one day the portage tree is free or quite free of such problems yeah!
Diego, I appreciate your comments and your willingness to discuss the issues at length.Simple history first: the Ardour project started in 1999, and the initial CVS repository was begun in early 2000. We did initial releases of the code starting in the middle of 2000.Your comments about -fno-exceptions, while nice in theory, are wrong in practice. Most authors of C++ libraries who ever use exceptions do not write code that will fulfill the apparent ABI contract in the absence of exceptions. Why not? Because these are a standard part of the language, and it is really a very strange compile time option to invoke unless you actually know that the library in question doesn’t use exceptions. Unfortunately, users who take compilation into their own hands do not always know this.You have also skipped over the single largest instance of problems with system-provided C++ libraries, which is ABI-incompatible behaviour on the part of the compiler. This is less of an issue on Gentoo, but even today it can be a substantive problem on other distributions where users do not realize that upgrading their C compiler (sometimes even from the FSF source) instantly renders their system C++ libraries useless. In theory, the GCC folks have promised ABI stability for a while, and its true that for the last couple of years, its been much better than it used to be. But alas, their previous behaviour, in which ABI stability was repeatedly promised but never delivered, has left a rather sour taste with many C++ developers on Linux and related platforms.Regarding “writing test cases”. As you probably know, like most FOSS projects, we are not overwhelmed with manpower. When we first started to realize that we had classes of users building ardour with either a different version of gcc than was used with their system libraries, or with incompatible compile-time options, or both, we did not have the resources or the desire to discover precisely what caused the breakage. This feeling was enhanced by the fact that we knew a very simple way to get rid of the issue: make sure that the application *and* the C++ libraries were both compiled by the same compiler with the same options. It remains this way to do: I would estimate that at least 2 times a month, we get a Gentoo user show up on IRC reporting some kind of strange behaviour. Its often not the same strange behaviour, but it manifests itself as “stuff that doesn’t happen to anyone else”, and when debugged, the stack traces look wierd (sometimes). Eventually, we discover that the user is a Gentoo user. We suggest to them that they build a version from our source release (which is generally extremely easy for them to do), and voila, no more problems.Given our list of bugs, our goals for Ardour 3.0, the desires of those who actually pay for Ardour’s ongoing development, diverting any manpower from actual design & coding into “figuring out the specific nature of the crash on user X’s system” has zero appeal for us. It also has zero appeal for the user, who wants Ardour to work, and has just discovered a very simple way to do so.I genuinely do share the aversion to private copies of system libraries. However, this is something where unfortunately, the historical behaviour of the gcc team and a number of distributions set the stage for developers of C++ applications targetted at Linux deciding to do their own thing more often than we would like. And unfortunately, the cryptic nature of the bugs that have been encountered in the past (7-9 years ago) and as recently as last week, simply makes it even more unlikely that anyone is going to put resources into ironing out all the minor errors that lead to applications misbehaving. Its not the “brightest” approach unless you consider goals: our goal is not to figure out how to always avoid users ending up with incompatible C++ applications and libraries – our goal is to provide users with a powerful and useful tool for digital audio.I personally have put many, many man-months into other aspects of FOSS infrastructure, but this particular problem strikes me as so deep, so thorny and so subtle that I simply cannot in good conscience work on the problem when people are paying me for features and bug fixes to ardour itself.
Paul, I agree you (and the rest of the Ardour team) should not be looking at that kind of issues, that’s why I said in the bug to just point the users at us. Just a single notice “Gentoo users are requested to bring up the issues on Gentoo’s Bugzilla first” would probably be more friendly than “Gentoo users go away” and just as effective.We have exactly one problem reported right now and we’re looking into it already. As it happens the problem is not just with Ardour, which really makes sense, if the problem was just with Ardour it would probably be another of the usual cases of disappointed expectations and could be taken care of by changing the code used. If it’s not that the problem affects more than one application, and how do you solve it without looking into it and fixing it? By having 10 copies of the same code in the system (like “FFmpeg a few years ago”:https://blog.flameeyes.eu/2… perhaps)?I guess one thing we could be doing would be to have an officially-maintained copy of the ebuild using your default (which we could not make the default though) and then make sure that we address the problem.At any rate, you have at least to consider two things that differ between what Joe the user would do and what we do with Gentoo. The first thing is that we have some standard levels of support, if an user were to put @-fno-exceptions@ in their flags, and report something as not working, then it would be their problem. We can check that quite well. The second is that we can make sure that some options are enabled at compile time so that the system is configured as it’s supposed to be. Dependency tracking is our strength.At any rate, last night I actually thought of two important tools that, as far as I know, are missing: a way to identify symbol collisions and a way to compare different libraries’ ABIs. I hope to be able to get to them this week, once I can say they are pretty stable it should be much easier to find the problems beforehand.As we both agree, everybody should keep doing what their best is; yours is to make Ardour better, mine is to make sure users have quality-compiled software on whatever system they are.
What a delicious plate of Open Source Community in action, at the end all of us are winners and hopefully this issue will evolve in a good way.Thanks Diego for such a good writing.
I feel lucky to have people like you, flameeyes, working on Gentoo. I would like to thank you in the name of every Gentoo user to be not only a great dev but also a great person.I’m not trying to say anything about you, Paul, you seem very friendly in fact. However it is always difficult to handle this kind of situation in a polite yet effective way (specially on the Internet, where it is easier to screw up), and what could have been a horrible fight between Ardour and Gentoo is now becoming a documented solution.Great work, guys! =)
I would just like to say a big thank you to both of you guys, i use Gentoo every day and i’m planning to use Ardour for our band recordings and this kind of constructive behavior just makes me want to use more open source software :)Thanks !