Personal tools
You are here: Home LINC Lab User Scripts Environment Variables for Compiling LINC maintained software.

Environment Variables for Compiling LINC maintained software.

Some information about compiling C and C++ programs using libraries in these directories.

PLEASE NOTE, you really should have already modified your startup scripts.

 

Unfortunately, just adding the script information is often not enough for the make build tool and the configure tool often included with third party tools.

 

So, for make, we need often need to set some additional environment variables to correctly compile the code.

 

The first is LDFLAGS

--> this environment var indicates where third party libraries may reside.

The second is CPPFLAGS

-->this environment var indicates where the header files (the .h files) may reside.

 

Normally, the make program is able to search the standard system locations without a problem - you just need to tell it where the non-standard locations are.

 

Let's take an example for the Solaris 10 environment.

Assume the libraries are at /lincfs/users/LINC/software/solaris5_10/lib

Assume the header files are at /lincfs/users/LINC/software/solaris5_10/include

 

For the CSH shell, you would use these commands:

setenv LDFLAGS -L/lincfs/users/LINC/software/solaris5_10/lib:$LDFLAGS
setenv CPPFLAGS -I/lincfs/users/LINC/software/solaris5_10/include:$CPPFLAGS

For the BASH shell, you would use these commands:

export LDFLAGS=-L/lincfs/users/LINC/software/solaris5_10/lib:$LDFLAGS
export CPPFLAGS=-I/lincfs/users/LINC/software/solaris5_10/include:$CPPFLAGS

NOTE 1:  The -I and -L are important - they tell the C/C++ compiler that the paths are for include files and libraries, respectively.

 

NOTE 2:  If one of the environment vars is not defined, you can simplify the above.

For CSH, if LDFLAGS is undefined, can become

setenv LDFLAGS -L/lincfs/users/LINC/software/solaris5_10/lib

and for BASH, it could be

export LDFLAGS=/-Llincfs/users/LINC/software/solaris5_10/lib

To check if the var exists, type

printenv VARNAME

So, for LDFLAGS, the command would be

printenv LDFLAGS

If it is undefined, a blank line is printed.  Otherwise, the information is added.

Document Actions
« May 2012 »
May
MoTuWeThFrSaSu
123456
78910111213
14151617181920
21222324252627
28293031