Documents/How to/Build from source - OpenSCADAWiki

# Documents/How to/Build from source

English • ‎mRussian • ‎Українська

- Author: Roman Savochenko, Constantine

The manual is intended to help in the building of OpenSCADA from source texts. In the process of accumulation of experience of building OpenSCADA for different OS Linux distributions and others platforms generally, the document will be appended by the features and details of the building in the environments.

Pre-configuration of the built program on the latest versions of OpenSCADA is not required if used when building the "openscada-res" resource package or the source tree from the SVN repository, even after a direct build. Therefore, immediately after building and installation, the program is ready for use!

Building OpenSCADA from source texts requires experience in building free software, as well as basic knowledge of the Linux OS and the used Linux distribution. That will allow you to correctly satisfy dependencies and solve possible building problems.

## 1 OpenSCADA configuration for building

As a build system, the OpenSCADA project uses a set of utilities AutoTools. Any building of the project under the control of AutoTools is preceded by the configuration stage for the OS environment, and sometimes the formation of the building system itself. The configuration stage, as well as the direct building, is always carried out and does not depend on whether it is a direct building or a package building.

AutoTools utilities autoconf, automake and libtool must be installed to create a building system. General formation can be done with the command autoreconf -if. A previously formed building system may sometimes need to be reformatted, for example, in the case of a significant difference between the OS environment of the formation and the current one! Reformation of the building system is also carried out by the previously defined formation command.

The configuration of the building system is carried out by calling the configure command. By specifying arguments to this command, you can enable-disable an OpenSCADA function or module. You can get the entire list of available OpenSCADA configuration parameters and modules by specifying the configure --help argument.

OpenSCADA modules are enabled and disabled by passing the arguments configure --enable-{ModName} and configure --disable-{ModName} . When selecting modules, you can specify the policy "Enable all modules" — configure --enable-AllModuls or "Disable all modules" — configure --disable-AllModuls, and further enable-disable individual modules, whichever is easier. Most OpenSCADA modules can be linked (embedded) directly into the OpenSCADA core library, rather than being built as a separate library, for which the configure --enable-{ModName}=incl argument must be specified.

Generically you can build OpenSCADA in three binary configurations, operating the core library place by the argument configure --enable-CoreLibStatic:

1. Standard with the shared core library lib/liboscada.so.4.0.9, the shared module libraries lib/openscada/{modTp}_{modNm}.so and the starting binary bin/openscada — effective on big systems with starting many OpenSCADA projects and flexible control for loaded modules.
2. Without the shared core library, with the shared module libraries lib/openscada/{modTp}_{modNm}.so and the starting binary bin/openscada with statically builtin code of the core library — effective on systems with fast starting one or several OpenSCADA projects and flexible control for loaded modules.
3. All in one starting binary bin/openscada by statically building here code of the core library and all modules — effective on very tight embedded systems for embedding all need functions in maximum small single binary.

Upon successful completion of the configuration, a summary result of the settings will be generated, with which you can check the main points.

Before building, you need to decide on the source of the source texts, FTP/HTTP-server or SVN-repository, and the branch of OpenSCADA that you will build. Since the LTS branch is automatically built for many Linux distributions, is rarely updated and its version changes with the release of a new LTS, this guide will consider the assembly of the working branch (Work), which, in turn, is automatically compiled for a limited range of Linux distributions, often changes and its address always the same, unless you count the revision number. As a rule, the building of the LTS branch is carried out in the same way, and in the instructions "Work" should be replaced with the LTS version and the name of the source text package should be changed. In general, the names of packages and folders should be treated carefully, because they can differ from version to version!

## 2 Direct building of OpenSCADA

Building must be done as a normal user, although for isolated environments it can also be done as a superuser. At the same time, variants for installation and execution will be considered both globally — in the system, and locally — in the user's folder. We accept the user's login (account) as "user".

Log in as a normal user and replace the "user" account with yours, decide on the installation method (global or local) and follow the instructions:

Steps of preparation the source tree for building:

  1. Make directory for the project building:

    mkdir ~/projects
    cd ~/projects

  2. Download the sources package. It may be made from two ways:
  - [TAR] download TAR archive from the FTP/HTTP-server http://ftp.oscada.org/OpenSCADA/ and unpack it, for example:

    wget http://ftp.oscada.org/OpenSCADA/Work/openscada-1+r2920.tar.xz
    wget http://ftp.oscada.org/OpenSCADA/Work/openscada-res-1+r2920.tar.xz
    tar -xvf openscada-1+r2920.tar.xz
    cd openscada-1+r2920
    tar -xvf ../openscada-res-1+r2920.tar.xz

  - [SVN] obtain the project source tree from the SVN-repository:

    svn co http://oscada.org/svn/trunk/OpenSCADA/
    cd OpenSCADA

  3. Resolve the OpenSCADA dependencies for the building, in accordance to the demands.
  4. [SVN] Generate of the building system, when download from the SVN-repository:

    autoreconf -ivf

