<?xml version="1.0" encoding="utf-8"?>

<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
<title type="text">Journal of Martin Michlmayr</title>
<subtitle type="html"><![CDATA[
Martin Michlmayr's journal
]]></subtitle>
<id>http://www.cyrius.com/journal/index.atom</id>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal" />
<link rel="self" type="text/xml" href="http://www.cyrius.com/journal/index.atom" />

<author>
<name>Martin Michlmayr</name>
<uri>http://www.cyrius.com/journal/index.atom</uri>
<email>tbm@cyrius.com</email>
</author>
<rights>Copyright 2003-2006 Martin Michlmayr</rights>
<generator uri="http://pyblosxom.sourceforge.net/" version="1.3.2 2/13/2006">
PyBlosxom http://pyblosxom.sourceforge.net/ 1.3.2 2/13/2006
</generator>

<updated>2008-08-25T16:31:17Z</updated>
<!-- icon?  logo?  -->

<entry>
<title type="html">initramfs-tools MODULES=dep default on ARM</title>
<category term="/debian" />
<id>http://www.cyrius.com/journal/2008/08/25/#arm-modules-dep</id>
<updated>2008-08-25T16:31:17Z</updated>
<published>2008-08-25T16:31:17Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/arm-modules-dep" />
<content type="html">
<p>

Frans Pop reported recently that the initramfs did not fit in the
flash of the QNAP TS-109 when you used LVM.  We had problems with
initramfs images that were too large <a href =
"http://bugs.debian.org/480310">before (on the NSLU2)</a>.  By
default, initramfs-tools uses the MODULES=most setting which puts all
modules that might be of interest to booting a machine in the
initramfs.  This is a good idea on a PC where the hardware can change
a lot, but it makes less sense on most NAS devices.

</p>

<p>

Frans has now changed debian-installer so the MODULES policy can be
chosen during the installation.  His change allowed architecture
specific defaults, so I've changed ARM to use MODULES=dep.
debian-installer will now create the file
<tt>/etc/initramfs-tools/conf.d/driver-policy</tt> with a MODULES
setting that will override that from
<tt>/etc/initramfs-tools/initramfs.conf</tt>.  On QNAP devices, I
intend to only support MODULES=dep installations, so please change
your configuration if you've installed Debian already.  On the NSLU2,
MODULES=most will of course continue to be supported.

</p>

<!-- time: 2008-08-25 16:31:17 +0300 -->

</content>
</entry>

<entry>
<title type="html">TODO list for Debian on D-Link DNS-323</title>
<category term="/debian/orion/d-link/dns-323" />
<id>http://www.cyrius.com/journal/2008/08/17/#porting-debian</id>
<updated>2008-08-17T16:57:34Z</updated>
<published>2008-08-17T16:57:34Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/orion/d-link/dns-323/porting-debian" />
<content type="html">
<p>

Someone asked me the other day what it would take to add Debian support for
the D-Link DNS-323.  Since we support a number of Orion based devices in
debian-installer already, adding support for another device is typically
fairly easy.  I don't have a D-Link DNS-323 myself, but I looked around the
useful <a href = "http://wiki.dns323.info">DNS-323 wiki</a> and this is
what I came up.  I'm sharing this list in the hope that other people are
interested in working on DNS-323 support.

</p>

<ul>

<li>The Orion kernel in Debian has support for the D-Link DNS-323 but it
needs testing.  Also, some patches, such as support for the fan speed chip,
are not included in the mainline kernel yet.</li>

<li>flash-kernel (which writes the kernel and ramdisk to flash) needs
support for the DNS-323.  I actually implemented this in the meantime but
it's completely untested.</li>

<li>oldsys-preseed reads the network configuration from your existing
firmware and uses it to configure the network for debian-installer.  This
also needs support for the DNS-323.</li>

<li>Some tools to <a href = "http://hg.leschinsky.in.ua/makeFirmware/">
generate proper firmware images</a> need to be packaged for Debian.</li>

<li>The debian-installer needs to generate a boot image for the DNS-323
(easy once the tools are packaged).</li>

