Subject: (egcs-mingw32/cygwin32) The collect2/ld problem workaround
From: [email-masked] (Mumit Khan)

22 Dec 1997 13:08:16 -0800
Message-ID: <[email-masked]>
To: [email-masked]

For those of who've found the mysterious "collect2 exited with status 1"
error after seemingly being hung for a while, here's what happens:
   
   - gcc invokes ld.exe in gcc's library directory (you can see what that
     is by running `gcc -print-prog-name=ld'). This is the program
     otherwise known as collect2 and needed for C++, especially for -frepo
     and exception handling.
    
   - collect2 (installed as ld.exe in library directory) does its thing
     and then looks for the *real* ld.exe (GNU ld) according to a set of
     rules (LIBRARY_PATH+COMPILER_PATH env variables, PATH, etc) and
     execs that to do the final link editing.

Due to a bug in collect2, it's finding itself first (since it's called
ld.exe) and execing itself causing a recursion and eventually chokes.

Solution? Install the real ld.exe (GNU ld that's installed as ld.exe in
the binary directory) as collect-ld.exe in the directory where cc1.exe
lives (that's called gcc library/compiler directory). This is the
directory you see when you use the command `gcc -print-prog-name=cc1'.
Now ld.exe will exec collect-ld.exe instead and all will be well.

I know the problem exists for cygwin32, but not sure about mingw32. The 
workaround above is safe for either case, so I recommend you do it.

I'll hopefully have a fix out soon.

Mumit
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".