Steps of the global building:

  1. Configure the building system of OpenSCADA:

    ./configure

  2. Build OpenSCADA:

    make

  3. Install OpenSCADA:

    su  # Entry for superuser
    make install

  5. The program is ready to start up:

    exit
    openscada

Steps of the local building:

  1. Configure the building system of OpenSCADA:

    mkdir ~/OScadaW
    ./configure --prefix=/home/user/OScadaW

  2. Build OpenSCADA:

    make

  3. Install OpenSCADA:

    make install

  4. The program is ready to start up:

    cd ~/OScadaW/bin
    ./openscada

## 3 Building of OpenSCADA packages for the Linux distribution

### 3.1 Debian-based distributions — DEB packages

In order to build OpenSCADA DEB packages, you will need archives of source texts and resources.

Building of DEB packages is located in the "debian" folder with build scripts contained in archives of the OpenSCADA source texts.

Building steps:

  1. Create a directory to build the program:

    mkdir ~/build
    cd ~/build

  2. Download the sources packages. It may be made from two ways:
  - [TAR] download TAR archive from the FTP/HTTP-server http://ftp.oscada.org/OpenSCADA/ and unpack it, for example:

    wget http://ftp.oscada.org/OpenSCADA/Work/openscada-1+r2920.tar.xz
    wget http://ftp.oscada.org/OpenSCADA/Work/openscada-res-1+r2920.tar.xz
    tar -xvf openscada-1+r2920.tar.xz
    cd openscada-1+r2920
    tar -xvf ../openscada-res-1+r2920.tar.xz

  - [SVN] obtain the project source tree from the SVN-repository:

    svn co http://oscada.org/svn/trunk/OpenSCADA/
    cd OpenSCADA

  3. Selection the building type:
  - binary files in one package:

    ln -s data/debian debian

  - binary modules files in separate packages:

    ln -s data/debian_mod debian

  4. Resolve the OpenSCADA dependencies for the building, in accordance to the demands. Arguments for the command "configure" you can specify into the file "debian/rules".
  5. Building:
  - build from the beginning:

    dpkg-buildpackage -rfakeroot

  - skip the building and repack, it is convenient for the debugging "debian/rules":

    fakeroot debian/rules binary
    fakeroot debian/rules build

  6. Packages are ready and available in the level above directory.

### 3.2 RedHat-based distributions — RPM packages

For building OpenSCADA RPM packages, you will need source texts archives, resources, and a RPM package specification file (openscada.spec, openscada_mod_ALT.spec, openscada_mod_RH.spec), or a SRPM package of all these source materials.

The RPM package specification file and the SRPM package may differ for different Linux distributions, taking into account their features, so you should try to load them according to the distribution. If there is no special SRPM packet then you can try to build from the unified specification file (openscada.spec) in the main SRPM package or resource packet.

Building the RPM packages takes place in a directory with a special structure that is usually created when installing the appropriate distribution package (as "rpm-build"). This directory, depending on the distribution, is located in the user's home directory or in the "/usr/src" directory. Known facts of location of the directory RPMBuildDir of RPM Packages of different distributions:

- "~/rpmbuild" — RedHat, CentOS, Mandriva, Fedora
- "/usr/src/packages" — SuSE
- "~/RPM" — ALTLinux

If you have no directory of RPM packets after installing the specialized package, then you need to create it with the command:

    install -m 755 -d ~/rpmbuild/{SPECS,SOURCES}         # RedHat, CentOS, Mandriva, Fedora
    install -m 755 -d /usr/src/packages/{SPECS,SOURCES}  # SuSE
    install -m 755 -d ~/RPM/{SPECS,SOURCES}              # ALTLinux

Building steps at the RPM specification file:

  1. Locate the OpenSCADA archives and the specification file in the RPM build folder (the source files are pre-located in the current directory):

    cp openscada-1+r2920.tar.xz openscada-res-1+r2920.tar.xz {RPMBuildDir}/SOURCES
    cp openscada.spec {RPMBuildDir}/SPECS

  2. Resolve of the OpenSCADA project's dependencies for building in accordance with the requirements. Arguments for the command "configure" you can specify into the file "openscada.spec".
  3. Build the packages
  - build from the beginning:

    rpmbuild -bb {RPMBuildDir}/SPECS/openscada.spec

  - only the installation and packaging from the etersoft rpm-utilities package (useful when configuring openscada.spec file):

    rpmbb -i {RPMBuildDir}/SPECS/openscada.spec

  4. Packages are ready and available in the directory "{RPMBuildDir}/RPMS" for the appropriate architecture.

