To build the Chapel compiler, set up your environment as described in
Setting up Your Environment for Chapel, cd to
$CHPL_HOME (the root directory of
your unpacked Chapel release), and run GNU make. This will build the
compiler and runtime libraries for your current environment as
indicated by running
On many systems, GNU make is available simply as
make. On others,
it is called
gmake. To check whether
make refers to GNU make
on your system, run:
If the first line includes “GNU Make”, you have GNU Make. The rest of
these instructions will assume
make refers to GNU Make. If that’s
not the case, you’ll need to replace
Now build the Chapel compiler:
Parallel builds such as
make -j 6 are also supported.
If everything works as intended, you ought to see:
each of the compiler source subdirectories being compiled
the compiler binary getting linked and stored as:
the runtime support libraries being compiled, archived, and stored in a configuration-specific subdirectory under:
If you get an error or failure during the make process, double-check that you have the required prerequisites (see Chapel Prerequisites). If you do, please submit a bug report for the failure through Reporting Chapel Issues.
After a successful build, you should be able to run the compiler and display its help message using:
In which case, you are ready to move on to compiling with the Chapel compiler (see Compiling Chapel Programs). The next few sections provide more information about using Chapel across multiple sessions, installing Chapel, and supporting multiple Chapel configurations. Following that are sections describing Chapel’s Makefiles for advanced users or developers of Chapel.
Using Chapel in a Different Shell / Terminal / Session¶
Once you have built Chapel, you can use it in other sessions (new shells or terminals) as long as:
chplcompiler is in your
$CHPL_environment variables are set or inferred to values that match a configuration you have already built
Typically, this is accomplished in one of the following ways:
by manually re-sourcing the
setchplenv.*file that you used when building Chapel.
by editing your ‘dot files’ (e.g.,
bash_profile, or whatever your shell uses to start up each session) to explicitly set your path and
$CHPL_settings as desired, or to source the appropriate
by creating a
chplconfigfile to store your preferred
$CHPL_settings (see Chapel Configuration Files for further details on creating a chplconfig file). Note, however, that some other standard technique is still required to ensure that
chplis in your path.
by installing Chapel to a specific location that is in your path using the instructions in the next section.
Chapel can be built and installed to a specific location as follows:
./configure # use './configure --help' for specific options
./configure will save your current configuration of
$CHPL_ settings into a
chplconfig file. Running it with the
--chpl-home options permits you to specify where
and how Chapel should be installed during the
make install step.
--prefix=/dir/for/install/causes the Chapel compiler, libraries, and supporting code to be installed into the directories:
This technique is designed to install Chapel using a standard directory structure for the purposes of integrating it into a standard location that is already in your path, such as
~/. Note that elevated privileges are likely to be required for any system-wide installation locations.
--chpl-home=/dir/for/installcopies key files and directories from the Chapel source tree into
/dir/for/install, preserving Chapel’s traditional directory structure.
Switching Between Multiple Configurations¶
A single installation of Chapel can simultaneously support multiple
configuration options, such as target platforms or compilers, because
all binary files and executables are stored in unique subdirectories
as determined by the
CHPL_ environment variables. However, note
make command only builds the compiler and runtime for
the current set of
CHPL_ environment variables defined by—and
inferred for—your environment. To build support for additional
configurations, you will need to modify your
variables and re-make.
Once you have built multiple configurations, you can switch between
them either by setting your
CHPL_ environment variables to the
same values as when the configuration was built, or using the
compiler’s command-line options that correspond to the environment
variables (see the ‘Compiler Configuration Options’ section of the
chpl man page for details).
The Chapel sources are structured so that a GNU-compatible
utility can be used in any source directory to build the sources
contained in that directory and its subdirectories. All of these
Makefiles support the following targets:
(nothing) default all
Build the appropriate targets — e.g., objects files, libraries, executables
verify basic functionality of a Chapel build
Remove the intermediate files for this configuration
Remove the intermediate files for all configurations
Remove everything created by the Makefiles as well as
Install Chapel to a previously configured location
Each target processes all subdirectories, then the current directory.
The Chapel makefiles have a few options that enable or disable
optimization, debugging support, profiling, and back-end C compiler
warnings. The variables are described below. Set the value to 1 to
enable the feature or 0 to disable it (e.g.,
make DEBUG=1 OPTIMIZE=1
Generate debug information (e.g., pass
-gto the C compiler)
Enable optimizations (e.g., pass
-O3to the C compiler)
Enable profiling support (e.g., pass
-pgto C compiler)
Enable more warnings and treat them as errors
Enables correctness assertions in the compiler and runtime