<li>Apparently the MAC address is not set automatically in u-boot and you
have to run a tool called mac_read to set it.  This is problematic because
at the moment there's no code to set the MAC address in d-i and to make
sure the newly installed system will automatically set the MAC address.
This needs some work.</li>

</ul>

<!-- time: 2008-08-17 16:57:34 +0300 -->

</content>
</entry>

<entry>
<title type="html">2.6.26 ARM and MIPS udebs on the way...</title>
<category term="/debian" />
<id>http://www.cyrius.com/journal/2008/08/10/#2.6.26-udebs</id>
<updated>2008-08-10T14:27:33Z</updated>
<published>2008-08-10T14:27:33Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/2.6.26-udebs" />
<content type="html">
<p>

Otavio has updated kernel-wedge in SVN to 2.6.26, so I updated ARM and MIPS
today.  The udebs built after minor modifications and I can also build
installer images after having fixed some bugs in the build process.  I
tested a 2.6.26 based image on the QNAP TS-409 (armel) as well as in QEMU
(mipsel).

</p>

<p>

2.6.26 will bring major improvements on ARM.  Orion support is much better
and our 2.6.26 has a number of patches from Marvell that help with
performance on Orion.  Our 2.6.26 also has Riku Voipio's LED driver for
Thecus N2100 which has been accepted for the 2.6.27 mainline kernel.

</p>

<p>

I haven't actually uploaded the udebs yet because I'm waiting for the
go-ahead as well as for the new version of the 2.6.26 kernel package to
build.  But at least we're getting closer to having 2.6.26 as the kernel
for lenny.

</p>

<!-- time: 2008-08-10 14:27:33 +0300 -->

</content>
</entry>

<entry>
<title type="html">Debian on HP mv2120 web site</title>
<category term="/debian/orion/hp/mv2120" />
<id>http://www.cyrius.com/journal/2008/07/30/#web-site</id>
<updated>2008-07-30T22:09Z</updated>
<published>2008-07-30T22:09Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/orion/hp/mv2120/web-site" />
<content type="html">
<p>

I've created a web site with information for running <a href =
"http://www.cyrius.com/debian/orion/hp/mv2120/">Debian on the HP
mv2120</a>.  The HP mv2120 is a NAS device based on Marvell's Orion
platform and has a 500 MHz ARM CPU, 128 MB RAM and two SATA slots.

</p>

<p>

All components needed to support Debian on the HP mv2120 have been
integrated into Debian and Debian installer.  However, a new release of the
Debian installer is required so installations of Debian testing are
actually possible.

</p>


<!-- time: 2008-07-30 22:09:00 +0300 -->

</content>
</entry>

<entry>
<title type="html">Daily installer image available for QNAP TS-109, TS-209 and TS-409</title>
<category term="/debian/orion/qnap" />
<id>http://www.cyrius.com/journal/2008/07/21/#daily-image</id>
<updated>2008-07-21T20:18:12Z</updated>
<published>2008-07-21T20:18:12Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/orion/qnap/daily-image" />
<content type="html">
<p>

Daily installer images are now available for the QNAP TS-109, TS-209 and
TS-409.  This means that complete installations of Debian testing are
possible now.

</p>

<p>

You can consider the daily image as a beta release of RC1 of the
debian-installer for Debian lenny.  It should only be used by experienced
users and only if you can make a serial console in case something goes
wrong.  As the name suggests, the daily images change on a daily basis and
they install Debian testing which also changes on a daily basis (although
testing should be fairly stable since we're close to the freeze of testing
in preparation for the release of Debian lenny).

</p>

<p>

If you install Debian with these installer images, please send an
installation report to debian-boot send an email to me so I can let you
know in case there are any important news you should be aware of.

</p>

<p>

There is a web site now with complete installation instructions and other
information about <a href =
"http://www.cyrius.com/debian/orion/qnap/">Debian on QNAP Turbo
Station</a>.  If you have any questions or suggestions, please let me know.

</p>

<!-- time: 2008-07-21 20:18:12 +0300 -->

</content>
</entry>