Building steps for the SRPMS package:

  1. Resolve of the OpenSCADA project's dependencies for building in accordance with the requirements.
  2. Build of the packages (the source files pre-placed in the current directory):

    rpmbuild --rebuild openscada-1+r2920.src.rpm

  3. Packages are ready and available in the directory "{RPMBuildDir}/RPMS" for the appropriate architecture.

### 3.3 Gentoo — metadistribution

OpenSCADA is not included to the official portage Gentoo tree, so the building is made from the overlay. Before the building of the OpenSCADA package itself, portage will satisfy dependencies, ie build the missing packages (if necessary).

  1. Create an overlay "portage" by description of the path for an overlay tree, that is, in "/etc/make.conf" you need to write a line

    PORTDIR_OVERLAY="/usr/local/portage"

  2. Create a directory "/usr/local/portage/dev-util/openscada/", then download the ebuild archive file from the official site and unpack it in the created folder.

    cd /usr/local/portage/dev-util/openscada
    wget http://ftp.oscada.org/OpenSCADA/LTS/Gentoo/openscada-0.9.4.ebuild.tar.bz2
    tar -xvf openscada-0.9.4.ebuild.tar.bz2

  3. You must specify the portage, that OpenSCADA is allowed to build on your platform. To do this, put the following line to the file "/etc/portage/package.keywords":

    dev-util/openscada

  4. Check:

    emerge -vp openscada

    These are the packages that would be merged, in order:
    Calculating dependencies... done!
    [ebuild   R   ~] dev-util/openscada-0.9  USE="mysql ssl -bfn -blockcalc -daqgate -dbarch -dbase -dcon -demo -diamondboards -doc (-firebird)
       -flibcomplex1 -flibmath -flibsys -fsarch -http -icp_das -javalikecalc -logiclev -modbus -portaudio -qtcfg -qtstarter -selfsystem
       -serial -simens -snmp -sockets -sqlite -system -systemtest -vcaengine -vision -webcfg -webcfgd -webvision" 79,647 kB [1]

    Total: 1 package (1 reinstall), Size of downloads: 79,647 kB
    Portage tree and overlays:
     [0] /usr/portage
     [1] /usr/local/portage

  5. If you have no connection to Internet, you have to download the sources and resources tarballs from FTP/HTTP-server of the project and place them in advance in the sources directory of the portage "/usr/portage/distfiles". If you have an Internet connection, then everything that is necessary for building will be taken from the project's server automatically.
  6. It is necessary to put the required USE-flags, with which the OpenSCADA will be built. This can be done in the file "/etc/portage/package.use", for example:

    dev-util/openscada dcon demo http javalikecalc mysql qtcfg qtstarter ssl vision webcfg webcfgd webvision blockcalc dbarch dbase doc flibcomplex1 flibmath flibsys fsarch logiclev modbus serial sockets sqlite vcaengine

  7. Build:

    emerge -q openscada

  8. Database files and resources of OpenSCADA are ready and placed in the directory "/var/spool/openscada/", executable files — "/usr/bin/", documentation — "/usr/share/doc/openscada-0.9/".

### 3.4 Lightweight package management system — IPKG packages

An area of application of the package manager and packages IPKG has builtin Linux environments with limited amount of memory, such as wireless routers. Accordingly, the building of IPKG packages is a part of the build systems of such environments and the description of this procedure can not be considered separately from the build system itself, so for the creation of IPKG packages of OpenSCADA read in the section "OpenWrt distributive of the subproject OpenSCADA generic embedding and programmable logical controllers (PLC)".

### 3.5 Building for Android — APK packages

The operating system Android is a Linux-kernel based software that is primarily designed and used on mobile phones, smartphones, tablets, and other touch-screened devices. The third-party software for Android is distributed in the form of APK-packages, the building of which can not be considered apart from the build environment of the Android SDK, NDK and building of all dependencies of OpenSCADA, so read on the subject of the building of OpenSCADA and the creation of its APK-packages in the sub-project "OpenSCADA adaption to the software platform Android".

Documents/How_to/Build_from_source/en - GFDL | July 2026 | OpenSCADA 1+r3070