You just set up serial communications, including creating the receive buffer. The first thing you do after that function returns is flush the newly created buffer.
Where do you suppose data in that buffer came from in the 62.5 nanoseconds it has existed?
That Serial.flush(); code is left over from a previous program. Frankly, I did not even notice it. Thanks for alerting me to its sorry existence.
Major changes to the SPI/spi class took place in one of the recent versions of the IDE. You should upgrade your linux computer to the latest version, rather than trying to piece-meal fix the older version.
The program is running on a BeagleBoard, which has an ARM processor. Version 18 of the Arduino IDE comes from the package downloader, and works. Version 22 has to be installed specially, and does not work.
The SPI library did not seem to be in the Arduino IDE when it was installed. So I got the SPI library from the Playground. I suspect I did something wrong installing that. So I asked here. Apparently, no one here has had the same problem. I'll see what I can do on my own.