Remove -lmpi from tests/Makefile.am. That should be added by wrapper.