Compile LSF API programs

Compile an LSF API program without using the makefile.

Include the LSF API libraries and the link flags for the appropriate architecture on the command line.

This establishes the compilation environment.

For example, to compile an LSF API program on a Solaris 2.x 32 bit machine, you will have a compilation statement similar to the following:

% cc -o simbhosts simbhosts.c -I$LSF_ENVDIR/../include $LSF_LIBDIR/libbat.a $LSF_LIBDIR/liblsf.a -lnsl -lelf ‑lsocket -lrpcsvc -lgen -ldl -lresolv -lm
  • The flag -I$LSF_ENVDIR/../include specifies the location of the LSF include directory.

  • $LSF_LIBDIR/libbat.a and $LSF_LIBDIR/liblsf.a are the locations of the LSLIB and LSBLIB.

  • We include the following extra compilation flags as given from the above chart:

    ‑lnsl ‑lelf ‑lsocket ‑lrpcsvc ‑lgen ‑ldl -lresolv -lm
  • The resulting executable of the program simbhosts.c is called simbhosts.

Compile an LSF API program on a 64 bit Solaris 2.x

Add the xarch setting as follows:
% cc -xarch=v9 -o simbhosts simbhosts.c -I$LSF_ENVDIR/../include $LSF_LIBDIR/libbat.a $LSF_LIBDIR/liblsf.a -lnsl -lelf ‑lsocket -lrpcsvc -lgen -ldl -lresolv -lm

Compile on Linux

Include the libnsl.a library.

This library is located in /usr/lib/.

For example, when compiling a program on redhat6.2-intel, use the following:

gcc program.c -I$LSF_ENVDIR/../include $LSF_LIBDIR/libbat.a $LSF_LIBDIR/liblsf.a $LSF_LIBDIR/libnsl.a -lm -lnsl -ldl

where program.c is the name of the program you want to compile.

Compile on Solaris x86-64-sol10

Use the following library and link flags:
/opt/SUNWspro/bin/cc obj.c -R/usr/dt/lib:/usr/openwin/lib -DSVR4 -DSOLARIS
-DSOLARIS64 -xs -xarch=amd64 -D_TS_ERRNO -Dx86_64 -DSOLARIS2_5 -DSOLARIS2_7
-DI18N_COMPILE -DSOLARIS2_8 -DSOLARIS2_10 -DSTD_SHARED_OBJ -lbat -llsf -lnsl
-lelf -lsocket -lrpcsvc -lgen -ldl -lresolv -o obj_name

where obj.c is the name of the program you want to compile and obj_name is the name of the binary you can run after compiling the program.