If you are compiling PHP manually and compilation prematurely halts due to a “ld returned 1 exit status” try issuing the following command from within the build directory, I was running into the same issue and the command worked for me.

$ -> gmake distclean