I ran into this same problem and was able to fix it. I had been using the yum version of Berkeley DB 4.5 and updated to Oracle Berkeley 4.6 and then it worked fine. Just make sure that when you run configure that it includes the correct version of db.h