<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>teideal glic deisbhéalach &#187; linux</title>
	<atom:link href="http://www.serpentine.com/blog/category/software/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.serpentine.com/blog</link>
	<description>Bryan O&#039;Sullivan&#039;s blog</description>
	<lastBuildDate>Thu, 01 Dec 2011 16:53:49 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Dealing with fragile C libraries (e.g. MySQL) from Haskell</title>
		<link>http://www.serpentine.com/blog/2010/09/04/dealing-with-fragile-c-libraries-e-g-mysql-from-haskell/</link>
		<comments>http://www.serpentine.com/blog/2010/09/04/dealing-with-fragile-c-libraries-e-g-mysql-from-haskell/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 06:23:13 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/?p=670</guid>
		<description><![CDATA[I spent some time today trying to talk to a MySQL database server from a piece of middleware I'm writing in Haskell. You might think that talking to a database server would be easy, but it turned out to be quite a bother.Both of the major MySQL bindings, HDBC-mysql and HDBC-odbc, use the libmysqlclient C [...]]]></description>
			<content:encoded><![CDATA[<p
>I spent some time today trying to talk to a MySQL database server from a piece of middleware I'm writing in Haskell. You might think that talking to a database server would be easy, but it turned out to be quite a bother.</p
><p
>Both of the major MySQL bindings, <a href="http://hackage.haskell.org/package/HDBC-mysql"
  >HDBC-mysql</a
  > and <a href="http://hackage.haskell.org/package/HDBC-odbc"
  >HDBC-odbc</a
  >, use the <code
  >libmysqlclient</code
  > C library behind the scenes. With GHC's unthreaded runtime, which is still the default, an application using either will work fine. However, my middleware app is highly concurrent and uses software transactional memory (STM) to manage some shared state, and I have to use the threaded runtime. This is where my troubles began.</p
><p
>The symptom I observed was that I couldn't even connect to a database:</p
><pre
><code
  >SqlError {
  seState = &quot;&quot;, 
  seNativeError = 2003, 
  seErrorMsg = &quot;Can't connect to MySQL server on 'xxxxx' (4)&quot;}
</code
  ></pre
><p
>After enough years of dealing with MySQL, you pick up some useful nuggets such as &quot;the number in parentheses at the end of certain kinds of error message is a Unix <code
  >errno</code
  > value&quot; (the library doesn't provide any other way to see what <code
  >errno</code
  > caused a failure, amusingly enough). The number 4 is <code
  >EINTR</code
  >, indicating that a system call was being interrupted.</p
><p
>I split my development time between a Mac and a Linux laptop, and today's hacking was on a Mac, so I fired up <code
  >dtruss</code
  > to see what was wrong:</p
><pre
><code
  >dtruss -b128m myapp
</code
  ></pre
><p
>(I'd much preferred to have been using Linux here. <code
  >dtruss</code
  > is vastly inferior to <code
  >strace</code
  >, and in fact in its default configuration, it doesn't work at all! That <code
  >-b128m</code
  > is necessary to give its kernel component enough of a scratchpad that it won't run out of space while sampling.)</p
><p
>The interrupted system call was <code
  >connect</code
  >, and sure enough, reading the <a href="http://bazaar.launchpad.net/~mysql/mysql-server/mysql-5.1/annotate/head:/sql-common/client.c#L158"
  >library source code</a
  >, we can see that the problem lies in the <code
  >my_connect</code
  > function:</p
><pre class="sourceCode c"
><code
  >  <span class="co"
    >/*</span
    ><br
     /><span class="co"
    >    If they passed us a timeout of zero, we should behave</span
    ><br
     /><span class="co"
    >    exactly like the normal connect() call does.</span
    ><br
     /><span class="co"
    >  */</span
    ><br
     /><br
     />  <span class="kw"
    >if</span
    > (timeout == <span class="dv"
    >0</span
    >)<br
     />    <span class="kw"
    >return</span
    > connect(fd, (<span class="kw"
    >struct</span
    > sockaddr*) name, namelen);<br
     /></code
  ></pre
><p
>The comment is more or less accurate, but the library should be more careful in its use of the <code
  >connect</code
  > function: the caller of <code
  >my_connect</code
  > doesn't check for <code
  >EINTR</code
  >, and so the connection will fail if the thread receives a signal.</p
><p
>Why is the thread receiving a signal in the first place, though? GHC's threaded RTS sets up either a <code
  >SIGALRM</code
  > or <code
  >SIGVTALRM</code
  > signal to perform some internal book-keeping at a fairly high frequency, and it's the arrival of this signal that interrupts <code
  >connect</code
  >. Failure to check for <code
  >EINTR</code
  > and retry is a widespread problem in C code that uses system calls directly.</p
><p
>To work around this, I wrote a simple module that masks the RTS signals that the MySQL client library fails to handle, then performs an action. It ensures that it's running in a bound thread (GHC terminology for a lightweight thread that's tied to a heavyweight system thread) for the duration of the action.</p
><pre class="sourceCode haskell"
><code
  ><span class="ot"
    >{-# LANGUAGE EmptyDataDecls, ForeignFunctionInterface #-}</span
    ><br
     /><br
     /><span class="kw"
    >module</span
    > <span class="dt"
    >RTSHack</span
    > (withRTSSignalsBlocked) <span class="kw"
    >where</span
    ><br
     /><br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Control.Concurrent</span
    > (runInBoundThread)<br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Control.Exception</span
    > (finally)<br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Foreign.C.Types</span
    > (<span class="dt"
    >CInt</span
    >)<br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Foreign.Marshal.Alloc</span
    > (alloca)<br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Foreign.Ptr</span
    > (<span class="dt"
    >Ptr</span
    >, nullPtr)<br
     /><span class="kw"
    >import</span
    > <span class="dt"
    >Foreign.Storable</span
    > (<span class="dt"
    >Storable</span
    >(<span class="fu"
    >..</span
    >))<br
     /><br
     /><span class="fu"
    >#</span
    >include <span class="fu"
    >&lt;</span
    >signal<span class="fu"
    >.</span
    >h<span class="fu"
    >&gt;</span
    ><br
     /><br
     />withRTSSignalsBlocked :: <span class="dt"
    >IO</span
    > a -&gt; <span class="dt"
    >IO</span
    > a<br
     />withRTSSignalsBlocked act <span class="fu"
    >=</span
    > runInBoundThread <span class="fu"
    >.</span
    > alloca <span class="fu"
    >$</span
    > \set -&gt; <span class="kw"
    >do</span
    ><br
     />  sigemptyset set<br
     />  sigaddset set (<span class="fu"
    >#</span
    >const <span class="dt"
    >SIGALRM</span
    >)<br
     />  sigaddset set (<span class="fu"
    >#</span
    >const <span class="dt"
    >SIGVTALRM</span
    >)<br
     />  pthread_sigmask (<span class="fu"
    >#</span
    >const <span class="dt"
    >SIG_BLOCK</span
    >) set nullPtr<br
     />  act <span class="ot"
    >`finally`</span
    > pthread_sigmask (<span class="fu"
    >#</span
    >const <span class="dt"
    >SIG_UNBLOCK</span
    >) set nullPtr<br
     /><br
     /><span class="kw"
    >data</span
    > <span class="dt"
    >SigSet</span
    ><br
     /><br
     /><span class="kw"
    >instance</span
    > <span class="dt"
    >Storable</span
    > <span class="dt"
    >SigSet</span
    > <span class="kw"
    >where</span
    ><br
     />    sizeOf    _ <span class="fu"
    >=</span
    > <span class="fu"
    >#</span
    >{size sigset_t}<br
     />    alignment _ <span class="fu"
    >=</span
    > alignment (<span class="fu"
    >undefined</span
    > :: <span class="dt"
    >Ptr</span
    > <span class="dt"
    >CInt</span
    >)<br
     /><br
     />foreign <span class="kw"
    >import</span
    > ccall unsafe <span class="st"
    >&quot;signal.h sigaddset&quot;</span
    > sigaddset<br
     />    :: <span class="dt"
    >Ptr</span
    > <span class="dt"
    >SigSet</span
    > -&gt; <span class="dt"
    >CInt</span
    > -&gt; <span class="dt"
    >IO</span
    > ()<br
     /><br
     />foreign <span class="kw"
    >import</span
    > ccall unsafe <span class="st"
    >&quot;signal.h sigemptyset&quot;</span
    > sigemptyset<br
     />    :: <span class="dt"
    >Ptr</span
    > <span class="dt"
    >SigSet</span
    > -&gt; <span class="dt"
    >IO</span
    > ()<br
     /><br
     />foreign <span class="kw"
    >import</span
    > ccall unsafe <span class="st"
    >&quot;signal.h pthread_sigmask&quot;</span
    > pthread_sigmask<br
     />    :: <span class="dt"
    >CInt</span
    > -&gt; <span class="dt"
    >Ptr</span
    > <span class="dt"
    >SigSet</span
    > -&gt; <span class="dt"
    >Ptr</span
    > <span class="dt"
    >SigSet</span
    > -&gt; <span class="dt"
    >IO</span
    > ()<br
     /></code
  ></pre
>]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2010/09/04/dealing-with-fragile-c-libraries-e-g-mysql-from-haskell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Haskell Platform support for Fedora: we&#8217;re almost there</title>
		<link>http://www.serpentine.com/blog/2009/08/12/haskell-platform-support-for-fedora-were-almost-there/</link>
		<comments>http://www.serpentine.com/blog/2009/08/12/haskell-platform-support-for-fedora-were-almost-there/#comments</comments>
		<pubDate>Thu, 13 Aug 2009 02:10:35 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/?p=414</guid>
		<description><![CDATA[I spent a little time earlier today clarifying the Fedora project&#8216;s support for the Haskell Platform. You can read the details here; the summary is that we&#8217;re currently four packages short of complete support for the current release of the Haskell Platform. You can install the whole lot with a single copy-and-paste to your command [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a little time earlier today clarifying the <a href="http://fedoraproject.org/">Fedora project</a>&#8216;s support for the <a href="http://hackage.haskell.org/platform/">Haskell Platform</a>. You can <a href="https://fedoraproject.org/wiki/SIGs/Haskell#Haskell_Platform_support">read the details here</a>; the summary is that we&#8217;re currently four packages short of complete support for the current release of the Haskell Platform. You can install the whole lot with a single copy-and-paste to your command line, no manual build or dependency installation required.</p>

<p>With any luck, if we can get things complete, this will spur the Debian (and by extension, Ubuntu) Haskell team into finishing off <em>their</em> support for the Platform, in the spirit of friendly competition. That would leave us in the delicious situation of being able to tell curious people that almost any major Linux distro will make a good basis for developing and deploying Haskell applications. Sweet!</p>]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2009/08/12/haskell-platform-support-for-fedora-were-almost-there/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>What to expect from the new binutils linker</title>
		<link>http://www.serpentine.com/blog/2008/03/24/what-to-expect-from-the-new-binutils-linker/</link>
		<comments>http://www.serpentine.com/blog/2008/03/24/what-to-expect-from-the-new-binutils-linker/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 05:07:05 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2008/03/24/what-to-expect-from-the-new-binutils-linker/</guid>
		<description><![CDATA[I&#8217;ve been following Ian Lance Taylor&#8217;s updates on the status of gold, the new binutils linker, for a while, so when he announced that he&#8217;d added it to the binutils tree, I decided to make a little time to try it out. I have a fairly large C++ application handy, so I tried linking it [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been following Ian Lance Taylor&#8217;s updates on the status of gold, the new binutils linker, for a while, so when he announced that he&#8217;d <a href="http://www.airs.com/blog/archives/164">added it to the binutils tree</a>, I decided to make a little time to try it out.</p>
<p>I have a fairly large C++ application handy, so I tried linking it on my dual core Thinkpad with 2GB of memory, running Fedora 8.</p>
<p>When I compile this application with debugging symbols enabled, it&#8217;s not exactly fast to link: it takes about a minute. Because the amount of data the linker has to chew through is impressively large, the actual time varies by up to 20% from one run to the next: all of those object files don&#8217;t fit into memory at once. This also has the unpleasant effect of paging out parts of apps I&#8217;m trying to use, such as Emacs and Firefox. Hmph.</p>
<p>In this situation, gold does indeed improve linking performance, bringing the linking time down to about 40 seconds. The poor laptop&#8217;s disk still spends a lot of this time grinding away due to the sheer volume of data, so once again the number isn&#8217;t very repeatable.</p>
<p>To eliminate the effect of memory pressure, I used &#8220;strip -g&#8221; to drop the debug information from the main app&#8217;s object files. (The libraries it links against still contain debug info, but they&#8217;re much smaller than the app itself.)</p>
<p>Stripping the object files speeds up the regular binutils linker by a factor of four, reducing linking time to 14 seconds. The laptop&#8217;s disk is no longer being touched. I can still edit text files after a link without big initial stutters. Whew!</p>
<p>When I switched to using gold as the linker, I was at first a little surprised to find that it actually works at all. This isn&#8217;t especially common for a complicated program that&#8217;s just been committed to a source tree. Better yet, it&#8217;s as fast as Ian claims: my app now links in 2.6 seconds, almost 5.4 times faster than with the old binutils linker!</p>
<p>When I ran &#8220;ld &#8211;help&#8221;, I noticed the tantalising options &#8220;&#8211;threads&#8221; and &#8220;&#8211;thread-count&#8221;, so I tried those. It turns out that thread support is not enabled by default: I reconfigured, rebuilt, and tried again. Running with &#8220;&#8211;thread-count 2&#8243;, the linking time drops slightly, to 2.3 seconds: that&#8217;s nearly 6.1 times faster than before.</p>
<p>Does the application actually <em>work</em> when linked by gold? Yes, so far with no signs of problems. It&#8217;s about 3% larger than the version produced by the old linker. I haven&#8217;t looked into why this might be.</p>
<p>Is gold ready for prime time? It&#8217;s not too far off. It doesn&#8217;t support the &#8211;build-id flag, which my copy of gcc 4.3 is convinced it wants (perhaps because I&#8217;m running Fedora). It doesn&#8217;t link the Linux kernel properly, because the kernel tortures the linker in twisted and innovative ways. Also, I have run into a few non-reproducible crashes when running in threaded mode, such as the following:</p>
<pre>
internal error in find_runnable_or_wait, at ../../gold/workqueue.cc:262
</pre>
<p>Overall, though, I&#8217;m very impressed, and I&#8217;m looking forward to the point where gold entirely supplants the existing binutils linker. I expect that won&#8217;t take too long, once Mozilla and KDE developers find out about the performance boost. Great work, Ian!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2008/03/24/what-to-expect-from-the-new-binutils-linker/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>GHC 6.8.1 pushed to Fedora 8 testing</title>
		<link>http://www.serpentine.com/blog/2007/11/09/ghc-681-pushed-to-fedora-8-testing/</link>
		<comments>http://www.serpentine.com/blog/2007/11/09/ghc-681-pushed-to-fedora-8-testing/#comments</comments>
		<pubDate>Fri, 09 Nov 2007 22:22:22 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/11/09/ghc-681-pushed-to-fedora-8-testing/</guid>
		<description><![CDATA[Upgrading my laptop from F-7 to F-8 yesterday was painless, so I&#8217;ve been able to verify that the latest version of GHC works smoothly. I&#8217;ve pushed the built packages to the F-8 testing repository, and will bump them to release in about a week. If you&#8217;re feeling impatient, you can download the final RPMs from [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading my laptop from F-7 to F-8 yesterday was painless, so I&#8217;ve been able to verify that the latest version of GHC works smoothly. I&#8217;ve pushed the built packages to the F-8 testing repository, and will bump them to release in about a week.</p>
<p>If you&#8217;re feeling impatient, you can download the final RPMs from <a href="http://koji.fedoraproject.org/koji/buildinfo?buildID=23739">the koji build page</a>. I&#8217;ve got a build of Gtk2Hs pending, too, so I&#8217;ll be releasing that at the same time as the bump of GHC itself.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/11/09/ghc-681-pushed-to-fedora-8-testing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Fedora 7 on a Thinkpad X60: not so hot</title>
		<link>http://www.serpentine.com/blog/2007/06/20/fedora-7-on-a-thinkpad-x60-not-so-hot/</link>
		<comments>http://www.serpentine.com/blog/2007/06/20/fedora-7-on-a-thinkpad-x60-not-so-hot/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 06:54:07 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[hardware]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/06/20/fedora-7-on-a-thinkpad-x60-not-so-hot/</guid>
		<description><![CDATA[I&#8217;ve been running test releases of Fedora 7, and lately the final release, for a number of months on my fairly new Lenovo Thinkpad X60. Here&#8217;s a brief summary of my experiences. I&#8217;ve been using Fedora since 0.92 (Taroon), and while I&#8217;ve generally been happy with it, F7 is not exactly a model of stability [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been running test releases of Fedora 7, and lately the final
release, for a number of months on my fairly new Lenovo Thinkpad X60.
Here&#8217;s a brief summary of my experiences.</p>

<p>I&#8217;ve been using Fedora since 0.92 (Taroon), and while I&#8217;ve generally
been happy with it, F7 is not exactly a model of stability or
sleekness.  Here&#8217;s a list of problems I&#8217;ve run into.  My biggest
problems so far have been with suspend and resume, and network
drivers.</p>

<p>Suspend to RAM doesn&#8217;t work by default; when I resume, the screen is
blank, and can&#8217;t be coaxed back to life save through a reboot.  This
is <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=243759">bug
243759</a>.
I came up with a fix (for my hardware, at least) in <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=237849">bug
237849</a>.
Richard Hughes&#8217;s fabulous <a href="http://people.freedesktop.org/~hughsient/quirk/index.html">HAL quirk
site</a> was
the key to figuring out that one; thanks, Richard!</p>

<p>Suspend to disk (aka &#8220;hibernate&#8221;) works, some of the time.  But it
interacts poorly with the crummy quality of the current <code>e1000</code>
ethernet driver.</p>

<p>The <code>e1000</code> driver is flaky in F7.  If I boot with a live ethernet
cable plugged in, it works.  But if I plug one in <em>after</em> booting, it
fails to detect the carrier signal, and simply never notices the
cable.  <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=236956">Bug
236956</a>.</p>

<p>There is a workaround, of sorts.  If I manually <code>rmmod</code>, then
<code>modprobe</code> the driver again, it will detect the carrier signal.
Unfortunately, after I do this, the next time that I try to suspend to
disk, all of my network-related processes get stuck in an unkillable
state, and suspend throws in the towel.  <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=245107">Bug
245107</a>.</p>

<p>If I try to use the screen backlight brightness control buttons, the
screen goes black instead.  <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=220466">Bug
220466</a>.</p>

<p>If I disable the internal modem in the BIOS, sound no longer works.
<a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=205603">Bug
205603</a>.</p>

<p>The new <code>iwl3945</code> wireless driver simply falls over after a while,
depending on the network configuration it&#8217;s talking to.  <a href="https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=240826">Bug
240826</a>.</p>

<p>By the way, I&#8217;m not claiming that these problems are in any way the
fault of Dave Jones, Chuck Ebbert, the HAL guys, or other Fedora
maintainers.  They have a thankless job trying to clean up the endless
flood of new bugs in upstream kernels, not to mention cascades of junk
hardware and buggy BIOSes from vendors.  I&#8217;m frankly relieved every
time the kernel boots reliably at all.</p>

<p>On top of these stability and reliability problems, performance has
taken a bit of a beating.  F7 seems to take quite a bit longer than
earlier releases to boot, something <a href="http://kernelslacker.livejournal.com/81262.html">Dave Jones has
quantified</a>.  The
post-boot bloat also rises: there are more kernel threads and
userspace daemons running than ever before.</p>

<p>On the positive side, 3D graphics works quite well.  I can actually
run OpenGL apps like Google Earth and Second Life without crashes, and
get decent frame rates out of them.  And of course I can turn on wobbly windows and
induce vertigo and nausea within minutes, where previously I had to
resort to using Windows to get that sensation.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/06/20/fedora-7-on-a-thinkpad-x60-not-so-hot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GHC 6.6.1 for Fedora</title>
		<link>http://www.serpentine.com/blog/2007/05/14/ghc-661-for-fedora/</link>
		<comments>http://www.serpentine.com/blog/2007/05/14/ghc-661-for-fedora/#comments</comments>
		<pubDate>Tue, 15 May 2007 06:08:53 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/05/14/ghc-661-for-fedora/</guid>
		<description><![CDATA[With Jens Petersen&#8217;s blessing, I&#8217;ve packaged GHC 6.6.1 for Fedora Extras. If you use FC6, it&#8217;s available via yum as of a few days ago. It will be a part of Fedora 7 as soon as that comes out, too. The upgrade to 6.6.1 necessitated a bump of the release number of the Fedora Gtk2Hs [...]]]></description>
			<content:encoded><![CDATA[<p>With Jens Petersen&#8217;s blessing, I&#8217;ve packaged GHC 6.6.1 for Fedora
Extras.  If you use FC6, it&#8217;s available via <code>yum</code> as of a few days
ago.  It will be a part of Fedora 7 as soon as that comes out, too.</p>

<p>The upgrade to 6.6.1 necessitated a bump of the release number of
the Fedora Gtk2Hs package, too.  There are no changes in the new
release; it&#8217;s just built against the newer compiler release.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/05/14/ghc-661-for-fedora/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to dual-boot Windows and Fedora, by hand, for the insane</title>
		<link>http://www.serpentine.com/blog/2007/04/11/how-to-dual-boot-windows-and-fedora-by-hand-for-the-insane/</link>
		<comments>http://www.serpentine.com/blog/2007/04/11/how-to-dual-boot-windows-and-fedora-by-hand-for-the-insane/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 06:20:59 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/04/11/how-to-dual-boot-windows-and-fedora-by-hand-for-the-insane/</guid>
		<description><![CDATA[I recently bought a Thinkpad X60 that came with Windows preinstalled. I never actually use Windows, but it&#8217;s convenient to have around for the occasional BIOS update. My Linux distribution of choice has long been Fedora. Unfortunately, unlike other modern Linux distros, Fedora doesn&#8217;t provide a simple graphical means to shrink an NTFS partition in [...]]]></description>
			<content:encoded><![CDATA[<p>I recently bought a Thinkpad X60 that came with Windows preinstalled.
I never actually use Windows, but it&#8217;s convenient to have around for
the occasional BIOS update.</p>

<p>My Linux distribution of choice has long been
<a href="http://www.fedoraproject.org/">Fedora</a>.  Unfortunately, unlike other
modern Linux distros, Fedora doesn&#8217;t provide a simple graphical means
to shrink an NTFS partition in its installer.</p>

<p>Since the X60 doesn&#8217;t have an optical drive, and I don&#8217;t have any USB
storage like a memory stick or CD-ROM drive, I couldn&#8217;t easily boot
into something like <a href="http://www.knoppix.org/">Knoppix</a>.  If I&#8217;d had
such gear available, I could easily have shrunk the Windows partition
using <a href="http://qtparted.sourceforge.net/"><code>qtparted</code></a>.  So here are my
notes on how to get dual-booting working, by hand, in a bare-bones
environment.</p>

<p><em>Really</em>, if there&#8217;s some way you can use a sane all-in-one GUI tool
like <code>qtparted</code> to do all of this messy work, you should.  You should
think of these as the instructions of last resort for the terminally
optimistic.</p>

<p>Since I had no suitable media handy, I installed Fedora onto the X60
over the network using PXE.  (Getting a PXE server configured sounds
scary, but I had one up and serving in less than five minutes on my
older laptop.  Granted, I&#8217;ve done this many times.)</p>

<p>When the Fedora installer (Anaconda) is running, it runs you through a
series of questions in text mode, and then starts up an X-based GUI.
Don&#8217;t run through any of the GUI setup steps yet.  Behind the scenes,
Anaconda also sets up some virtual terminals, one of which contains a
root shell prompt.  That root prompt is the key to shrinking your
Windows partition.</p>

<p>To get to the virtual terminal with the root prompt, you&#8217;ll first need
to press the key combination of Control+Alt+F1 to switch to the first
virtual terminal.  After that, you can press Alt+F2 to get to the
second, Alt+F3 the third (I <em>think</em> this is the one where the root
prompt lives), and so on.  Alt+F6 will bring you back to the GUI.</p>

<p>Once you have a root prompt, you&#8217;ll need to find another system, such
as the one you&#8217;re installing from, and download an
<a href="http://www.linux-ntfs.org/"><code>ntfsprogs</code></a> source tarball.  Unpack it,
and build static binaries.  (You <em>must</em> have static binaries, because
the install environment doesn&#8217;t provide shared libraries.)</p>

<pre><code>tar zxf ntfsprogs-1.13.1.tar.gz
cd ntfsprogs-1.13.1
./configure --enable-really-static
make
</code></pre>

<p>(Don&#8217;t forget to make sure that you&#8217;re building binaries that can
actually <em>run</em> on the machine you&#8217;re installing on!  If you&#8217;re
installing an <code>x86_64</code> version of Fedora, for example, it doesn&#8217;t
matter whether you build a 32-bit or 64-bit version of <code>ntfsprogs</code>.
But the converse is <em>not</em> the case.)</p>

<p>Once the build has finished, find the <code>ntfsresize</code> program in the
<code>ntfsprogs</code> subdirectory.  This is what you&#8217;ll need to get onto the
machine you&#8217;re installing on.</p>

<p>Go back to the root shell on the system you&#8217;re installing onto.
Recent versions of Anaconda make <code>ssh</code> and <code>scp</code> commands available
from the shell, so you can simply <code>scp</code> the <code>ntfsresize</code> program from
the system where you built it into <code>/tmp</code> on the machine you&#8217;re
installing on.</p>

<p>Before I continue, I must point out what should already be obvious: if
you are foolhardy enough to follow any directions after this point,
you could <em>completely destroy</em> all data on your disk.  Proceed at your
own risk!  If you have any important data on the system, back it up.</p>

<p>You&#8217;ll need to use the <code>fdisk</code> command to find out the name of your
Windows partition.  If you have a newish machine, it probably contains
a SATA drive, so you&#8217;ll probably need to invoke it thus:</p>

<pre><code>fdisk /dev/sda
</code></pre>

<p>Just type <code>p</code> to print the partition table, and note the name of the
big partition (there&#8217;s probably only one) that&#8217;s marked as HPFS/NTFS.
Once you&#8217;ve done that, type <code>q</code> to quit out of <code>fdisk</code>.</p>

<p>Let&#8217;s assume that <code>/dev/sda1</code> is your NTFS partition.  The next thing
to do is use <code>ntfsresize</code> to see what size it is:</p>

<pre><code>/tmp/ntfsresize -i /dev/sda1
</code></pre>

<p>This will run for a few seconds, and spit out lots of information.
The pertinent line to look for in the output begins with &#8220;You might
resize at &#8230;&#8221;.  Record that number: it&#8217;s the <em>minimum</em> you&#8217;re likely
to get away with.</p>

<p>Now try a dry run of resizing.  Let&#8217;s say you&#8217;ve chosen ten gigabytes
as your target Windows partition size.</p>

<pre><code>/tmp/ntfsresize -n -s 10G
</code></pre>

<p>Again, <code>ntfsresize</code> will run for a few seconds, and print lots of
information.  If it prints an error message, don&#8217;t try to follow any
directions beyond this point.  You&#8217;re on your own.</p>

<p>However, if the dry run completes successfully, you ought to be safe
to resize the partition.  This is the first point at which you can
destroy things, so it&#8217;s not for the faint of heart.  Simply run the
same command as before, only without the <code>-n</code> option. </p>

<pre><code>/tmp/ntfsresize -s 10G
</code></pre>

<p>This will take a few minutes to run.  If it exits with an error
message, this might be a good time to take up religion and prayer, or
at least to look for your Windows install CD.  That is, if your system
shipped with one.</p>

<p>Assuming <code>ntfsresize</code> did its job, the next step is even more scary:
you&#8217;ll have to fiddle with the disk&#8217;s partition table so that the NTFS
partition&#8217;s size matches the size of the actual filesystem.  Messing
with the partition table is even more scary than resizing filesystems,
so dust off that rabbit&#8217;s foot your well-meaning aunt gave you.</p>

<p>It&#8217;s time to run <code>fdisk</code> again, this time with prejudice.</p>

<pre><code>fdisk /dev/sda
</code></pre>

<p>Once again, type <code>p</code> to print the partition table.  This time, make a
note of the start offset of the NTFS partition.</p>

<p>Next, you&#8217;ll need to delete that partition table entry, with <code>d</code>.  It
will ask you for the number of the partition to delete; if your NTFS
partition is on <code>/dev/sda1</code>, you&#8217;ll be deleting partition 1.</p>

<p>With that partition table entry gone, you&#8217;ll be creating a new,
smaller entry to replace it.  To get started on this process, use <code>n</code>.</p>

<ol>
<li><code>fdisk</code> will ask you whether to create a primary or extended
partition.  Choose <code>p</code> for primary.</li>
<li>It will prompt you for the start offset of the partition.  You <em>must</em>
use the same start offset as the old partition had; this is likely to
be the default.</li>
<li>When <code>fdisk</code> asks you for an end offset, give it a <em>relative</em>
offset that&#8217;s the exact same size as you gave earlier to
<code>ntfsresize</code>.  For example, if you resized to ten gigabytes, type
<code>+10G</code> as the end offset.</li>
</ol>

<p>The new shrunken partition you created will not have an NTFS system
ID.  Use <code>t</code> from the main <code>fdisk</code> prompt to change its ID.  The
number to change it to is 7.</p>

<p>Once you&#8217;re done, use <code>p</code> to take a look at the new partition table.
This won&#8217;t actually be written to disk yet.  Once you&#8217;re sure it looks
correct (has the same start offset as before, the correct smaller
size, and the right system ID), use <code>w</code> to write out the new partition
table and quit <code>fdisk</code>.</p>

<p>In case I haven&#8217;t been successful in stating the risks of using
<code>fdisk</code> by hand, here are a few charming possibilities for you to
consider.</p>

<ul>
<li><code>fdisk</code> will make no attempt to ensure that your partition table is
correct or consistent.  Neither, most likely, will your operating
system.  It&#8217;s thus quite possible to accidentally cause your
partitions to overlap.  This can result in data corruption problems
that might not surface until <em>months</em> later.</li>
<li>If you hork your partition table badly enough, it can be a pain to
subsequently install <em>anything</em> on the system at all.  I&#8217;ve been
forced once or twice to use <code>dd</code> to splatter zeroes all over a
partition table in order to get it back to a state where I could do
<em>anything</em> with the disk.</li>
<li>Don&#8217;t say I didn&#8217;t warn you!</li>
</ul>

<p>At this point, you can return to the Anaconda GUI installer by typing
Alt+F6.  Step through a few install screens.  When Anaconda reaches
the point of asking you about partitioning, you <em>might</em> be okay to let
it partition automatically for you; I haven&#8217;t tried this, so I don&#8217;t
know.  I simply go with the custom disk layout option instead, and
find to my satisfaction that I now have a big chunk of empty space to
fill with swap and ext3 partitions.  As you continue through the
installation process, Anaconda should automatically set up the boot
loader to let you boot into Windows or Linux.</p>

<p>One final thing to bear in mind: the next time you boot into Windows
after your install is complete, Windows will probably run <code>chkdsk</code>
during boot, to verify that its filesystem is still sane.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/04/11/how-to-dual-boot-windows-and-fedora-by-hand-for-the-insane/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Getting started with installing third-party Haskell packages</title>
		<link>http://www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/</link>
		<comments>http://www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/#comments</comments>
		<pubDate>Sat, 06 Jan 2007 05:36:24 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/</guid>
		<description><![CDATA[Since I&#8217;ve been away from the Haskell world for a long time, it&#8217;s been interesting to return and observe some surprises about the practical side of working with the language. For me, an early gotcha has been the relative paucity of information on how to obtain and install third-party software packages. So here&#8217;s my little [...]]]></description>
			<content:encoded><![CDATA[Since I&#8217;ve been away from the Haskell world for a long time, it&#8217;s been interesting to return and observe some surprises about the practical side of working with the language.

For me, an early gotcha has been the relative paucity of information on how to obtain and install third-party software packages. So here&#8217;s my little contribution, in the form of simple instructions for the newcomer. I hope that someone will find them useful.

If you&#8217;re using Debian, you&#8217;re in great shape; there&#8217;s a good chance that whatever third-party package you&#8217;re interested in is already available. Whatever the Haskell package is named, if there&#8217;s a corresponding Debian package, it will ave a lowercase name. So here&#8217;s how use the regular package management tools to see if, for example, the indispensable <a target="_blank" href="http://software.complete.org/missingh/">MissingH</a> is available:
<blockquote>$ apt-cache search missingh
libghc6-missingh-dev &#8211; Library of utility functions for Haskell, GHC6 package
libhugs-missingh &#8211; Library of utility functions for Haskell, Hugs package
missingh-doc &#8211; Documentation for Haskell utility library</blockquote>
Nice! Whether you prefer to do your Haskell hacking with hugs or ghc, you&#8217;re set. The &#8220;libghc6-&#8221; prefix indicates that the package is for use with ghc, while the&#8221;libhugs-&#8221; prefix denotes a hugs-specific version of the same package.

Fedora users aren&#8217;t nearly so well-off. While hugs and ghc themselves are up to date and available in Fedora Extras, there are few third-party Haskell packages available. There exists a <a target="_blank" href="http://www.haskell.org/fedora/">Fedora Haskell</a> project, but it&#8217;s moribund; there are no packages available for FC6, for example.

To level the playing field, I&#8217;ll discuss how to build and install a third-party project that I&#8217;m fairly sure hasn&#8217;t yet been turned into a Debian or other package.

The first thing you should know is that Haskell has a <em>de facto</em> standard way of managing software packages, called <a target="_blank" href="http://www.haskell.org/cabal/">Cabal</a>. Cabal&#8217;s concept of a package is similar to, but independent of, the packages that your operating system&#8217;s package manager handles. A Cabal package has a name, a version number, and dependencies, but Cabal doesn&#8217;t know anything about the operating system&#8217;s packages; it has its own independent database of packages.

If you use ghc, you can find out what packages Cabal thinks are installed using the &#8220;ghc-pkg list&#8221; command.
<blockquote>$ ghc-pkg -l
/usr/lib64/ghc-6.6/package.conf:
Cabal-1.1.6, GLUT-2.0, HGL-3.1, HTTP-2006.7.7, HUnit-1.1,
OpenAL-1.3, OpenGL-2.1, QuickCheck-1.0, X11-1.1, base-2.0,
cgi-2006.9.6, fgl-5.2, (ghc-6.6), haskell-src-1.0, haskell98-1.0,
html-1.0, mtl-1.0, network-2.0, parsec-2.0, readline-1.0,
regex-base-0.71, regex-compat-0.71, regex-posix-0.71, rts-1.0,
stm-2.0, template-haskell-2.0, time-1.0, unix-1.0, xhtml-2006.9.13</blockquote>
I&#8217;m not going to discuss any of Cabal&#8217;s more interesting features here; I just want to illustrate the basics, because I couldn&#8217;t even find those a few days ago.

The third-party package I&#8217;m going to work with is a new one, Martin Grabmueller&#8217;s <a target="_blank" href="http://uebb.cs.tu-berlin.de/~magr/projects/rdtsc/README">rdtsc</a>. It&#8217;s easiest to download using Darcs.
<blockquote>$ darcs get http://uebb.cs.tu-berlin.de/~magr/darcs/rdtsc/
$ cd rdtsc</blockquote>
A lovely feature of Cabal is that it acknowledges that people don&#8217;t necessarily want to install packages as root; you can install a package into a directory that&#8217;s specific to you, and Cabal will maintain a package database of your personal packages, as well as those installed system-wide.

If you want to install a &#8220;you-only&#8221; package, it&#8217;s simple.
<blockquote>$ runghc Setup.hs configure &#8211;user &#8211;prefix=$HOME
Configuring rdtsc-1.1.2&#8230;
configure: /usr/bin/ghc-pkg
configure: Dependency base-any: using base-2.0
configure: Using install prefix: /usr/local

<em>&#8230;blah blah&#8230;</em></blockquote>
This will print a <em>lot</em> of output, some of which is downright confusing and scary-looking:
<blockquote>configure: No happy found
configure: No alex found</blockquote>
As far as I can tell, Cabal is merely complaining that some software that it would <em>like</em> to use, but that isn&#8217;t necessary, is missing. Unless configure explicitly says there&#8217;s an error, and exits with an error code, the build should run fine.

Configuring for a system-wide install is just as easy; merely omit the &#8220;&#8211;user&#8221; and &#8220;&#8211;prefix&#8221; options.
<blockquote>$ runghc Setup.hs configure</blockquote>
(Just remember that you&#8217;ll need to run the final install step as root if you&#8217;re doing a system-wide install.)

The next step is to build the package.
<blockquote>$ runghc Setup.hs build
Preprocessing library rdtsc-1.1.2&#8230;
Building rdtsc-1.1.2&#8230;
[1 of 1] Compiling System.CPUTime.Rdtsc ( System/CPUTime/Rdtsc.hs, dist/build/System/CPUTime/Rdtsc.o )
/usr/bin/ar: creating dist/build/libHSrdtsc-1.1.2.a</blockquote>
And finally, the installation step. Cabal remembers whether you specified &#8220;&#8211;user&#8221; and the prefix you used when you configured the package, so you don&#8217;t need to tell it a second time.
<blockquote>$ runghc Setup.hs install</blockquote>
After the install, ghc-pkg should be able to find the package:
<blockquote>$ ghc-pkg list
/usr/lib64/ghc-6.6/package.conf:
Cabal-1.1.6, GLUT-2.0, HGL-3.1, HTTP-2006.7.7, HUnit-1.1,
OpenAL-1.3, OpenGL-2.1, QuickCheck-1.0, X11-1.1, base-2.0,
cgi-2006.9.6, fgl-5.2, (ghc-6.6), haskell-src-1.0, haskell98-1.0,
html-1.0, mtl-1.0, network-2.0, parsec-2.0, readline-1.0,
regex-base-0.71, regex-compat-0.71, regex-posix-0.71, rts-1.0,
stm-2.0, template-haskell-2.0, time-1.0, unix-1.0, xhtml-2006.9.13
/home/bos/.ghc/x86_64-linux-6.6/package.conf:
rdtsc-1.1.2</blockquote>
The last two lines of output are what we were looking for. We have the package installed! It should now be available to both ghc and the interactive interpreter:
<blockquote>$ ghci
Prelude> :module +System.CPUTime.Rdtsc
Prelude System.CPUTime.Rdtsc> rdtsc
Loading package rdtsc-1.1.2 &#8230; linking &#8230; done.
3552638252</blockquote>
This stuff <a target="_blank" href="http://www.haskell.org/ghc/docs/latest/html/Cabal/builders.html">is actually documented</a>, and quite thoroughly so, but I found it amazingly hard to find. If you don&#8217;t already know that (a) there&#8217;s a standard Haskell packaging mechanism and (b) exactly what commands you must run to work with it, it&#8217;s surprisingly hard to construct a Google query that will return a result that gives you any practical clue of what to do.

Finally, thanks to the wonderful denizens of #haskell for guiding me through the maze over the past few days.]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/01/05/getting-started-with-installing-third-party-haskell-packages/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dealing with yum hangs on FC6</title>
		<link>http://www.serpentine.com/blog/2007/01/04/dealing-with-yum-hangs-on-fc6/</link>
		<comments>http://www.serpentine.com/blog/2007/01/04/dealing-with-yum-hangs-on-fc6/#comments</comments>
		<pubDate>Fri, 05 Jan 2007 01:03:55 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2007/01/04/dealing-with-yum-hangs-on-fc6/</guid>
		<description><![CDATA[One of the exciting things about upgrading to Fedora Core 6 is that the yum package manager now frequently hangs on me. This does not fill me with joy. The most common way in which it falls over is by hanging hard after printing this message: Parsing package install arguments What it means to &#8220;hang [...]]]></description>
			<content:encoded><![CDATA[One of the exciting things about upgrading to Fedora Core 6 is that the yum package manager now frequently hangs on me. This does not fill me with joy.

The most common way in which it falls over is by hanging hard after printing this message:
<blockquote>Parsing package install arguments</blockquote>
What it means to &#8220;hang hard&#8221; here is that you can&#8217;t interrupt it using control-C, or by killing it with a normal, neighbourly signal like SIGINT or SIGTERM. A little bit of digging in another terminal window indicates why:
<blockquote># pidof yum
30987</blockquote>
This number is yum&#8217;s process ID. Let&#8217;s see what it&#8217;s stuck doing:
<blockquote># strace -p 30987
Process 30987 attached &#8211; interrupt to quit
futex(0xb7bf21a0, FUTEX_WAIT, 2, NULL <<em>unfinished &#8230;</em>></blockquote>
Ooh, look; it&#8217;s stuck in a futex system call. This usually means that the culprit is trying to lock a data structure in a memory-mapped file shared with another process. If the other process isn&#8217;t around, well, things can get exciting.

By the way, it <em>is</em> possible to kill yum at this point; you just have to be brutal.
<blockquote># killall -9 yum</blockquote>
Once the deed is done, a little sniffing around often reveals a few &#8220;__db.*&#8221; files in /var/lib/rpm. Let&#8217;s get rid of these:
<blockquote># rm -f /var/lib/rpm/__db.*</blockquote>
At this point, retrying the hung yum command should succeed. At least, it does so for me in nine out of ten cases. Occasionally, I need to run &#8220;yum clean all&#8221; after cleaning up the above mess before yum can make progress.]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2007/01/04/dealing-with-yum-hangs-on-fc6/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>How to build safe, clean Python 2.5 RPMs for Fedora Core 6</title>
		<link>http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/</link>
		<comments>http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/#comments</comments>
		<pubDate>Sat, 23 Dec 2006 00:18:54 +0000</pubDate>
		<dc:creator>Bryan O'Sullivan</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/</guid>
		<description><![CDATA[Since FC6 ships with Python 2.4, you&#8217;re a bit stuck if you want to play with the new features of Python 2.5. Here&#8217;s a quick and easy way to build and install a cleanly-packaged version of Python 2.5 for FC6. First, you must ensure that you have a sufficient development environment available. Fortunately, you can [...]]]></description>
			<content:encoded><![CDATA[Since FC6 ships with Python 2.4, you&#8217;re a bit stuck if you want to play with the new features of Python 2.5. Here&#8217;s a quick and easy way to build and install a cleanly-packaged version of Python 2.5 for FC6.

First, you must ensure that you have a sufficient development environment available. Fortunately, you can do this in one step. Note: this is the <em>only</em> command you&#8217;ll need to run with root privileges until the time comes for you to install the Python RPM that you&#8217;ve built.
<blockquote>
<pre><code>$ sudo yum install autoconf bzip2-devel db4-devel \</code></pre>
<pre><code>  expat-devel findutils gcc-c++ gdbm-devel glibc-devel gmp-devel \</code></pre>
<pre><code>  libGL-devel libX11-devel libtermcap-devel ncurses-devel \</code></pre>
<pre><code>  openssl-devel pkgconfig readline-devel sqlite-devel tar \</code></pre>
<pre><code>  tix-devel tk-devel zlib-devel </code></pre>
</blockquote>
(That&#8217;s one long line of input.) This will trundle along for a few minutes, after which you&#8217;ll have all of the bits you need installed. Except for Python itself, that is. Simply grab this, in source RPM form, from your nearest friendly Rawhide repository.
<blockquote>
<pre><code>lftp ftp://mirrors.kernel.org/fedora/core/development/source/SRPMS</code></pre>
<pre><code>mget python-2*.src.rpm </code></pre>
</blockquote>
Next, install the Python source RPM into a temporary build directory of your choice. In this example, I&#8217;ll use &#8220;/tmp/mypy&#8221;.
<blockquote>
<pre><code>mkdir -p /tmp/mypy/{BUILD,RPMS,SOURCES,SPECS}</code></pre>
<pre><code>rpm --define '_topdir /tmp' -ivh python-2*.src.rpm </code></pre>
</blockquote>
Now you&#8217;ll need to go into the SOURCES directory and frob a single file:
<blockquote>
<pre><code>cd /tmp/mypy/SOURCES</code></pre>
<pre><code>sed -ie 's/DBLIBVER=4.5/DBLIBVER=4.3/' python-2.5-config.patch </code></pre>
</blockquote>
This tells the bsddb module to link against Berkeley DB 4.3 (the default on FC6), rather than 4.5 (which will presumably ship with Fedora 7).

The next step is to build the Python RPM.
<blockquote>
<pre><code>cd /tmp/mypy/SPECS</code></pre>
<pre><code>rpmbuild --define '_topdir /tmp/mypy' --define '__python_ver 25' -bb python.spec</code></pre>
</blockquote>
This takes just a few minutes on my laptop, so it shouldn&#8217;t take long for you, either. Once you&#8217;re done, the binary RPMs will be present somewhere under /tmp/mypy/RPMS. On a 32-bit x86 machine, they&#8217;ll be in the i386 subdirectory, and on an x86_64 machine, they&#8217;ll be in the x86_64 subdirectory. You&#8217;ll have to become root to install them:
<blockquote>
<pre><code>sudo rpm -ivh /tmp/mypy/RPMS/*/*.rpm </code></pre>
</blockquote>
A nice aspect of this way of building is that the packages it builds <em>should not conflict with</em> the system&#8217;s default Python, so you ought not to have any peculiar explosions in one of the many system packages that expect a specific Python version. Your new &#8220;python&#8221; package will be named &#8220;python25&#8243;, for example, and the interpreter will be named &#8220;python25&#8243;, too.]]></content:encoded>
			<wfw:commentRss>http://www.serpentine.com/blog/2006/12/22/how-to-build-safe-clean-python-25-rpms-for-fedora-core-6/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
	</channel>
</rss>

