You are here: Foswiki>Frontend Web>Frontend>CmwRda3Setup (03 Sep 2013, VitaliyRapp)Edit Attach

How to set up and use the RDA3 libraries locally

About

The RDA3 libraries are presented in two native forms the C++ libraries and the Java libraries. The implementation of both of them is similar and they also offer identical API. At the current development state (02.09.2013) the major part of the public API for Java implementation if finished. The client part of the C++ implementation, however, is still missing. In the majority of cases the client part will be implemented in Java (JAPC), while the server part will use the C++ version (FESA).

The described C++ part also includes a tools project which contain a simple RDA3 (RDA3DataServer.cpp) server which can be started locally and used for multiple test purposed, the rda3 project itself also contains a very basic test server (TestServer.cpp) which can be a very useful starting point if you new to RDA3. For the first steps in RDA3 a plenty of code is available within the RDA3 projects, which demonstrate the usage of new RDA libraries.

Ready to use C++ Libs

If for some reason you don't want, can't build the C++ libraries, you can use of the development releases, which I build. Since the releases are not official I just put the ready to use libraries into my local folder, which however can be easily accessed from the acc development machines. The build release also contains all necessary 3rd party libs like boost and zeromq. The idea behind is that you can just download the -tools project and use the provided RDA3DeviceServer without having to build everything by your own. The provided libraries should be quite stable, but not necessary the latest. Attached you can also find makefile.dep which can be used to compile and link project using both RDA2 and RDA3 simultaneously

The libs are located here: asl730://home/bel/rapp/lnx/CMW/CMW-Libs/RDA3-DEV
CMW-RDA3-Components.png

Compiling and bulding C++ Part

3rd Party Libraries

The RDA3 Library currently has 2 dependencies to 3rd party libraries: boost and zeroMQ.

The boost libraries can be downloaded here. Just download the tar.bz2 and follow the insturctions from here to install the libraries localy (using --prefix=<local path>).

The zeroMQ can be downloaded from here. Install the zeroMQ to your local folder using the --prefix=<local path> option with autoconfigure. Additionaly a C++ binding is required. Just put the zmq.hpp file into the include folder of the zeroMQ installation. If you also want to use Java download and install the Java binding as well.
Commonbuild

At CERN the projects are usually build using the CERN-Commonbuild system, which is an in-house Makefile/Ant based build system. The commonbuild system is not adopted by GSI, but the according scripts may still be used. Currently there is no proven and official solution how to use the build scripts here. The presented solution is not the ultimate answer for this, and hence should be used only for local builds. Also the commonbuild is the continues deployment, so the instruction may not work.

To get the commonbuild scripts follow the instruction:

1. Check out the cpp-makefile-generic project from https://svn.cern.ch/reps/acc-co/trunk/devops

2. Make a copy of Make.common.maven and rename it into Make.common

3. Edit the line in the new Make.common from:
ifndef CPU
    CPU=ppc4
endif

to
ifndef CPU
    CPU=x86_64
endif

4. Add following lines to Make.common:
#========================================================================
# Linux 32bit
#========================================================================
ifeq ($(CPU),i686)
    CC+=-m32 -pipe
    CXX+=-m32 -pipe
endif

5. Edit the variables COMMON_MAKE_FILE and CPP_DOXYFILE pointing them to the local path of the project.

6. Check out the cmw-common-make project from: https://svn.cern.ch/reps/acc-co/trunk/cmw/cmw-common-make

7. Edit the variables COMMON_MAKE_PATH and CPP_DOXYFILE pointing them to the local path of the project.
Building the CMW projects

The CMW libraries can be found in the CERN repository: https://svn.cern.ch/reps/acc-co/trunk/cmw.

The list of the required projects can be found in the figure above. C++ projects can be usually distinguished from java ones by the suffix -cpp in the project name. To buid a project you need to do following:

1. Checkout the desired project from CERN SVN

2. Convert it to a C++ Makefileproject (Eclipse - Right click -> New -> Other -> C/C++ -> Convert to a C/C++ Project)

