Setting up the Environment
Prev | Chapter 4. Installation and Configuration | Next

## Setting up the Environment

As with the installation process itself, the steps required to set up your environment depend on your host operating system. The name of the Sourcery G++ commands all begin with mips-sde-elf so that you can install Sourcery G++ for multiple target systems in the same directory.

### Setting up the Environment on Microsoft Windows

On a non-Vista Microsoft Windows system, the installer automatically adds Sourcery G++ to your `PATH`. You can test that your `PATH` is set up correctly by using the following command:

    > mips-sde-elf-g++ -v

and verifying that the last line of the output contains: `Sourcery G++ Lite 4.2-127`.

On a Microsoft Windows Vista system, the installer does not automatically add Sourcery G++ to your `PATH`. To set up your `PATH` on Microsoft Windows Vista, use the following command in a `cmd.exe` shell:

    > setx "%PATH%;C:\Program Files\Sourcery G++\bin"

where `C:\Program Files\Sourcery G++` should be changed to the path of your Sourcery G++ Lite installation. You can verify that the command worked by starting a second `cmd.exe` shell and running:

    > mips-sde-elf-g++ -v

Verify that the last line of the output contains: `Sourcery G++ Lite 4.2-127`.

#### Working with Cygwin

Sourcery G++ Lite does not require Cygwin or any other UNIX emulation environment. You can use Sourcery G++ directly from the Windows command shell. You can also use Sourcery G++ from within the Cygwin environment, if you prefer.

The Cygwin emulation environment translates Windows path names into UNIX path names. For example, the Cygwin path `/home/user/hello.c` corresponds to the Windows path `c:\cygwin\home\user\hello.c`. Because Sourcery G++ is not a Cygwin application, it does not, by default, recognize Cygwin paths.

If you are using Sourcery G++ from Cygwin, you should set the `CYGPATH` environment variable. If this environment variable is set, Sourcery G++ Lite automatically translates Cygwin path names into Windows path names. To set this environment variable, type the following command in a Cygwin shell:

    > export CYGPATH=cygpath

To resolve Cygwin path names, Sourcery G++ relies on the cygpath utility provided with Cygwin. You must provide Sourcery G++ with the full path to `cygpath` if cygpath is not in your `PATH`. For example:

    > export CYGPATH=c:/cygwin/bin/cygpath

directs Sourcery G++ Lite to use `c:/cygwin/bin/cygpath` as the path conversion utility. The value of `CYGPATH` must be an ordinary Windows path, not a Cygwin path.

### Setting up the Environment on GNU/Linux or Solaris

If you installed Sourcery G++ Lite using the `.bin` graphical installer then you may skip this step. The graphical installer does this setup for you.

Before using Sourcery G++ Lite you should add it to your `PATH`. The command you must use varies with the particular command shell that you are using. If you are using the C Shell (csh or tcsh), use the command:

    > setenv PATH $HOME/CodeSourcery/sourceryg++-4.1/bin:$PATH

If you are using Bourne Shell (sh), the Korn Shell (ksh), or another shell, use:

    > PATH=$HOME/CodeSourcery/sourceryg++-4.1/bin:$PATH
    > export PATH

If you are not sure which shell you are using, try both commands. In both cases, if you have installed Sourcery G++ Lite in an alternate location, you must replace the directory above with `bin` subdirectory of the directory in which you installed Sourcery G++ Lite.

You may also wish to set the `MANPATH` environment variable so that you can access the Sourcery G++ manual pages, which provide additional information about using Sourcery G++. To set the `MANPATH` environment variable, follow the same steps shown above, replacing `PATH` with `MANPATH`, and `bin` with `share/doc/sourceryg++-mips-sde-elf/man`.

You can test that your `PATH` is set up correctly by using the following command:

    > mips-sde-elf-g++

and verifying that you receive the message:

    mips-sde-elf-g++: no input files

Prev | Up | Next
Uninstalling Sourcery G++ Lite | Home | Chapter 5. Using Sourcery G++ from the Command Line