Author: C.J. Collier

  • Producing relocatable packages with the GNU build system

    I’ve recently found a need to create relocatable versions of some of my favorite libraries (produced, not-so-coincidentally by the GNU build system). You might find yourself asking “What is relocatable software, and why should I care?” Maybe I can help.

    A piece of software is said to be “relocatable” when it does not rely on an absolute path in a filesystem in order to operate correctly. An example of this type of system is OS X’s .app directory/package framework.

    As it currently stands, if I were to install iceweasel (or Firefox™) in /usr/local/mozilla/, but later realize there is more disk space available in /opt, I would be SOL. If mozilla were built as a relocatable package, however, moving /usr/local/mozilla/ to /opt/mozilla/ would not be a problem.

    There are a couple of things standing in the way of this shiny new future.

    1) In its current state, GNU autoconf accepts multiple absolute paths as argument values. In a relocatable package, all related software must be installed relative to a single point, referred to in autoconf nomenclature as the “prefix”. In a perfect world, all directories relative to the prefix would be further constrained as not to be beneath the prefix root. For example, defining the “bindir” as ${prefix}/../bin/ would be a no-no.

    I have proposed a solution to this problem on the bug-autoconf list.

    2) After a package is created in a relocatable way, how does one find said package once it has been moved?

    The solution to this problem lies in the standardization of the use of pkg-config and subsequent modifications to the $PKG_CONFIG_PATH environment variable.

    The first step is to ensure that your GNU build system includes a rule to generate a .pc file. The standard way to do this is to include a .pc.in autoconf template in the distribution as well as an entry in the AC_OUTPUT( … ) macro of the configure.am file (configure.in in legacy codebases).

    Here are some examples from the Mono codebase. Note that configure.am is named configure.in in the mono codebase. Note further that I am scowling.

    AC_OUTPUT([
    Makefile
    mint.pc
    mono.pc
    mono-cairo.pc
    dotnet.pc
    mono-uninstalled.pc
    scripts/mono-nunit.pc
    ...
    ])
    

    Here are a couple of examples of the contents of .pc.in files:

    cjac@dom0:/usr/src/svn/mono/mono-1.2.5$ cat mint.pc.in 
    prefix=${pcfiledir}/../..
    exec_prefix=${pcfiledir}/../..
    libdir=${prefix}/lib
    includedir=${prefix}/include/mono-@API_VER@
    
    
    Name: Mono Interpreter
    Description: Mono Interpreter Runtime
    Version: @VERSION@
    Requires: glib-2.0 gthread-2.0
    Libs: -L${libdir} @export_ldflags@ -lmint @libmono_ldflags@
    Cflags: -I${includedir} @libmono_cflags@
    
    cjac@dom0:/usr/src/svn/mono/mono-1.2.5$ cat mono.pc.in 
    prefix=${pcfiledir}/../..
    exec_prefix=${pcfiledir}/../..
    libdir=${prefix}/@reloc_libdir@
    includedir=${prefix}/include/mono-@API_VER@
    
    Name: Mono
    Description: Mono Runtime
    Version: @VERSION@
    Requires: glib-2.0 gthread-2.0
    Libs: -L${libdir} @export_ldflags@ -lmono @libmono_ldflags@
    Cflags: -I${includedir} @libmono_cflags@
    

    Of particular importance in these files is the definition of ${prefix}, ${exec_prefix}, ${libdir} and ${includedir} relative to ${pcfiledir}. ${pcfiledir} is set at pkg-config run time as it iterates over the contents of the $PKG_CONFIG_PATH environment variable.

    For example, if $PKG_CONFIG_PATH evaluates as “/home/cjac/opt/mono/lib/pkgconfig:/usr/lib/pkgconfig”, on the first iteration, ${pcfiledir} will store /home/cjac/opt/mono/lib/pkgconfig, and on the second iteration, ${pcfiledir} will store /usr/lib/pkgconfig.

    So! Assuming I installed mono to ~/opt/mono, and I wanted to instead move it to /opt/mono, all I would need to do is the following:

    $ sudo mv ~/opt/mono /opt
    $ export PKG_CONFIG_PATH="/opt/mono/lib/pkgconfig:$PKG_CONFIG_PATH"
    

    And voila. All of my mono-related bits and all references to them have been moved. Independent of the absolute path to the mono package, the prefix can be determined in a consistent way:

    $ pkg-config mono --variable=prefix
    

    Comment away… I’ll try to get rid of some of the spam crowding my comment backlog…

  • Holy pull-my-pants-down, Batman!

    It looks like Adobe Creative Suite 3 kicks your security in the nuts while it installs its call home software. It sounds as if it a) doesn’t ask for permission to shut your firewall down, b) doesn’t inform you that it is shutting your firewall down and c) doesn’t bring your firewall back up when it’s done.

    Not cool, folks. It is good of you to discover the problem and post it in a public forum, though.

    During the installation, the Adobe installer sets up controlled access to the Version Cue CS3 Server through specific ports in the personal firewall. To be granted access to these ports, the installer first turns off the personal firewall. After the installation is complete, the Adobe installer does not automatically re-activate the firewall.

    It sounds to me like OS X needs a bit better MAC management interface. I won’t install CS3 on my laptop until I know that the installer app *must* request my permission before futzing with security settings. As it stands, the installer asks for your permission to acquire superuser status, after which it may do anything without asking. Whee. It would be better if it described what it intended to do explicitly and allowed me to allow/deny on an individual level.

  • Moved groups at AMZN

    I moved to the “Merchendising Applications” group at Amazon. I’m ramping up, but it looks like this group has the potential to make a very large positive impact on the quality of the site.

    I’m doped up on pain meds, so I’m going to stop now before I start breaking things…

  • Invested in CTXS

    I just had my first vesting in work stocks. I sold a few and re-invested some of the proceeds in Citrix, who plans to purchase XenSource, the employer of Keir Fraser, Tim Deegan, James Bulpin and Ian Campbell, the primary contributors to the development branch of the xen source tree for the last month, and probably since its release on an unwitting world.

    I’ve been using Xen on the Colliertech servers since early 2005 and have been very happy with it. I’m glad to see that these devs are getting compensated for their hard work on this project. My best wishes to the XenSource team and Citrix.

  • Setting up a cluster

    So… I guess at this point, the hosts on colliertech.org could be considered a cluster. We have all of the services you would expect from a real ISP running on the network at this point. I think. I’m learning more and more as I go along.

    I set up autofs for the first time this weekend. I’m pretty happy with the system, but I had a heck of a time getting it going. I was baffled at first by the format of the auto.master and auto.foo config files. Here’s what the client-side configuration ended up looking like:

    $ tail -1 /etc/auto.master
    /etc/auto/nfs /etc/auto/auto.nfs
    
    $ cat /etc/auto/auto.nfs
    aptconf/*       nfs:/etc/apt/&
    aptconf         nfs:/etc/apt
    
    aptcache/*      nfs:/var/lib/apt/lists/&
    aptcache        nfs:/var/lib/apt/lists
    
    debmirror/*     nfs:/var/spool/debmirror/&
    debmirror       nfs:/var/spool/debmirror
    
    share/*         nfs:/usr/share/&
    share           nfs:/usr/share
    
    home/*          nfs:/home/&
    home            nfs:/home
    
    $ ls -l /home /etc/apt /var/spool/debmirror /var/lib/apt/lists /usr/share
    lrwxrwxrwx 1 root root 21 Aug 19 17:19 /etc/apt -> /etc/auto/nfs/aptconf
    lrwxrwxrwx 1 root root 18 Aug 19 16:36 /home -> /etc/auto/nfs/home
    lrwxrwxrwx 1 root root 19 Aug 19 16:35 /usr/share -> /etc/auto/nfs/share
    lrwxrwxrwx 1 root root 22 Aug 19 13:01 /var/lib/apt/lists -> /etc/auto/nfs/aptcache
    lrwxrwxrwx 1 root root 23 Aug 19 13:00 /var/spool/debmirror -> /etc/auto/nfs/debmirror
    

    One recommendation I have for those that want to try this at home: put a local stub in place for each of those in case the client boots while the nfs server is out to lunch. If you have a reasonable fallback in place, it should not matter how late in the runlevel process you put the init script for autofs. That way you could, for instance, ensure that any virtual machines that host services relied on by this client are running before anything tries to use them.

  • Mediawiki, Mozilla, and remote pages linking to local files

    So I’ve got mediawiki running on an intranet web server, and I use it to store notes about the things I’m working on. I downloaded a bunch of docs and started making links to the local copies of the manuals using the standard mediawiki notation, [url alias].

    However, in its default configuration, for security reasons, mediawiki does not produce links from URIs starting with file://.

    I was able to remedy this by adding the following to my wiki’s LocalSettings.php:

    array_push($wgUrlProtocols, 'file://');

    The next problem was that my browser itself did not like it that a remote web server was trying to direct me to files on my local machine. It complained with the following in my javascript error console:

    Security Error: Content at <remote url> may not load or link to file://<local file path>

    This was resolved by a bit of research. At the MozillaZine knowledge base, they recommended adding the following to my user.js:

    user_pref("capability.policy.policynames", "localfilelinks");
    user_pref("capability.policy.localfilelinks.sites", "http://www.example.com");
    user_pref("capability.policy.localfilelinks.checkloaduri.enabled", "allAccess");
    

    I had a hard time figuring out where, exactly, my user.js file was, so I grabbed a copy of the ChromeEdit Add-on. After re-starting the browser, there was a ChromeEdit Plus menu item under Tools. Selecting ChromeEdit from the submenu brought up a window with a users.js tab. After pasting the above code into the form, modifying for my needs, pressing Save, and then Restart, my browser came back up and allowed me to follow links to local files from the host I indicated in capability.policy.localfilelinks.sites.

  • autotools build error – resolved!

    I googled all over for this error with no results:

    autom4te: unknown language: Autoconf-without-aclocal-m4
    aclocal-1.10: autom4te failed with exit status: 1
    

    It turns out that I had built an obsolete version of autoconf (2.53) and it was in my $PATH ahead of everything sane. Building and installing 2.61 (the latest version as of 2007/08/15) fixes this, and jhbuild is happily sucking my CPU and network time away once more.

    You can find the latest version of autoconf (and a whole bunch of other nice toys) on the GNU FTP server.

  • Back online…

    Sorry for the outage, folks. We’re back up now. This time with a firewall. Ain’t that fun?

    Someone broke in to the machine in February and was using the un-throttled bandwidth to spam the world.

    I’ve added a throttle and firewall, much stricter access to the internal network, monitoring tools and an alert infrastructure. Hopefully this will not happen again.

    The SMTP and IMAP servers are not functioning yet, so I’m not able to send or receive email from my standard address again yet. That’s next on the list, but it requires installation and configuration of an LDAP system, some fiddling with the mail storage system, and the import of all of the old messages.

    Another new bit is that I didn’t get the email about OMGWTF!!! YOUR DOMAIN IS GOING TO EXPIRE!!! so it did, and now I’m without colliertech.com.

  • Article on Paco

    Paco, a friend of mine and fellow contributor to the Mono project was recently covered in an article in the Ft. Worth/Dallas Start Telegram. Paco’s an inspiration to a lot of us. He recently joined up with the Air Force reserves and is stationed at Lackland airforce base.

    Paco’s son, Paquito was shot and killed by a sniper in Iraq two years ago. Although I never got to know Paquito, I feel for Paco and can only imagine how I would feel if the same were to happen to Scarlet.

    Rest in peace, Paquito.

  • Mono Project on Launchpad

    Hey folks,

    Robert Collins and Mark Shuttleworth were kind enough to add a Launchpad project for Mono. It will be nice to have a presence on Launchpad, as it is one of the focus points of the Ubuntu development team. We should be able to wrangle some more ubuntu devs with this exposure.

    The Prebuild work is coming along well. The Autotools target in my subversion repository is now generating autogen.sh, configure.ac and Makefile.am files for the Solution-level and each Project-level entity. I just committed some code to create stubs for the files automake requires to run correctly. So now, running “sh autogen.sh” from the generated root runs configure in the Solution and all of the Projects. There are still no rules to copy, link, whatever the source .cs files to the autotools build path or create the Makefile.am targets, but we’re getting closer. I guess that’s the next step.