This question already has an answer here:
I'm trying to do
apt-get install -f -o APT::Immediate-Configure=0 (just
apt-get install -f doesn't work currently for me...) which fails with
Unpacking libboost1.46-dev (from .../libboost1.46-dev_1.46.1-7ubuntu3_i386.deb) ... dpkg: error processing /var/cache/apt/archives/libboost1.46-dev_1.46.1-7ubuntu3_i386.deb (--unpack): trying to overwrite '/usr/include/boost/aligned_storage.hpp', which is also in package libboost1.40-dev 1.40.0-4ubuntu4 dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
and many similar errors.
How can I resolve this?