I'm using Ubuntu 12.04LTS and ran into some build and test problems

The linker was producing a lot of undefined symbols, so I moved the -lgcrypt to the end of the link line.

I didn't dig into why I was getting core dumps with -o, but redirecting the output works for me.

Commit comments:
Make linkable on Ubuntu 12.04LTS.
Work around core dump for tests.