Installing cMsg

From New IAC Wiki
Jump to navigation Jump to search

Compiling cMsg 3-0 on Linux local host

When using scons to compile cMsg it will try to install everything under the subdirectory Linux-i686

I created a softlink to "Linux" so the cMsg binaries and libraries would go to the directory which holds my other coda programs


i then did

scons install
scons examples install

under the cMsg-3.0 subdirectory

This compiled and installed libraries and binaries.

I then tested the message sending using the program called "producer"

Producer

producer -h will output a list of commands

My "rcplatform" cMsg server runs on the DAQ computer

bin >rcplatform 
Warning: COOL_HOME does not have a required srtucture. 
Auto-create default structure? Y/N
y
Warning: Can not find clients database file.
Warning: Can not find sessions database file.
>> **** cMsg server sucessfully started at Fri Jun 11 08:19:53 MDT 2010 **** <<
**************************************************
*             Afecs-1.3 Platform                 *
**************************************************
- Name         = your_expt_msql_database_name_goes_here
- Host         = daq1.physics.isu.edu
- TCP port     = 45000
- UDP port     = 45000
- RC UDP port  = 45200
- Start time   = 2010/06/11 08:19:54
**************************************************
**************************************************
APlatform:Info Registration request from daq1.physics.isu.edu_admin agent running at daq1.physics.isu.edu
*             Afecs-1.3 Container                *
**************************************************
- Name                  = daq1.physics.isu.edu_admin
- Host                  = daq1.physics.isu.edu
- Start time            = 2010/06/11 08:19:56
- Connected to:
- Platform              = daq1.physics.isu.edu
- Platform TCP port     = 45000
- Platform UDP port     = 45000
- Platform RC UDP port  = 45200
**************************************************


producer -d -u cMsq:cMsg://daq1.physics.isu.edu:45000/cMsg -delay 1000
consumer -d -p -u cMsg:cMsg://daq1.physics.isu.edu/cMsg

Error messages

1.)

cMsgNodeSame: gethostbyname error
cMsgNodeIsLocal: error in cMsgNodeSame
CMSG_BAD_FORMAT:  one or more arguments in the wrong format
cMsgConnect: CMSG_BAD_FORMAT:  one or more arguments in the wrong format

add the hostname to the host file

135.50.3.160 gumstix-custom-verdex gumstix

now you can ping gumstix and the above error goes away because the hostname is now associated with the IP address.

2.) setup shared library environment

root@gumstix-custom-verdex:~$ producer -d -u cMsq:cMsg://daq1.physics.isu.edu:/cMsg -delay 1000
producer: error while loading shared libraries: libcmsgRegex.so: cannot open shared object file: No such file or directory
root@gumstix-custom-verdex:~$ ls cMsg/
bin  lib
root@gumstix-custom-verdex:~$ ls cMsg/lib/
libcmsg.so       libcmsgRegex.so  libcmsgxx.so
root@gumstix-custom-verdex:~$ export LD_LIBRARY_PATH ~/cMsg/lib
-sh: export: /home/root/cMsg/lib: bad variable name
root@gumstix-custom-verdex:~$ export LD_LIBRARY_PATH=~/cMsg/lib
root@gumstix-custom-verdex:~$ producer -d -u cMsq:cMsg://daq1.physics.isu.edu:/cMsg -delay 1000
Delay sec = 1, nsec = 0
Running the cMsg producer, "producer"
cMsgTcpConnect: connected to server
connectDirect: connected to name server
talkToNameServer: read subdomain handler attributes
talkToNameServer: read port and length of host from server
talkToNameServer: port = 17, host len = 33792
talkToNameServer: read host from server
talkToNameServer: read failure

Compile Native cMsg (target and compiling host are the same architecture)

cMsg can be downloaded from the CODA ftp site. The cMsg User's Guide contains useful information. Compiling cMsg requires the BMS package, which contains Makefiles.

wget -c 'ftp://ftp.jlab.org/pub/coda/BMS/BMS.tar.gz'
tar -xzf BMS.tar.gz
wget -c 'ftp://ftp.jlab.org/pub/coda/cMsg/cMsg-3.0.tar.gz'
tar -xzf cMsg-3.0.tar.gz
mv cMsg-3.0 cMsg-3.0_native

Then we define a few variables needed. If you are using CODA, you can define CODA_HOME instead of INSTALL_DIR.

export BMS_HOME=~/code/BMS
export INSTALL_DIR=~/cMsg/native

If you want 64-bit compilation, define CODA_USE64BITS. See BMS/Makefile.GNU for details.

export CODA_USE64BITS=1

Using plain make or make all doesn't work. Use make install instead.

make install

You should see the following output at the end:

Installing cmsg executables:
 /home/brian/cMsg/native/Linux-x86_64-64/bin/consumer
 /home/brian/cMsg/native/Linux-x86_64-64/bin/dummy
 /home/brian/cMsg/native/Linux-x86_64-64/bin/getConsumer
 /home/brian/cMsg/native/Linux-x86_64-64/bin/getResponder
 /home/brian/cMsg/native/Linux-x86_64-64/bin/monitor
 /home/brian/cMsg/native/Linux-x86_64-64/bin/producer
 /home/brian/cMsg/native/Linux-x86_64-64/bin/rcClient
 /home/brian/cMsg/native/Linux-x86_64-64/bin/shutdowner
 /home/brian/cMsg/native/Linux-x86_64-64/bin/cMsgStringTest
 /home/brian/cMsg/native/Linux-x86_64-64/bin/cpptest

Compile Gumstix cMsg

Omitted details can be found above. Extract to a different directory

tar -xzf cMsg-3.0.tar.gz
mv cMsg-3.0 cMsg-3.0_arm
cd cMsg-3.0_arm

Edit BMS Makefile.GNU from

CC  = gcc
CXX = g++

to

ifndef CC
  CC  = gcc
endif
ifndef CXX
  CXX = g++
endif

Set environment variables. The arm cross-compilers need to be in the path and need to have CODA_USE64BITS defined.

export PATH=$PATH:/home/brian/gumstix/gumstix-oe/tmp/cross/bin
export CODA_USE64BITS=1

export CC=arm-angstrom-linux-gnueabi-gcc
export CXX=arm-angstrom-linux-gnueabi-g++
export INSTALL_DIR=~/cMsg/arm

Again, only make install works.

make install

Check to make sure the files are the right architecture

file /home/brian/cMsg/arm/Linux-x86_64-64/bin/*
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cMsgCommand:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cMsgMonitor:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cMsgPayloadTest: ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cMsgReceive:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cMsgStringTest:  ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/consumer:        ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/cpptest:         ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/dummy:           ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/getConsumer:     ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/getResponder:    ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/monitor:         ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/producer:        ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/rcClient:        ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped
/home/brian/cMsg/arm/Linux-x86_64-64/bin/shutdowner:      ELF 32-bit LSB executable, ARM, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.14, not stripped