<entry>
<title type="html">New behaviour for oldsys-preseed regarding default settings</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2008/06/28/#oldsys-preseed-behaviour</id>
<updated>2008-06-28T13:25:22Z</updated>
<published>2008-06-28T13:25:22Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/oldsys-preseed-behaviour" />
<content type="html">
<p>

I've just changed the behaviour of oldsys-preseed in the case when a
static IP address is set in the configuration of the device that is
the default setting from the vendor.  In the past, oldsys-preseed
would try to be smart in this case and do DHCP in the assumption that
the users never configured the static IP address themselves and might
not want to have that setting.  However, Mike (mwester) <a href =
"http://lists.debian.org/debian-arm/2008/01/msg00050.html">convinced
me</a> that doing DHCP when the configuration clearly says to use a
static IP is a bad idea.  Apparently quite a few users got confused by
the old behaviour of oldsys-preseed.  The new behaviour exists as of
version 2.0 of oldsys-preseed which will be in rc1 of debian-installer
for lenny.  This change affects the Linksys NSLU2 and Thecus N2100.

</p>

<!-- time: 2008-06-28 13:25:22 +0200 -->

</content>
</entry>

<entry>
<title type="html">Debian support for HP mv2120: putting everything together</title>
<category term="/debian/orion/hp/mv2120" />
<id>http://www.cyrius.com/journal/2008/06/28/#putting-it-together</id>
<updated>2008-06-28T09:31:02Z</updated>
<published>2008-06-28T09:31:02Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/orion/hp/mv2120/putting-it-together" />
<content type="html">
<p>

I managed to get my hands on a HP Media Vault mv2120, a nice ARM based NAS
device, a few months ago with the intentions of porting Debian to it.
Unfortunately, I have been really busy lately and most of my time was spent
on adding support for the QNAP TS-109/TS-209 and TS-409 (which required a
lot of generic work to get Marvell Orion support into Debian, a new SoC
used in many NAS devices, including the QNAP TS-x09 and HP mv2120).

</p>

<p>

There were a number of things that had to be worked out before Debian would
run on the mv2120.  The good news is that Marc Singer and Eugene San have
done all of the heavy lifting in the last few weeks in figuring out how the
mv2120 works and that now it's just a matter of putting everything together
for Debian to work.

</p>

<p>

Here are the issues that had to be worked out:

</p>

<ul>

<li>Figure out how the rescue mode works and how to construct a rescue
image that the device can boot: I knew that the mv2120 had a rescue mode
that can be activated by keeping the the power and reset buttons pressed
when starting that would request a rescue image via the network.  This
rescue mode can be used to start the Debian installer.  Eugene San figured
out how to construct a rescue image that the mv2120 would accept.  Marc
Singer has also written a tool, uphpmvault, to serve such rescue images
from Linux.</li>

<li>Figure out the best way to make one image that contains the kernel and
ramdisk: the mv2120 only loads a kernel and no ramdisk, but a ramdisk is
needed to start Debian.  I discussed some really ugly hacks with Marc
Singer to get the mv2120 to accept an image consisting of kernel and
ramdisk but Marc wanted to try something else first.  u-boot, the boot
loader used on the mv2120, can accept something called a multipart image
which can consist of a kernel and a ramdisk.  When Eugene San heard that we
were trying to load a multipart image, he went ahead and figured out how to
construct an image that the mv2120 would boot.</li>

</ul>

<p>

Now that these two issues are resolved, I simply need to put everything
together and add support for the mv2120 to a number of debian-installer
components.  We already have Orion kernel images in unstable that support
the HP mv2120 (along with a number of other Orion based NAS devices) and
the rest shouldn't take too long.

</p>

<!-- time: 2008-06-28 09:31:02 +0200 -->

</content>
</entry>

<entry>
<title type="html">NSLU2 Debian installer for lenny beta 2</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2008/06/09/#lenny-beta2</id>
<updated>2008-06-09T23:36:03Z</updated>
<published>2008-06-09T23:36:03Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/lenny-beta2" />
<content type="html">
<p>

The Debian installer team has published the second beta release of the
installer for lenny (what will become Debian 5.0).  I repacked the
image for the Linksys NSLU2 with the proprietary IXP4xx microcode so
Ethernet will work.

