Re-run the gcc invocation manually (enter the same directory and run the command) If this succeeds, then it's a pkgsrc wrappers issue. If this fails still, use -Wl,--verbose to see why it has issues.