Building the library and the examples
libiec61850 supports two different build systems. The traditional make based system that works good with a GNU based toolchain, and the cmake based system. With the cmake based build system it is also possible to perform builds with Visual Studio or other toolchains especially for the Windows platform. Up to now the make based system is required to cross-compile for embedded linux systems.
In the past the examples have been tested on the following platforms:
- Linux/PPC (iBook with LinuxMintPPC)
- Linux/MIPS32 (Carambola board)
- Linux/ARM (BeagleBone – Cortex-A9, Raspberry Pi – ARM11)
- ucLinux/ARM7 (Wago Linux Fieldbus coupler)
- Windows 7/MinGW
- Windows 7/VisualStudio 2010/2012
- Mac OS X 10.9
We regularly test the library on the following platforms:
- Linux/x86 and Linux/arm64
- Raspberry Pi
- Windows 10/11/Visual Studio 2019
Building with Visual Studio
To build with the Visual Studio tools the program cmake (http://www.cmake.org/) is required. Download and install the tool. In the dialog “Install Options” select one of “Add CMake to the system PATH” options. Then you can easily invoke cmake from the command line. Otherwise you have to use the GUI tool that comes bundled with the Windows version of cmake.
If you have cmake installed fire up a command line (cmd.exe) and create a new subdirectory in the libiec61850-0.x folder. Change to this subdirectory. Then you can invoke cmake. As a command line argument you have to supply a “generator” that is used by cmake to create the project file for the actual build tool (in our case Visual Studio).
cmake -G "Visual Studio 11" ..
will instruct cmake to create a “solution” for Visual Studio 2012. To do the same thing for Visual Studio 2010 type
cmake -G "Visual Studio 10" ..
for Visual Studio 2015:
cmake -G "Visual Studio 14 2015" ..
and for Visual Studio 2017:
cmake -G "Visual Studio 15 2017" ..
Note: The “..” at the end of the command line tells cmake where to find the main build script file (called CMakeLists.txt). This should point to the folder libiec61850-0.x which is in our case the parent directory (..).
You will find a solution file and projects files in the folder you executed cmake. You can open the solution in Visual Studio and you will see a few projects. For every example in the examples directory you will find a Visual Studio project. The project “iec61850” will build a static library that is required by the example projects. The project “iec61850-shared” will build a DLL that exposes the functions of libiec61850. You can also use the “msbuild” tool coming with Visual Studio to invoke builds on the command line.
Building the library with the make based system
To build the library on a Linux platform you can simply execute
make in the main folder of the source distribution. It is assumed that a GCC toolchain and the Make tool is installed. To cross-compile for another platform you can specify the TARGET variable when executing make. To cross-compile for Windows you can call
make TARGET=WIN32. To cross-compile for ARM Linux you can call
make TARGET=LINUX-ARM. It is assumed that a proper GCC cross-compiler toolchain (like MinGW or arm-linux-gcc) is installed. Probably you need to adjust the toolchain prefix variables in the file
make/target_system.mk. You can also build on a Windows plattform if you have MinGW (http://www.mingw.org/) installed.
Building the library with GOOSE support for Windows
To build the library and run libiec61850 applications with GOOSE support on Windows (7/8) the use of a third-party library (winpcap) is required. This is necessary because current versions of Windows have no working support for raw sockets. You can download winpcap here (http://www.winpcap.org).
- Download and install winpcap. Make sure that the winpcap driver is loaded at boot time (you can choose this option at the last screen of the winpcap installer).
- Reboot the system (you can do this also later, but you need to reboot or load the winpcap driver before running any libiec61850 applications that use GOOSE).
- Download the winpcap developers pack from here (http://www.winpcap.org/install/bin/WpdPack_4_1_2.zip)
- Unpack the zip file. Copy the folders
Includefrom the WpdPack directory in the
third_party/winpcapdirectory of libiec61850
- Follow the instructions to build the library with
Building the examples with make
On a linux or windows system with MinGW installed just enter the libiec61850 directory and type
This will build the examples for the host environment (currently Linux or Windows with MinGW). To test the server examples you can use the client examples. You can also use third-party tools like Omicron IEDScout or the openIEC61850 client example to test the examples.
You can cross-compile for Windows on a Ubuntu system by installing the Ubuntu package mingw32 and starting the build with the TARGET=WIN32 option:
Running the examples
On Windows you can simply start the .exe files. For the server examples you need to confirm that the application can accept incoming network connections.
In Linux the server examples have to be started as root since they require to bind to the default MMS port 102 and Linux allows this only for programs running with root permissions. You can start the server examples on a ubuntu system or similar linux system with:
You can also avoid running a server as root by using linux capabilites. Linux capabilites are file based and allows specific program files to do tasks that otherwise would require root permissions. You can give the above example the right to bind to ports below 1024 with the following command:
sudo setcap 'cap_net_bind_service=+ep' server_example1
Afterwards the server can start without root permissions.
Note: You need to execute this command each time you rebuild the server application.