</p>

<p>

The installer is now available in two flavours for the ARM architecture:
<tt>arm</tt> is the old ARM port whereas <tt>armel</tt> is the new ARM port
using the <a href = "http://wiki.debian.org/ArmEabiPort">EABI</a> which
offers better support for floating point and other features.  Both the arm
and armel architectures will be supported for lenny but the old arm port
will be dropped after the release of lenny.  At this point, I therefore
recommend that people use armel for new installations.

</p>

<p>

The beta 2 installer image for NSLU2 can be found on my site: <a href =
"http://www.cyrius.com/debian/nslu2/files/tmp/debian-armel-5.0beta2.zip">armel
image</a> (recommended) and <a href =
"http://www.cyrius.com/debian/nslu2/files/tmp/debian-arm-5.0beta2.zip">arm
image</a>.

</p>

<!-- time: 2008-06-09 23:36:03 +0200 -->

</content>
</entry>

<entry>
<title type="html">The NSLU2 causing trouble recently...</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2008/05/12/#recent-trouble</id>
<updated>2008-05-12T21:18:01Z</updated>
<published>2008-05-12T21:18:01Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/recent-trouble" />
<content type="html">
<p>

We've had two serious bugs on the NSLU2 recently that both caused the
system not too boot anymore.  The <a href =
"http://bugs.debian.org/478236">first one</a> was related to
initramfs-tools.  Kevin Price reported that after upgrading to
initramfs-tools 0.92 the system would hang during boot waiting for the root
filesystem.  When I booted my NSLU2 and looked at the output, I noticed
that no root device was set.  When I mentioned this to maks, the maintainer
of the initramfs-tools package, he immediately knew what was wrong and
uploaded a fix.  On the NSLU2, the boot loader doesn't pass a root device
to the kernel so we set one in the initramfs itself.  The code that loads
this config variable is not used by many devices so nobody noticed that
this got broken in 0.92 until the package moved to testing.

</p>

<p>

The <a href = "http://bugs.debian.org/480310">second problem</a>, reported
on Saturday by Paul Collins and diagnosed today with some help from Kevin
Price is also related to the strange way the NSLU2 boots.  The NSLU2 has 6
MB available for the ramdisk but due to a <a href =
"http://bugs.debian.org/451882">bug in APEX</a> (the second stage loader
used on the NSLU2 by Debian) only 4 MB are actually used.  When you write a
ramdisk that is larger than 4 MB but smaller than 6 MB, flash-kernel will
happily write the full image, but APEX will only tell the kernel about the
first 4 MB.  As it turns out, everything works fine on arm with 2.6.25, but
on armel some additional SCSI modules are enabled that result in the
ramdisk becoming too large.  The short term solution is to disable these
modules, but really APEX should finally be fixed (patches have been
available for quite a while thanks to Gordon Farquharson).  Fortunately
2.6.25 hasn't moved to testing yet and this problem only occurs on armel,
so few people were impacted.

</p>

<p>

The nice thing about the NSLU2 is that you can write a new flash image via
the network, so you can flash a good image in case your machine no longer
boots.  Nevertheless, we have to make sure such serious bugs don't occur in
the future or that they are at least caught very early.  Special thanks go
to testers like Kevin Price.

</p>

<!-- time: 2008-05-12 21:18:01 +0200 -->

</content>
</entry>

<entry>
<title type="html">QNAP TS-109/TS-209 and TS-409 experimental developer release</title>
<category term="/debian/orion/qnap" />
<id>http://www.cyrius.com/journal/2008/05/12/#exp-dev-release</id>
<updated>2008-05-12T20:32:40Z</updated>
<published>2008-05-12T20:32:40Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/orion/qnap/exp-dev-release" />
<content type="html">
<p>