3. Modify the Makefile of the project pointing the MAKE_CONF to the local Make.cmw and modifying the include to point to the local Make.generic. Also set the required CPU (i686 or x86_64)

4. Modify the Makefie.dep file to point to the local installations and build directories

5. Add following targets from the Make Target View: clean, compile, demo (optional also test and run-test)

6. Execute compile target

The local build is located in <path to your workspace>/<project-name>/build
Building the cmw-tools-cpp

The cmw-tools-cpp project contains a RDA3DataServer, which may useful for testing purposes. The project itself however contains some components which are run by using the old rda2 library and hence it contains makefiles (Makefile.dep) in particular, which can be used as a reference for such kind of projects.

The building of the project is similar to projects described above. However the projects Makefile.dep is by default set to released version of the rda3 and 2 libraries. Additionaly the project contains a Makefile-dev.dep file, where all single rda3 project dependencies are listed separately.

To run the Servers you need to set the CMW_DIRECTORY_LIST environment variable to desired naming server (don't forget a semicolon at the end of the address), e.g.

CMW_DIRECTORY_LIST=fcmw00a.acc.gsi.de:5021;

After finishing all steps above you should be able to run the RDA3DataServer

Compiling and bulding Java Part

Simmilar to the C++ Part CERN uses its own in-house build tool coomonbuild to build the Java projects, which is not available at GSI. The approach presented below is based on adding to the CERN projects a maven nature and building them into the local repository and hance making them available to use as dependency in other builds.
3rd Party Libraries

To compile and run the java part of RDA3 a local instalaition of zeroMQ is required (see C++ chapter above). Additionaly you need to download and install a java binding for zeroMQ. The binding and the installation instruction can be found here.
Convert projects to maven and compile them

To build the RDA3 projects check them from the repository and add a maven nature to them (Right click -> Configure -> Convert to Maven Project). In some cases the pom file is already provided, but still need to be modified.

After the project is converted edit its pom.xml. Use the following parent:
<parent>
   <groupId>de.gsi.cs.co</groupId>
   <artifactId>csco-parent</artifactId>
   <version>1.0.6</version>
</parent>

Since the projects usually don't follow the maven conventions over source directories add following to the pom file (modify the source directories according to the project):
<build>
    <sourceDirectory>src/java</sourceDirectory>
    <testSourceDirectory>src/test</testSourceDirectory>
    <testResources>
        <testResource>
            <directory>src/test</directory>
        </testResource>
    </testResources>
</build>

The overview of the external dependencies for each individual project can be found in the build.xml file. Those need to be listed in the dependencies section of the pom file. For the CERN dependencies to non-rda3 project you can replace the groupId with cmmnbuild and let maven resolve if from the artifactory. Optionally you can modify the product version to distinguish them from the CERN originals. An example of pom for the rda3 project is attached.

After modifying the pom.xml you can run the maven-install to build the project and locate the according .jar file in your local maven repository. Afterward the project can be used in other dependencies.
Run the demo and test client

The cmw-rda3 project contains some demo and test clients, which are located in the cern.cmw.rda3.demo package. To run the tests the classpath must contain the java binding library. It can be add as an addtional classpath variable (Window -> Preferences -> Java -> Build Path -> Classpath Variables), e.g.
JZMQ_HOME = <your local path here>/jzmq/lib/

To run the rda3 tests it is also required to set the java.library.path variable, which can be done using the VM argumetns in the Run Configurations menu.
-Djava.library.path=<your local path here>/jzmq/lib
I Attachment Action Size DateSorted ascending Who Comment
CMW-RDA3-Components.pngpng CMW-RDA3-Components.png manage 33 K 03 Sep 2013 - 07:54 VitaliyRapp Current dependency tree of RDA3 project
pom.xmlxml pom.xml manage 2 K 03 Sep 2013 - 15:58 VitaliyRapp pom.xml of the modified cmw-rda3 project
Topic revision: r6 - 03 Sep 2013, VitaliyRapp
This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Foswiki? Send feedback