http://www.perlmonks.org?node_id=1069508

llancet has asked for the wisdom of the Perl Monks concerning the following question:

I'm writing an module with XS. On the last step of linking every thing together, the linker failed:
cc -shared -L/usr/local/lib -fstack-protector -o blib/arch/auto/GenoEy +e/GenoEye.so buildtmp/GenoEye.o -lcairo /usr/bin/ld: cannot find -lcairo collect2: error: ld returned 1 exit status
But the cairo library is out there. I manually run the link command, it runs successful.
$ cc -shared -L/usr/local/lib -fstack-protector -o blib/arch/auto/Geno +Eye/GenoEye.so buildtmp/GenoEye.o -lcairo $ ls blib/arch/auto/GenoEye/ GenoEye.bs GenoEye.so
Why it failed in perl build script? I use Module::Build::WithXSpp and a Build.PL.