Yesterday I completed the first successful installation of Debian on a
QNAP TS-209 using a custom debian-installer image with 2.6.25 from
unstable.  I made the installer image for QNAP TS-109 and TS-209
available as an <a href =
"http://lists.debian.org/debian-arm/2008/05/msg00035.html">experimental
developer release</a> and today I also uploaded images for the TS-409.
More on my plans to support the QNAP TS-109/TS-209 and TS-409 in the
upcoming release of Debian (starting with beta3 of debian-installer)
soon.

</p>

<!-- time: 2008-05-12 20:32:40 +0200 -->

</content>
</entry>

<entry>
<title type="html">GCC 4.3 porting guide</title>
<category term="/gcc" />
<id>http://www.cyrius.com/journal/2008/01/23/#gcc-4.3-porting-guide</id>
<updated>2008-01-23T20:48:40Z</updated>
<published>2008-01-23T20:48:40Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/gcc/gcc-4.3-porting-guide" />
<content type="html">
<p>

Benjamin Kosnik of Red Hat put together a guide on the GCC web site with
information on porting applications to the upcoming GCC 4.3 release.  He
integrated some information from my blog and added a number of new items.
If you run into any issues while moving to GCC 4.3, I suggest you <a href =
"http://gcc.gnu.org/gcc-4.3/porting_to.html">consult this guide</a>.

</p>

<!-- time: 2008-01-23 20:48:40 +0100 -->


</content>
</entry>

<entry>
<title type="html">Installer finally working again on Linksys NSLU2</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2007/12/27/#etchr2-update</id>
<updated>2007-12-27T20:33:55Z</updated>
<published>2007-12-27T20:33:55Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/etchr2-update" />
<content type="html">
<p>

The release release team of Debian released 4.0r2 today which fixes the bug
that kept the installer from working on ARM based systems, such as the
Linksys NSLU2.  This means that installations are finally possible again.
I've updated my <a href =
"http://www.cyrius.com/debian/nslu2/install.html">installation instructions
accordingly</a>.

</p>

<p>

I've also updated the tar ball used for the manual installation to 4.0r2
but I doubt many people are interested in this method now that the
installer is working again.

</p>

<!-- time: 2007-12-27 20:33:55 +0100 -->

</content>
</entry>

<entry>
<title type="html">Joining HP</title>
<category term="/hp" />
<id>http://www.cyrius.com/journal/2007/12/24/#joining-hp</id>
<updated>2007-12-24T15:55:59Z</updated>
<published>2007-12-24T15:55:59Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/hp/joining-hp" />
<content type="html">
<p>

I joined HP's Open Source and Linux Organization (OSLO) at the beginning
of the month as an Open Source Community Expert.  I spent the last three
weeks in Ft.&nbsp;Collins for some training and to get to know the team,
but normally I'll be working from home in Europe.  The main focus of my
work will be governance issues related to the deployment of FOSS in
enterprise environments.  However, I've already started to get involved
in a number of other areas I'm interested in, such as community relations.
I'm pretty excited about my new position because it is a good fit for my
skills and interests.

</p>

<!-- time: 2007-12-24 15:55:59 +0100 -->

</content>
</entry>

<entry>
<title type="html">GCC 4.3 related build problems: duplicate function parameters</title>
<category term="/gcc" />
<id>http://www.cyrius.com/journal/2007/12/07/#gcc-4.3-multiple-params</id>
<updated>2007-12-07T21:04:40Z</updated>
<published>2007-12-07T21:04:40Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/gcc/gcc-4.3-multiple-params" />
<content type="html">
<p>

GCC 4.3 now prints an error message when C++ code contains duplicate
function parameter names in function prototypes.  You'd think that's a
pretty obvious problem, but we still have about 15 packages in the archive
that contain such code.

</p>

<p>

Anyway, for code like this:

</p>

<pre>
class foo {
    foo(int w, int w);
};
</pre>

<p>

GCC will as of 4.3 show the following error message:

</p>

<pre>
t.cc:2: error: multiple parameters named 'w'
</pre>

<!-- time: 2007-12-07 21:04:40 -0700 -->

</content>
</entry>

<entry>
<title type="html">N2100 network troubles due to r8169 bug</title>
<category term="/debian/iop/n2100" />
<id>http://www.cyrius.com/journal/2007/11/30/#r8169-alignment-fix</id>
<updated>2007-11-30T22:12:59Z</updated>
<published>2007-11-30T22:12:59Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/iop/n2100/r8169-alignment-fix" />
<content type="html">
<p>

