pgcpp-Fatal-Could not spawn MS link.exe (windows)

Please help me resolve this error when I compile:

C:\test>pgcpp -Mipa=fast @objFileList
pgcpp-Fatal-Could not spawn C:/Program Files/PGI/Microsoft Open Tools 8/bin/link.EXE

link.exe exists and runs fine on its own. What’s going on? I have about 600 object files compiled with Mipa=fast listed in the objFileList file to be linked together (large project port :)

Kevin Smith


I experienced some problems on our windows 6.1-3 release when I attempted to compile
a test case like yours. When I moved to the latest 7.0 release, the test compiled fine.
6.1-3 may have had problems with the @objFileList option. Please try 7.0.

Im using pgcc 7.0-5 32-bit target on Win32 - The latest compiler :( Can you upgrade your compiler to the latest version and try running your test script on it? Im trying to port our project to the PGI compiler for all of our cross-platform builds. I’m usign the trial version I downloaded from the website a few days ago to benchmark and justify deploying.

Kevin Smith.


I can’t accurately reproduce your problem here.
Please send a copy of the objFileList file, and the full output generated when you add -v to
the pgcpp link line(including the error from the linker), to Ask them
to forward it to deborah caruso.

This might provide the clues I need


Another possibility -
check your localrc file. pgcpp -dryrun will give you the path to the rc files.
Change localrc to use “link.exe” or “LINK.EXE” – and see if this solves your problem.

That didn’t fix the problem I sent you an e-mail.


<you’ll get this via trs tomorrow, but I’ll post now for a quicker turnaround>

Your error indicates that the compiler driver received an error when it attempted to
spawn(call) the linker. We don’t record the exact error, but it is most likely:

E2BIG: Argument list exceeds 1024 bytes.

When I do

pgcpp -v -Mipa=fast -Mmakedll -otest.xll kernel32.lib user32.lib @yourobjs

I see that the compiler driver opens yourobjs and passes the object files
to the link line. This may be causing the spawn failure.

Replace @yourobjs with -Wl,@yourobjs

This will force the linker, and not the compiler driver to open the object file list,
shortening the spawn command line.

This is a shot in the dark, since I have not been able to reproduce your
spawn failure in-house. Let me know if this works, so that we can fix it in our driver.