GCC/2 crashes with a trap when I try to compile a program. Why?

Because you didn't read the README or INSTALL files, probably. There are three general reasons GCC/2 will crash:

  • You did not set up the environment variables in CONFIG.SYS properly. Read doc/INSTALL for instructions.

  • Some program that gcc expects to be in the PATH is not; unfortunately, gcc crashes instead of just printing an error message. You may have forgotten to install something, or your PATH may be wrong; see above. Giving gcc the -v option will cause it to print each command line as it executes it; this will tell you which program is missing.

  • You are trying to get gcc to link your program for you. It cannot because ld does not exist, and so it crashes (see item 2). You must specify -c, -E, or -S on every invokation of gcc, and then use LINK386.EXE to create an executable. See the sample makefiles for an example of how to do this.

  • Colin Jensen, the current maintainer of GCC/2, also adds the following...]

    Not true as of gcc/2 2.3.3. Gcc will invoke a small stub program called ld.exe that in turn will invoke link386 for you. If the command line is too long for the ever-pathetic link386 to handle, ld will properly create a response file.

    It is easier to use gcc/2 to call link386 than to do it yourself since gcc/2 will also arrange to call a subprogram called "collect" that is required before linking a C++ program.

    Also, gcc/2 is just plain easier to use than link386, for example:

             gcc -o foobar.exe mydef.def foobar.cpp mylib.lib
    

    will compile foobar.cpp, link with mylib.lib, and pass the linker definition file mydef.def to link386 in the correct order. Link386 demands that you know which types of files can be put between which sets of commas on the command line.


    [Back: What is an RC of 87 (invalid param) from the API?]
    [Next: How do I recompile EPM (easily)?]