Daniel Smolik <a href = "http://bugs.debian.org/452069">reported problems
with NFS on a Thecus N2100</a> a few days ago.  I confirmed the bug with
2.6.18 and 2.6.22 but found that the problem didn't occur with 2.6.23.  I
started a git bisect and a few hours later located a fix that Francois
Romieu, the maintainer of the r8169 driver, had put in.  Apparently the
driver had some confusion regarding hardware and IP header alignment.  The
good news is that the patch is very small and can easily be backported to
our 2.6.18 kernel in stable.  Also, packages of 2.6.23 were uploaded today
and should be in the archive soon.

</p>

<!-- time: 2007-11-30 22:12:59 +0100 -->

</content>
</entry>

<entry>
<title type="html">Tips on reducing memory and running Linux on a flash device</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2007/11/11/#tips-ram-flash</id>
<updated>2007-11-11T20:54:04Z</updated>
<published>2007-11-11T20:54:04Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/tips-ram-flash" />
<content type="html">
<p>

David Härdeman has contributed two really valuable guides to my <a href =
"http://www.cyrius.com/debian/nslu2/index.html">Debian on NSLU2 site</a>
that will be of great interest to many NSLU2 users:

</p>

<ul>

<li>The first guide is for people running Linux on a flash device, such as
a USB flash stick.  Since flash only supports a limited number of writes,
it is important to reduce the wear and tear on the underlying flash device.
David's guide gives <a href =
"http://www.cyrius.com/debian/nslu2/linux-on-flash.html">some practical
advice</a> of how to achieve this.</li>

<li>The second guide gives a few tips and tricks that can be used to <a
href = "http://www.cyrius.com/debian/nslu2/reducing-memory.html">reduce the
amount of RAM</a> a system uses.  This is particularly interesting to NSLU2
users since 32&nbsp;MB of RAM is not a lot.</li>

</ul>

<p>

These guides mention Debian but most of the advice applies to other NSLU2
firmware flavours and to Linux in general.

</p>

<!-- time: 2007-11-11 20:54:04 +0100 -->

</content>
</entry>

<entry>
<title type="html">NSLU2 tar ball for Debian 4.0r1</title>
<category term="/debian/nslu2" />
<id>http://www.cyrius.com/journal/2007/09/28/#etchr1-update</id>
<updated>2007-09-28T13:47:14Z</updated>
<published>2007-09-28T13:47:14Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/debian/nslu2/etchr1-update" />
<content type="html">
<p>

I updated the tar ball for the <a href =
"http://www.cyrius.com/debian/nslu2/unpack.html">manual Debian/NSLU2
installation</a> to Debian 4.0r1 (including the new 2.6.18-5 kernel)
today.  The proprietary NPE microcode from Intel is now included in
the tar ball since the code no longer has a click-through license.

</p>


<!-- time: 2007-09-28 13:47:14 +0200 -->

</content>
</entry>

<entry>
<title type="html">Dr Michlmayr</title>
<category term="/uni" />
<id>http://www.cyrius.com/journal/2007/07/21/#phd</id>
<updated>2007-07-21T23:53:49Z</updated>
<published>2007-07-21T23:53:49Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/uni/phd" />
<content type="html">
<p>

<img src="http://www.cyrius.com/images/phd_graduation.jpg"
 alt="Martin at his PhD graduation" class = "right" width="225" height="300" />

Having passed all requirements for the Doctor of Philosophy, I had
my graduation today.

</p>

<!-- time: 2007-07-21 23:53:49 +0100 -->

</content>
</entry>

<entry>
<title type="html">GCC 4.3 related build problems: pedantic preprocessor warnings in C++</title>
<category term="/gcc" />
<id>http://www.cyrius.com/journal/2007/05/11/#gcc-4.3-pedwarn</id>
<updated>2007-05-11T14:37:55Z</updated>
<published>2007-05-11T14:37:55Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/gcc/gcc-4.3-pedwarn" />
<content type="html">
<p>

