Project

General

Profile

training_demo.rst

Jose Maria Gomez, 19.12.2022 11:51

 
1
MARTe2 Training Demo Repository
2
===============================
3

    
4
Setting up environment 
5
----------------------
6

    
7
It is assumed that a clean CentOS 7 installation is being used (https://www.centos.org/download/).
8
Alternatively, there is also a Dockerfile available (see below).
9

    
10
Download all the needed software
11
--------------------------------
12

    
13
Open a terminal, install epel repository and update the distribution: ::
14
    yum -y install epel-release
15
    yum -y update
16

    
17
Install git: ::
18

    
19
    yum -y install git
20

    
21
Install all the standard development tools, the cmake3 compiler and octave: ::
22

    
23
    yum -y groups install "Development Tools"
24
    yum -y install wget cmake3 octave libxml2 libxml2-devel bc
25

    
26
Solve dependencies for MARTe2 and EPICS:  ::
27

    
28
    yum -y install ncurses-devel readline-devel
29

    
30
Install Python and Perl Parse utilities for open62541: ::
31

    
32
    yum -y install python-dateutil python-six perl-ExtUtils-ParseXS
33

    
34
Install MDSplus ::
35

    
36
    yum -y install http://www.mdsplus.org/dist/el7/stable/RPMS/noarch/mdsplus-repo-7.50-0.el7.noarch.rpm
37
    yum -y install mdsplus-kernel* mdsplus-java* mdsplus-python* mdsplus-devel*
38

    
39
Create a folder named Projects and clone MARTe2 Core,  MARTe2 components and the MARTe2 demos: ::
40

    
41
    mkdir ~/Projects
42
    cd ~/Projects
43
    git clone https://vcis-gitlab.f4e.europa.eu/aneto/MARTe2.git MARTe2-dev
44
    git clone -b \master https://vcis-gitlab.f4e.europa.eu/aneto/MARTe2-components.git
45
    git clone https://vcis-gitlab.f4e.europa.eu/aneto/MARTe2-demos-padova.git
46

    
47
Download EPICS R70.2: ::
48

    
49
    git clone -b R7.0.2 --recursive https://github.com/epics-base/epics-base.git epics-base-7.0.2
50

    
51
Clone open62541 v1.0 library: ::
52

    
53
    git clone -b 1.0 https://github.com/open62541/open62541.git
54

    
55
Download SDN: ::
56

    
57
    wget https://vcis-gitlab.f4e.europa.eu/aneto/MARTe2-demos-padova/raw/develop/Other/SDN_1.0.12_nonCCS.tar.gz
58
    tar zxvf SDN_1.0.12_nonCCS.tar.gz
59

    
60
Building libraries and frameworks
61
---------------------------------
62
Build Open623541:
63
    
64

    
65
    cd ~/Projects/open62541
66

    
67
    Open the CMakeLists.txt file and comment the lines marked with # below
68
        if("${CMAKE_VERSION}" VERSION_GREATER 3.9)
69
            cmake_policy(SET CMP0069 NEW) # needed as long as required cmake < 3.9
70
            #include(CheckIPOSupported)
71
            #check_ipo_supported(RESULT CC_HAS_IPO) # Inter Procedural Optimization / Link Time Optimization (should be same as -flto)
72
            #if(CC_HAS_IPO)
73
            #    set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
74
            #endif()
75
        endif()
76

    
77
    Start building the open62541 library: ::
78

    
79
    mkdir ~/Projects/open62541/build
80
    cd ~/Projects/open62541/build
81
    cmake3 -DUA_ENABLE_AMALGAMATION=ON ..
82
    make
83

    
84
Compile EPICS: ::
85

    
86
    cd ~/Projects/epics-base-7.0.2
87
    echo "OP_SYS_CXXFLAGS += -std=c++11" >> configure/os/CONFIG_SITE.linux-x86_64.Common
88
    make
89

    
90
Compile SDN: ::
91

    
92
    cd ~/Projects/SDN_1.0.12_nonCCS
93
    make
94

    
95
Docker (optional) 
96
-----------------
97

    
98
In the root folder of this project there is a Dockerfile which includes all the demo dependencies. ::
99

    
100
    cd ~/Projects/MARTe2-demos-padova
101
    docker build -t <DOCKER_IMAGE> .
102

    
103
For instance, you can use "docker build -t marte2-demos-padova/centos:7 ."
104
Note that you need to map your local Projects directory with the /root/Projects directory in the container.
105
Also, the docker daemon needs to be running.
106

    
107
To execute the image with your host folder mapped into the container, run: ::
108
    
109
    docker run -it -e DISPLAY=$DISPLAY -w /root/Projects -v ~/Projects:/root/Projects:Z -v /tmp/.X11-unix:/tmp/.X11-unix <DOCKER_IMAGE>
110

    
111
Following the previous example, the command should be "docker run -it -e DISPLAY=$DISPLAY -w /root/Projects -v ~/Projects:/root/Projects:Z -v /tmp/.X11-unix:/tmp/.X11-unix marte2-demos-padova/centos:7"
112
where <DOCKER_IMAGE> is the name of the image in the form [REPOSITORY]:[TAG]. For instance, "docker.io/centos:7"
113

    
114
Compilings the MARTe and the examples
115
-------------------------------------
116

    
117
Make sure that all the environment variables are correctly exported. ::
118
    
119
    export MARTe2_DIR=~/Projects/MARTe2-dev
120
    export MARTe2_Components_DIR=~/Projects/MARTe2-components
121
    export OPEN62541_DIR=~/Projects/open62541
122
    export OPEN62541_LIB=~/Projects/open62541/build/bin
123
    export OPEN62541_INCLUDE=~/Projects/open62541/build
124
    export EPICS_BASE=~/Projects/epics-base-7.0.2
125
    export EPICSPVA=~/Projects/epics-base-7.0.2
126
    export EPICS_HOST_ARCH=linux-x86_64
127
    export PATH=$PATH:$EPICS_BASE/bin/$EPICS_HOST_ARCH
128
    export SDN_CORE_INCLUDE_DIR=~/Projects/SDN_1.0.12_nonCCS/src/main/c++/include/
129
    export SDN_CORE_LIBRARY_DIR=~/Projects/SDN_1.0.12_nonCCS/target/lib/
130
    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MARTe2_DIR/Build/x86-linux/Core/:$EPICS_BASE/lib/$EPICS_HOST_ARCH:$SDN_CORE_LIBRARY_DIR
131
    cd ~/Projects/MARTe2-dev
132
    make -f Makefile.linux
133
    cd ~/Projects/MARTe2-components
134
    make -f Makefile.linux
135
    cd ~/Projects/MARTe2-demos-padova
136
    make -f Makefile.x86-linux
137

    
138
Disable firewall rules (otherwise the communication with EPICS may not work): ::
139

    
140
    iptable -F
141

    
142
Export all variables permanently (assumes that the relative paths above were used!). ::
143

    
144
    cp marte2-exports.sh /etc/profile.d/