On the work done by friction The work done by friction is often calculated just as we would with any force. If we give a block of mass $m$ a velocity $v$ on a rough surface and it comes to rest after traversing a distance $x$, the work done by friction is $-\mu mg$ where $\mu$ is the coefficient of friction between the block and the surface. 
Doing so seems reasonable at first sight because it agrees with the expected result we get from applying only Newton's laws.
However, looking at the mechanism of friction on the microscopic level, friction arises from cold welding between the block and the surface particles, which slows down the block. But the work done by the forces that arise due these cold welds cannot be equal to $-\mu m g$, since the point of application of the force isn't shifting at all. In fact, they should do no work (there is probably a flaw in this argument since they apparently do some work because the block slows down). 
Looking again at the situation I mentioned above, the ground applies a force $\mu m g$ on the block, and the block applies and equal and opposite force on the ground. If we go by the same reasoning we used to write the work done by friction in the beginning, since the point of application of the force of friction shifts by a distance $x$ on the ground, the block does work $+\mu m g x$ on the ground, which is completely nonsensical. 
Where am I going wrong? 
 A: No body is perfectly rigid.  If you want to consider friction as due to small bonding sites, then those sites do move (strain) under load (stress).   So the premise that no work is done because the binding locations are fixed is incorrect.
A: For motion of the center of mass, friction is treated as any other force; work is the force times distance (actually integral of a dot product.)  I am excluding pure rolling friction which does no work. This is true regardless of the motion of the system of particles about the center of mass.  In the real world friction also causes heating effects.  To evaluate the heating, you need to apply the first law of thermodynamics; work in the first law is not the same as the work acting on the center of mass.  In the literature, sometimes the work on the center of mass if called pseudowork and work is reserved for the first law concept; you can find discussions about this on the web.
For a rigid body, there can be no change in the internal energy of the body; that is, no "heating".  For motion of a rigid body, friction only changes the kinetic energy (translational and rotational) of the body.  Most physics mechanics texts address the motion of rigid bodies.
If the actual change in internal energy is relatively small for a non-rigid body, you can estimate the "heating" loss term with an energy loss term in the mechanical energy equation.  In fluid dynamics this is the friction loss term in the Bernoulli equation.  For significant changes in the internal energy, you need apply the first law (energy) and conservation of mass and momentum equations; this is not simple.
