From OpenSCADAWiki
Jump to: navigation, search
Other languages:

Author: Roman Savochenko, Constantine

This manual made for help on OpenSCADA building from the source texts. In process of accumulation of experience of building OpenSCADA for different OS Linux distributions and others platforms generally, the document will be complemented by the features and details of the building in a variety of environments.

In the latest versions of OpenSCADA, you do not need to pre-configure the building of the program when you use the "openscada-res" package or the source texts tree from the SVN repository when you build it, even after the direct building. Therefore, immediately after the building and installation, the program is ready for use!

At.png To build OpenSCADA from the source code, you need the experience of a opensource program building, as well as basic knowledge of the Linux operating system and the used Linux distribution, which will allow you to adequately satisfy the dependencies and solve the possible building problems.

1 OpenSCADA configuration for building

The OpenSCADA project, as a build system, uses a set of utilities AutoTools. Any building of a project under the control of "AutoTools" precedes the configuration stage, and sometimes the formation of the build system, under the environment of the OS.

To create the build system, the AutoTools utility must be installed: "autoconf", "automake" and "libtool". The general formation can be done by the command $ autoreconf -if. A previously formed build system may sometimes require reformatting, for example, in the case of a significant difference in the OS environment on which the build system was formed and current! Reformation of the build system is also carried out by the previously defined formation command.

The configuration of the build system is called by the command $ configure. By defining the arguments for this command, you can enable-disable the OpenSCADA function or module. You can get the entire list of available configuration options and OpenSCADA modules by specifying the argument --help.

The enabling and disabling of OpenSCADA modules is by passing the arguments --enable-{ModName} and --disable-{ModName}. When selecting modules, you can specify "the Enable All Modules" --enable-AllModuls or "Disable All Modules" --disable-AllModuls, and then enable-disable individual modules, depending on what will be easier. Most OpenSCADA modules can be linked(embedded) directly into the OpenSCADA core library, rather than built by a separate library, which specifies the argument --enable-{ModName}=incl.

Upon completion of the configuration, a summary of the settings will be formed, by which you can check the desired configuration.

Before building, you need to define source of the source texts ftp/http server or SVN repository, and the OpenSCADA branch you will build. Since the LTS branch is automatically built for many Linux distributions, it is rarely updated and its version changes with the release of the new LTS, then in this manual we will consider a building of the work branch (Work) which, in turn, is automatically built for a limited circle of Linux distributions, often changes and its address always the same. Building of LTS branches, as a rule, is carried out in the same way and in the instructions it is necessary to replace the "Work" with the version of LTS and change the name of the package of the source texts. In general, the names of packages and folders should be treated carefully, because they, from version to version, may differ!

2 Direct building of OpenSCADA

The building should be performed from the name of the ordinary user, although it can be from the superuser for isolated environments. This will consider the variants of installation and execution both globally — in the system and locally — in the user's directory. We accept the login(account) of the user — "user".

Entering as an ordinary user and replacing the "user" account with your account, considering the installation method (global or local) and follow the instructions:

Steps of preparation of the source tree to build:

1. Make directory for the project building:
$ mkdir ~/projects; cd ~/projects
2. Download sources package. It may be made from two ways:
$ wget http://ftp.oscada.org/OpenSCADA/Work/openscada-0.9+r2537.tar.xz
$ wget http://ftp.oscada.org/OpenSCADA/Work/openscada-res-0.9+r2537.tar.xz
$ tar -xvf openscada-0.9+r2537.tar.xz
$ cd openscada-0.9+r2537
$ tar -xvf ../openscada-res-0.9+r2537.tar.xz
  • 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. Generate of the build system, when download from the SVN-repository:
$ autoreconf -ivf

Steps of the global building:

1. Configuring the build system of OpenSCADA:
$ ./configure
2. Make OpenSCADA:
$ make
3. Install OpenSCADA:
$ su; make install
5. The program ready to start up:
$ exit; openscada

Steps of the local building:

1. Configuring the build system of OpenSCADA:
$ mkdir ~/OScadaW; ./configure --prefix=/home/user/OScadaW
2. Make OpenSCADA:
$ make
3. Install OpenSCADA:
$ make install
4. The program ready to start up:
$ cd ~/OScadaW/bin; ./openscada

3 Building of OpenSCADA packages for the Linux distribution

3.1 RedHat-based distributions — RPM packages

To build 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 an 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 of RPM packages takes place in a directory with a special structure that is usually created when installing the appropriate distribution package (for example: 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 of RPM Packages of different distributions:

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

$ install -m 755 -d Distribution directory/{SPECS,SOURCES}

Building steps at the RPM specification file:

1. Locating the OpenSCADA archives and the specification file in the RPM build folder (the source files are pre-located in the current directory):
$ cp openscada-0.9+r2537.tar.xz openscada-res-0.9+r2537.tar.xz Distribution directory/SOURCES
$ cp openscada.spec Distribution directory/SPECS
2. Resolving 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 packages
  • build from the beginning:
$ rpmbuild -bb Distribution directory/SPECS/openscada.spec
  • only the installation and packaging from the etersoft rpm-utilities package (useful when configuring openscada.spec file):
$ rpmbb -i Distribution directory/SPECS/openscada.spec
4. Packages are ready and available in the directory: Distribution directory/RPMS for the appropriate architecture.

Building steps for the SRPMS package:

1. Resolving of the OpenSCADA project's dependencies for building in accordance with the requirements.
2. Building of the packages (the source files pre-placed in the current directory):
$ rpmbuild --rebuild openscada-0.9+r2537.src.rpm
3. Packages are ready and available in the directory Distribution directory/RPMS for the appropriate architecture.

3.2 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. Creation a directory to build the program:
$ mkdir ~/build; cd ~/build
2. Download sources package. It may be made from two ways:
$ wget http://ftp.oscada.org/OpenSCADA/Work/openscada-0.9+r2537.tar.xz
$ wget http://ftp.oscada.org/OpenSCADA/Work/openscada-res-0.9+r2537.tar.xz
$ tar -xvf openscada-0.9+r2537.tar.xz
$ cd openscada-0.9+r2537
$ tar -xvf ../openscada-res-0.9+r2537.tar.xz
  • 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.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. Creating an overlay "portage" goes down to the 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/Work/Gentoo/openscada.0.9-ebuild.tar.gz
$ tar -xzf openscada.0.9-ebuild.tar.gz
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 don't have connection to the 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. Directly building:
$ 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 built-in 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)".

4 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 a 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".