Linux

 

Refer to the topic UNIX Installation Procedures for installation procedures common to all UNIX platforms.

Supported Platforms

The following library dependencies are required to use the PI-API. Additional Linux platforms may be supported by satisfying these library dependencies.

libstdc++.so.6.0.3
libpthread.so.0
librt.so.1
libc.so.6
libgcc_s.so.1
libm.so.6

To determine whether you have these packages installed, look in /usr/lib, /usr/lib64, or /lib (the loader search paths).

If compatibility issues arise with library dependencies, and compatibility packages are not available, the libraries that were used in compilation of the PI-API are available in the ./build/api distribution directory. These may be copied to the $PIHOME/lib directory in order to allow the PI-API to operate with a known working version of the libraries.

Extracting Distribution Files

The PI-API Linux is distributed on the OSIsoft, LLC Technical Support page. The file downloaded is a compressed (gzip) tar package and must be extracted before installation. The following commands will perform the decompression and extraction of the tar archive (the file name will have 64 for the 64-bit distribution; the version number may vary from below):

# tar xfz piapiLinux64-tar_1644_.gz

 

Alternatively, you can use

# zcat piapiLinux64-tar_1644_.gz | tar xf -

After extracting the archive file, a build directory will be created which contains the version of the PI-API you have downloaded. In the build directory are the release notes (PIAPI_ReleaseNotes.htm ) and the installation script (pi.install). The installation script may be run to start the installation.

Installation

Running the script pi.install begins the installation. If your user is not in the sudoers list or if you haven’t setup sudo, you will need to be logged in as the root user. Before this, make sure you defined PIHOME and that the directory exists.

# echo $PIHOME
/opt/piapi
# ls $PIHOME

If you want to install header files for development and sample source, you may run pi.install with the "-pgm" argument. When prompted for a response, any values in square brackets are the default if the Enter (CR) is the response. Otherwise, type the appropriate value. The script uses "ksh", so if you don't have this installed, you would first have to install it. A sample install where piadmin is the PI API user would look like:

./pi.install
--- PI API Installation log ---
PIHOME is properly defined: /opt/piapi
Creating/Updating the PI-API file system
Installing PI-API from /opt/build
BLDDIR created
LIBDIR created
BINDIR created
DATDIR created
Enter an existing user name for PI-API [piadmin] ?
piadmin
User name: piadmin
Creating File: piclient.ini
Please Enter the Node Name of the Default PI Home Node:
tanggx620
Is tanggx620 a PI v3.x (UNIX, NT) system? [Y] or N
Y
Home node: tanggx620
PI3 node: Y
Installing iorates.dat
Installing release notes
Version (2 4 21-47 EL) API install type = 2
Installing Base System - PI API
API Installation Script
Setting working directory
Setting source files for Linux
Renaming old piapi shared library in /usr/lib
Installing /opt/piapi/bin/pistart /opt/piapi/bin/pistop
Installing /opt/piapi/bin/sitestart
Installing /opt/piapi/bin/sitestop
Installing /opt/piapi/build/sitelink
Installing /opt/piapi/bin/apiverify
Installing /opt/piapi/bin/apiprocs
Installing /opt/piapi/lib/libpiapi.so.2
Installing /opt/piapi/lib/libpiapi.a
Installing files in /opt/piapi/bin:
apisnap bufserv bufutil iorates ioshmcls ioshmsrv mqcls mqmgr mqsrv pilogsrv shootq
Installing soft link: /usr/lib/libpiapi.so
Running the Site Specific Link Script

Post Installation

After successful installation of the PI-API, you should be able to run the start script (pistart) located in $PIHOME/bin

Compilation

Only compilation using g++/gcc is supported. If you installed the PI-API with the "-pgm" argument, you will get the code for apisnap which will be in $PIHOME/src and a makefile to build it. To build it, simply type:

# make -f apisnap.mak

You may use this sample code and sample makefile as a reference to tailor your custom applications.

Predefined Definitions

Certain predefined definitions are required for successful programming with the PI-API. Your compiler may automatically define these or provide a means to define constants for all compiled modules. With GCC/G++, you can specify declarations with the –D switch. If not, these defines must be included in your source before the PI-API header files are included.

For this platform the required definitions are:

linux Preprocessor definition for some PI-API header files. To declare in GCC, add –Dlinux to the compile command.
_XOPEN_SOURCE ANSI compatibility name space. To declare in GCC, add –D_XOPEN_SOURCE to the compile command.

 

The following GCC switches are required for compilation of 32 bit and 64 bit programs.

32-bit GCC switches
-m32 Linux 32-bit machine definition.
64-bit GCC switches
-m64 Linux 64-bit machine definition.

Linking

GCC automatically add library dependencies if you link with the PIAPI library, so all you need to link with is the PIAPI. To do this, simply include “-lpiapi”. If your install of the PIAPI library was successful, then a symbolic link should have been already added to either /usr/lib or /usr/lib64, so specifying additional library lookup locations (with –L) shouldn’t be necessary.

Enabling Operational Intelligence