XShapeQueryExtension resides in libXext.so, but judging by your output Prima either wasn't linked with it (because X11/Xext.h wasn't found by Makefile.PL), or you have a configuration problem on your machine. If you could rerun Prima's Makefile.PL and post the output, and possibly excerpt from makefile.log (it's big, so only Xext-related parts), then I'd be able to help more.