Installing cMsg

From New IAC Wiki
Jump to navigation Jump to search

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