add $(EXEEXT) to executable targets during installation for MinGW
[suif.git] / FAQ
blob11980f0252a7a3de12676205ad1216eaa74710a0
1               The SUIF Frequently Asked Questions List
2               ========================================
4   1. Q: ``The Makefile is broken.  What does, `Must be a separator on
5         rules line 5.  Stop.' mean?''
6      A: It means you're not using GNU make.  Try ``gmake'' instead.
7         If gmake isn't in your path, find out where it's installed on
8         your system and put it in your path.  If gmake isn't
9         installed, you'll need to install it.  See the SUIF README
10         file.
12   2. Q: ``I compile the SPEC benchmark tomcatv (or some other large
13         FORTRAN program) with SUIF and the compilation seems to work,
14         but when I run the resulting binary it seg faults immediately.
15         What's wrong?''
16      A: You need to remove the limit on the stack size of processes.
17         Under csh, try ``unlimit stack''.  This program uses an
18         enormous (in the MB range) local array.  SUIF puts locals on
19         the stack, so if you have low stack-size limits, which are
20         often the default, the program will crash.
22   3. Q: ``When I compile a program (on a non-MIPS machine, or on a
23         MIPS machine with -s2c), why do I get errors like:
25 "/tmp/scc00684_5.out.c", line 227: syntax error at or near variable name "F"
27         or other similar errors in a weird .out.c file?''
28      A: The s2c backend, which is run by default on non-MIPS machines,
29         or if you specify the -s2c option to scc, converts SUIF into C
30         and then runs your native C compiler to generate an executable.
31         The output of s2c is ANSI-C compliant, but many C compilers are
32         unable to handle ANSI-C code.  You should use an ANSI-C compliant
33         compiler, such as gcc, instead.  You can specify the name of
34         another compiler with the "-cc name" option to scc, such as
35         "-cc gcc".
37   4. Q: ``If I want to run the output program on a different machine
38         than the one on which I run SUIF, can I do that?''
39      A: Yes, this is called cross-compiling, and SUIF is generally
40         capable of cross compiling for any target machine that has an
41         ANSI C compiler.  There are a couple of issues you should be
42         aware of, though.  They have to do with ensuring that SUIF
43         uses information about the true target machine instead of
44         information about that machine on which SUIF is running.
45         Since the most common case is to target the machine on which
46         SUIF is running (or a machine with the same processor and OS),
47         by default SUIF uses the information about the machine on
48         which it is running as the target information.  Since SUIF is
49         designed to facilitate cross-compilation, the assumptions
50         about the target machine are made at only two points in the
51         compilation:
53           * The C pre-processor stage (note that this stage is used in
54             Fortran compilation, not just C compilation).  At the
55             pre-processor stage, system include files are incorporated
56             into the program by directives such as
57             ``#include <stdio.h>''.  These include files are highly
58             system-dependent.  Typically they are provided by the OS,
59             mostly in /usr/include.  To cross-compile, you must first
60             run the passes that come before the C pre-processor (cpp),
61             which is nothing for C programs, but is the ``sf2c'' pass
62             for Fortran programs (run ``scc -.c file.f'') on the
63             machine that runs SUIF.  Then, you must transfer all the
64             files to the target machine, run the pre-processor to
65             generate .i files (cpp on some systems, ``cc -E'' on other
66             systems, and other things on other systems).  Then you
67             must transfer all the .i files back to the machine running
68             SUIF and then you can continue the compilation from the .i
69             files.  That always works.  As an alternative, you can try
70             duplicating the entire /usr/include directory tree for
71             target machine <machine> under
72             $SUIFHOME/<machine>/include.  You also have to generate
73             the proper $SUIFHOME/<machine>/predefined.txt file showing
74             what pre-defined macros <machine> defines by default in
75             its pre-processor (see
76             $SUIFHOME/src/basesuif/config/README.config for details).
77             If you can do that correctly, then all you have to do is
78             specify ``-Target <machine>'' to scc and it will be able
79             to run cpp on the SUIF machine and yet get everything
80             correctly set up for <machine> as target.
82           * The snoot pass.  This pass initializes a table used by
83             snoot and all later passes that gives informatin about the
84             target machine, mostly sizes and alignments of data types.
85             This information is passed along in the SUIF file, so it
86             only needs to be set once, in snoot, and all later passes
87             will have the correct information.  By default, snoot
88             assumes the parameters of the machine running SUIF (snoot
89             auto-detects this information).  But for cross-compiling,
90             snoot must be given the information about the target
91             machine.  This information is kept in a table in
92             $SUIFHOME/src/basesuif/snoot/config.h.  This table may
93             have any number of entries -- a table with a few sample
94             entries for popular machines is distributed.  A table for
95             a new machine can be automatically constructed using the
96             ``find_params.c'' file from snoot's source directory.  See
97             comments in that file for details.  Once you have the
98             table for the new machine, you can add it to config.h,
99             then you must recompile snoot.  After snoot is recompiled,
100             it will understand the name you have given for your new
101             machine as a valid target.  You can use
102             ``scc -Target <machine>'' to pass the machine name to
103             snoot, or, if you are running snoot directly, you can use
104             ``snoot -T<machine>''.
106         Note that if you want to do the work to set it all up, you can
107         get SUIF to compile straight from source to output C file (or
108         other back-end output) on the machine running SUIF for several
109         different targets, and choose between them by changing nothing
110         more than the argument to the ``-Target'' option for scc.