home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / msdos / djgpp / faq < prev    next >
Encoding:
Text File  |  1993-07-17  |  9.2 KB  |  176 lines

  1. Q: What's the minimum set of .zip files I need for compiling programs?
  2. A: djdevXXX,bnu22bn,  gasXXXbn, and gccXXXbn are required.  The remainder are for
  3.    additional functionality.  Note that the version numbers do not
  4.    neccessarily match between FSF programs (gas and gcc) and my programs
  5.    (go32).  You'll also need bsnXXXbn for bison and flxXXXbn for flex,
  6.    where XXX is the version number.
  7.  
  8. Q: What about documentation?
  9. A: For the FSF utilities, djgpp includes three files each.  Example:
  10.     gcc241bn.zip - binaries & source diffs for gcc 2.4.1
  11.     gcc241dc.zip - documentation for gcc 2.4.1
  12.     gcc241sr.tgz - original FSF sources for gcc 2.4.1
  13.  
  14.    Note that the FSF files are in .tar.z format.  To explode them,
  15.    use these commands:
  16.        gzip -d -c gcc241.tgz > gcc241.tar
  17.        djtarx gcc241.tar
  18.    You may need to use "utod.exe" to convert the .bat files from
  19.    Unix to DOS format.
  20.  
  21. Q: Why do I get so many unresolved symbols when linking C++ programs?
  22. A: The C++ libraries are all in libgpl.a, since they're all covered
  23.    by the GPL.  You must use a command like this:
  24.        gcc -o prog prog.o -lgpl -lm
  25.    Note that some C++ classes use math routines, so the -lm should be
  26.    given after the -lgpl.  If you don't link with -lgpl, you won't
  27.    include any GPL code in your application.
  28.  
  29. Q: When I run "gcc e:\proj\prog.c" it says "undefined escape sequence \p"?
  30. A: Gcc is a *unix* compiler - you must use *unix* slashes (e:/proj/prog.c).
  31.    Environment variables (like GCCINC) may, however, use either, as they
  32.    are converted.
  33.  
  34. Q: I type "GCC PROG.C" and ld complains about PROG.C not being an object.
  35. Q: I type "gcc prog.cxx" to compile a C++ program, and ld complains.
  36. A: Gcc is *not* case insensitive like DOS is, and it uses the file's
  37.    extension to determine how to compile a file.  Valid extensions are:
  38.      .cc = C++ source (passed through cpp)
  39.      .c = C source that must be passed through cpp first
  40.      .i = raw C source (no cpp pass)
  41.      .S = assembler that must be passed through cpp first
  42.      .s = raw assembler source (no cpp pass)
  43.    any other file is passed to the linker
  44.  
  45. Q: I compile my program, but can't run the output file.
  46. A: DOS doesn't know how to run unix-style a.out files.  That's what the
  47.    extender is for.  To run an a.out file called myprog, type
  48.      "go32 myprog . . ."
  49.  
  50. Q: Gcc doesn't recognize // as a comment in my C programs.
  51. A: That's because // isn't a comment in C.  If you want to compile C++,
  52.    then write C++ programs.  Gcc is really two compilers in one, not
  53.    one compiler that compiles both C and C++.  That's why you get
  54.    cc1 and cc1plus.
  55.  
  56. Q: I'm reading in data files, but the data gets corrupted.
  57. A: The default file type is DOS text, even for read() and write().  You must
  58.    tell the system that a file is binary through the "b" flag in fopen(),
  59.    or O_BINARY in open() or setmode().
  60.  
  61. Q: I get "fatal signal 2" when I run gcc.
  62. A: When gcc reports a "signal", it really means that an error occurred
  63.    trying to run the given program.  The "signal" number is the DOS error
  64.    code, and 2 means "file not found".  Check the COMPILER_PATH environment
  65.    variable and make sure it points to the directory with cpp.exe,
  66.    cc1.exe, etc.
  67.  
  68. Q: The binaries I get with the distribution are .exe files, but gcc creates
  69.    a.out files.  I rename the a.out's to .EXE's, but they still don't work.
  70. A: To get an .EXE from an a.out, you must *prepend* either go32.exe,
  71.    debug32.exe, or stub.exe to the file.  A program called "aout2exe"
  72.    is provided to do this.  Just run "aout2exe myprog".
  73.  
  74. Q: What is stub.exe?
  75. A: Stub.exe simply calles go32.exe, and passes it information it needs to
  76.    run the a.out file attached to it.  Stub is much smaller than go32, so
  77.    less disk space is used.  Also, if you change go32, you don't have to
  78.    change stub, and all the stub-ized programs will use the new go32
  79.    automatically.
  80.  
  81. Q: I want to change cc1.  How do I do this?
  82. A: First, get the GNU sources.  These should be the "gccXXXsrc.zip"
  83.    files found in the djgpp distribution.  You can also get the latest
  84.    versions from the FSF if you like.  They're usually available at
  85.    prep.ai.mit.edu in /pub/gnu, if not elsewhere.  djgpp includes a
  86.    copy of gzip (gzip-1.0.7-bin.zip) that can uncompress them. Use
  87.    djtarx to un-tar them, as djtarx knows how to handle unix file names
  88.    that aren't valid DOS file names.  Look in the "diffs" sources to see
  89.    what to change the names to when they conflict.  Next, apply the
  90.    "diffs" (if any) over the GNU sources (making sure you have the
  91.    right version of GNU - see the versions file).  For gcc 2.2.2 and
  92.    above, you must run "configure" to prepare the sources for a native
  93.    go32 compiler before building. For all other programs, just run make.
  94.    Note that the makefiles are tuned for ndmake, since it knows how to
  95.    make response files.  Specific instructions are documented in the
  96.    diffs directory.
  97.  
  98. Q: I don't have an 80387.  How do I compile floating point programs?
  99. A: Add "emu c:\djgpp\emu387\emu387" to the GO32 environment variable
  100.    (see go32 section in readme).  This tells go32 to use the given file
  101.    as an 80387 emulator.  If you don't load this emulator, and you try
  102.    to run floating point without a 387, you will get an error.
  103.  
  104. Q: I installed an 80387 emulator in my AUTOEXEC, but it still doesn't
  105.    work.  Why?
  106. A: The CPU is running in *protected* mode, not real mode, and the information
  107.    needed to emulate the 80387 is different.  Not to mention that the
  108.    exceptions never get to the real-mode handler.  You must use the emu387
  109.    emulator, which is designed for go32.
  110.  
  111. Q: Can I run this on my 286?  It has protected mode also...
  112. A: True, but the 286 isn't a 32-bit processor.  A 386 really is required.
  113.  
  114. Q: Can I use gcc on my 512K machine?
  115. A: Yes, but the disk better have at least 4Mb of free space for paging.
  116.    Go32 will use all available extended memory (up to 128M) and up to
  117.    128M of disk space, for a grand total of 256M of virtual memory for
  118.    your application.  Try a malloc(50*1024*1024) some day.
  119.  
  120. Q: Why do my compiles are running VERY SLOW, even though I use a ramdisk
  121.    for swap and a disk cache?
  122. A: Gcc requires at least 1Mb of virtual memory to run, usually close to 1.5M.
  123.    If there isn't this much real memory available, it starts paging to disk.
  124.    It's good to leave about 1M of extended (not expanded) memory available
  125.    for go32 to run programs with.  When it needs to page a lot, you spend
  126.    most of your time paging and little time actually running.  Note that
  127.    if you are running with a VCPI server, like QEMM or 386MAX, then go32
  128.    will use *expanded* memory for it's physical memory needs, not
  129.    extended.
  130.  
  131. Q: How much memory is available when I use the system() call?
  132. A: Everything but what go32 is loaded with.  The program is completely
  133.    paged out to memory (including the page tables themselves) before
  134.    the second program is executed.  Currently, this is about 100K
  135.    less than was available before go32 was executed.
  136.  
  137. Q: Go32 complains that the CPU must be in V86 mode to run.
  138. A: When the CPU is in V86 mode, the V86 manager must provide VCPI
  139.    services for go32.  Since VCPI is an extension to EMS, disabling EMS
  140.    will disable VCPI, and prevent go32 from running.  For emm386.sys, this
  141.    means that you can't use the "noems" switch. 
  142.  
  143. Q: How do globbing and response files work?
  144. A: A response file is a file that contains stuff that goes on the command
  145.    line, but is too big for DOS.  The name of the file is given as "@file"
  146.    to any a.out program, and go32 reads the file for command line
  147.    information.  It uses single and double quotes to group parameters, and
  148.    backslashes to escape quotes, spaces, tabs, newlines, and backslashes. 
  149.    Parameters containing wildcards are expanded if they can be, else they
  150.    are unmodified.  Surrounding a parameter in single quotes will prevent
  151.    wildcards from being expanded.  This is similar to unix.  Note that
  152.    backslashes are not special if they are not in front of a quote,
  153.    whitespace, or backslash. 
  154.  
  155. Q: What is GCC16?  How do I use it?
  156. A: GCC is merely a driver program which calls the CCP, CC1, AS, LD images.
  157.    The 16-bit gcc is simply gcc itself compiled with Turbo-C instead of
  158.    Gcc.  This improves compile times on most systems, but isn't as
  159.    "clean" as the 32-bit compiled version, and also the 32-bit version
  160.    can be recompiled (FSF desires) without having to purchase a new
  161.    compiler.  Both versions should produce exactly the same output, but
  162.    if you have any problems (such as under Novell) use the 32 bit version.
  163.    You can either put GCC16 in your path and issue GCC16 as your compile
  164.    command, or rename it to GCC (saving the 32 bit GCC.EXE as GCC32.EXE).
  165.    GCC16 does not create 16 bit code, or allow the compiler to work on
  166.    16 bit only machines.
  167.  
  168. Q: Is GDB available for DJGPP?
  169. A: No.  The structure of the extender makes this a difficult or impossible
  170.    port.  Hopefully in V2.0.
  171.  
  172. Q: Where is the "make" utility?
  173. A: There are many "make" utilities available in separate packages.  The 
  174.    GCC configure utility creates files which are ndmake compatible 
  175.    (ndmake is available on simtel mirrors).
  176.