<b>Update:</b> This change has been reverted from 4.3 again and won't be in
the final release of 4.3.

</p>

<p>

GCC 4.3 <a href =
"http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24924">changed</a> pedantic
preprocessor warnings in C++ code into errors, in line with the
C++ front-end.  Because of this change, preprocessor warnings are now
errors.

</p>

<p>

This change has caused at least the twofollowing errors which are all
fairly common:

</p>

<h3>error: "xxx" redefined</h3>

<p>

It's not allowed to #define something twice, as in this example:

</p>

<pre>
#define TEST "foo"
#define TEST "bar"
</pre>

<p>

This code will lead to the following error:

</p>

<pre>
test2.cc:2:1: error: "TEST" redefined
test2.cc:1:1: error: this is the location of the previous definition
</pre>

<p>

Most typically, this occurs because something is defined in a header that
is included and then redefined in the current source file.  It can also
happen when a #define is put in the code but also on the command line, e.g.
via <tt>-DTEST="bar"</tt>.  This will lead to:

</p>

<pre>
test2.cc:1:1: error: "TEST" redefined
&lt;command line&gt;:1:1: error: this is the location of the previous definition
</pre>

<p>

The correct solution is to avoid redefinitions directly or to use #ifndef
to make sure that something has not been defined already.

</p>

<h3>extra tokens at end of #endif directive</h3>

<p>

While an <tt>#ifdef</tt> obviously needs a second parameter, it's not
allowed to give one to <tt>#else</tt> and <tt>#endif</tt>.  Unfortunately,
this is commonly done as a reminder for what is being tested for:

</p>

<pre>
#ifdef TEST
#endif TEST
</pre>

<p>

This code will lead to the following error:

</p>

<pre>
test3.cc:2:8: error: extra tokens at end of #endif directive
</pre>

<!-- time: 2007-05-11 14:37:55 +0200 -->

</content>
</entry>

<entry>
<title type="html">GCC 4.3 related build problems: missing #include</title>
<category term="/gcc" />
<id>http://www.cyrius.com/journal/2007/05/10/#gcc-4.3-include</id>
<updated>2007-05-10T15:56:10Z</updated>
<published>2007-05-10T15:56:10Z</published>
<link rel="alternate" type="text/html" href="http://www.cyrius.com/journal/gcc/gcc-4.3-include" />
<content type="html">
<p>

In GCC 4.3 the C++ header dependencies have been <a href =
"http://gcc.gnu.org/PR28080">cleaned up</a>.  In the past, compilation
would often be quite slow because including a simple header would
indirectly include a lot of other headers, even if they were not needed to
compile the current code.  Many headers have now been cleaned up with the
result that compilation is quicker.  The downside is that programmers
cannot rely on indirect inclusion of headers they may need anymore.
Instead, everything that is needed has to be directly referenced with an
#include.

</p>

<p>

Typical errors look like these:

</p>

<pre>
error: 'find' is not a member of 'std'
error: 'exit' was not declared in this scope
</pre>

<p>

Below is a table showing which header needs to be included for a number of
common functions:

</p>

<table>
<tr><td><b>Functions and defines</b></td><td><b>Header</b></td></tr>
<tr><td>find, for_each, sort</td><td>algorithm</td></tr>
<tr><td>isalnum, toupper</td><td>cctype</td></tr>
<tr><td>INT_MIN, RAND_MAX</td><td>climits</td></tr>
<tr><td>printf</td><td>cstdio</td></tr>
<tr><td>atoi, free, rand</td><td>cstdlib</td></tr>
<tr><td>EXIT_FAILURE</td><td>cstdlib</td></tr>
<tr><td>strcmp, memcpy</td><td>cstring</td></tr>
<tr><td>auto_ptr</td><td>memory</td></tr>
<tr><td>fd_set, mode_t</td><td>sys/types.h</td></tr>
<tr><td>typeid</td><td>typeinfo</td></tr>
</table>

<!-- time: 2007-05-10 15:56:10 +0200 -->

</content>
</entry>
</feed>
