{"id":82,"date":"2006-02-22T18:28:14","date_gmt":"2006-02-22T22:28:14","guid":{"rendered":"http:\/\/benjamin.smedbergs.us\/blog\/2006-02-22\/debian-versioning-of-mozilla-libraries-harmful\/"},"modified":"2006-08-04T15:27:12","modified_gmt":"2006-08-04T19:27:12","slug":"debian-versioning-of-mozilla-libraries-harmful","status":"publish","type":"post","link":"http:\/\/benjamin.smedbergs.us\/blog\/2006-02-22\/debian-versioning-of-mozilla-libraries-harmful\/","title":{"rendered":"Debian Versioning of Mozilla Libraries Harmful"},"content":{"rendered":"<p>It has come to my attention that the maintainer of the Debian Mozilla packages (<a href=\"http:\/\/web.glandium.org\/blog\/\">Mike Hommey<\/a>) is using patches that significantly alter the XULRunner linking strategy (<a href=\"http:\/\/lists.debian.org\/debian-devel\/2005\/12\/msg00082.html\">first discussed here<\/a>).These patches cause various Mozilla libraries to be soversioned and installed in the library path (<tt>\/usr\/lib<\/tt>). Although I have emailed Mr. Hommey privately on a number of occasions, I have not received a reply, and the linking strategy that he has implemented is poorly thought out and will lead to instability and frustration.<!--more--><\/p>\n<h3>Background<\/h3>\n<p>On Linux systems, traditional shared libraries are installed into the system path (typically <tt>\/usr\/lib<\/tt>). In addition, there is a mechanism to support versioning, such that multiple versions of a library can be installed at the same time. This mechanism records information about the symbols provided by the library: incompatible changes are marked by a revision of the library&#8217;s major version number, backwards-compatible additions are marked by a change in the library&#8217;s minor version number, and minor bugfixes are marked by a revision of the micro (or release) version number. When an application is linked against a shared library, the version numbers are stored in the library and the dynamic linker ensures that when the application is loaded a library that is compatible is loaded.<\/p>\n<h3>Mozilla is not just ABI<\/h3>\n<p>For libraries where the provided functionality matches the exported functions, this simple solution works well. But the Mozilla libraries are an entirely different situation: XPCOM libraries export a small set of frozen APIs, but the stability of these initialization and accessor APIs has little to do with the stability of the actual functionality provided by gecko (XULRunner). Almost all XPCOM functionality is exposed through interfaces, which are versioned using <a href=\"http:\/\/en.wikipedia.org\/wiki\/UUID\">UUIDs<\/a>. As functionality is completed, these interfaces and the contractIDs that allow access to components are frozen, which guarantees that they will not change in future releases. Thus the functionality exposed by Mozilla is a set of frozen functionality exposed through interfaces, and a much larger set of nonfrozen functionality.<\/p>\n<p>XPCOM also has the ability to load an extensible binary XPCOM components: these components, if carefully written, can work with multiple versions of XPCOM and the various applications written on top of XPCOM. It is important that XPCOM components can continue to be compiled which work with multiple applications and versions. It is also important that when these component are loaded they use the XPCOM symbols from the currently running version of XPCOM library; if these components were to load an alternate XPCOM library, they would quickly crash or at least fail in unexpected ways.<\/p>\n<h3>The Proven Solution<\/h3>\n<p>In order to allow multiple versions of XPCOM to coexist correctly on a machine, Mozilla has developed a linking strategy which allows applications to find a compatible version of XPCOM (XULRunner) and load it at runtime. This is called the <a href=\"http:\/\/developer.mozilla.org\/en\/docs\/XPCOM_Glue#Using_Frozen_linkage_.28no_DLL_dependencies.29\">standalone XPCOM glue<\/a>. The standalone glue linking strategy has the following characteristics:<\/p>\n<ul>\n<li>Multiple versions of XULRunner are installed in separate directories.<\/li>\n<ul>\n<li>System XULRunners are typically installed in <tt>\/usr\/lib\/xulrunner-1.8.0.1<\/tt>, <tt>\/usr\/lib\/xulrunner-1.8.0.2<\/tt>, etc. Each version is registered in a *.conf file in <tt>\/etc\/gre.d<\/tt>.<\/li>\n<li>XULRunner can also be installed in a per-user location, typically ~\/.lib\/xulrunner-1.8.0.1 etc, and is registered in a configuration file within <tt>~\/.gre.d<\/tt>.<\/li>\n<\/ul>\n<li>An application which wants to use XPCOM APIs does not link directly against libxpcom.so (which would not be found, because it is not in the default library search path). Instead, it links against the standalone glue (<tt>libxpcomglue.a<\/tt>), a static library without mozilla shared library dependencies. During startup, the application calls the function <a href=\"http:\/\/bonsai.mozilla.org\/cvsblame.cgi?file=mozilla\/xpcom\/glue\/standalone\/nsXPCOMGlue.h&#038;rev=1.12&#038;mark=63-90#63\">GRE_GetGREPathWithProperties<\/a> to locate a compatible XULRunner. It then calls <tt>XPCOMGlueStartup()<\/tt>, which dynamically loads the correct XULRunner libraries.<\/li>\n<\/ul>\n<p>A great deal of effort was put into developing this linking strategy so that it actually works properly; and it does work properly on all three of the major platforms that Mozilla supports (Windows, Mac OS X, and Linux). It allows for relocatable installs of both the XULRunner platform and the applications that depend on the platform, which is an important part of Mozilla&#8217;s user-centric software model. XULRunner packages which use this linking model have been prepared on SuSE and other distros.<\/p>\n<h3>Debian Going Their Own Way<\/h3>\n<p>Unfortunately, the Debian pacakagers have decided to go their own way and try to create XPCOM libraries which can be versioned and installed in the system library path. This decision is ill-conceived: it means that XPCOM components built for other Linux systems are almost guaranteed not to work correctly on Debian systems: they will in many cases load the wrong XPCOM library and fail spectacularly. It also means that it will be impossible to compile XPCOM components on Debian systems that will work with multiple versions of an application, or on any other Linux system.<\/p>\n<p>I am sure that the Debian team believes that this change in linking strategy is better and correct and that they are not acting maliciously; but the fact remains that they have not proposed or discussed their changes with me (as both build-sytem and embedding API owner in Mozilla), nor have they responded to my mails. I don&#8217;t think I have any choice but to publicly point out the significant flaws in their linking strategy and encourage Debian via peer pressure to rethink their poorly thought out decision.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It has come to my attention that the maintainer of the Debian Mozilla packages (Mike Hommey) is using patches that significantly alter the XULRunner linking strategy (first discussed here).These patches cause various Mozilla libraries to be soversioned and installed in the library path (\/usr\/lib). Although I have emailed Mr. Hommey privately on a number of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[10],"class_list":["post-82","post","type-post","status-publish","format-standard","hentry","category-mozilla","tag-xulrunner"],"_links":{"self":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/82","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/comments?post=82"}],"version-history":[{"count":0,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/posts\/82\/revisions"}],"wp:attachment":[{"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/media?parent=82"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/categories?post=82"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/benjamin.smedbergs.us\/blog\/wp-json\/wp\/v2\/tags?post=82"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}