Setting up a new development environment

From Robotic Agriculture Data Acquisition
Jump to: navigation, search

In order to set up a development environment for Eris (the ground robot for our senior design team), there are many steps that must be followed. It is recommended that the person following this guide has knowledge with linux because many things could go wrong.

Take note that we have only ever set up dev environments on red hat based systems (red hat and fedora), so this guide may not be portable to other operating systems.

If there is an issue, check the Known Errors section and hope that we ran into the same issue at some point in time. Google is your best friend; many of the issues I had when setting things up were solved by googling the issue (and lots of reading).

Installing Dependencies

Quick Installs

There are 8 main dependencies to the executable used to run our ground robot. These dependencies must be installed as the 32 bit version. When you use yum to install the dependency (as you see directly below here), it will list out the package install. If the install ends with a .i686, then the 32 bit version was installed. If it lists .x86_64, then the 64 bit version was installed. In order to install the 32 bit version, try calling yum install on the library it displayed, but replace the .x86_64 with .i686

These first dependencies can be installed using yum (sudo yum install ....)

sudo yum install librt.so.1
sudo yum install libdl.so.2
sudo yum install libstdc++
sudo yum install libm.so.6
sudo yum install libgcc_s.so.1
sudo yum install libc.so.6
sudo yum install libpthread.so.0
sudo yum install ld-linux.so.2

Manual Installation

These dependencies must be installed manually, but if you follow the steps, there should be no issue

libconfig.so.6

libconfig.so.6 is an out of date library, but it is required for this codebase. Hopefully we can add support for the newer versions eventually.


  1. sudo yum install libconfig-devel
  2. Get the tar file "libconfig-1.3.1.tar.gz" from the git repository "omnicoor/4-software/Dependencies/libconfig-1.3.1.tar.gz"
  3. Unzpip the tar using "tar -zxvf libconfig-1.3.1.tar.gz"
  4. cd libconfig-1.3.1
  5. ./configure --prefix=/usr/local/ --host=i686-linux "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32"
  6. make
  7. sudo make install

Notes:

  • If the zip cannot be found in git, you can find it online through a google search
  • When running ./configure:
    • --prefix=/usr/local/ specifies the install location
    • --host=i686-linux specifies that we are cross compiling for a 32-bit machine
    • "CFLAGS=-m32" "CXXFLAGS=-m32" "LDFLAGS=-m32" sets the compiler flag "-m32" so that the code is compiled as 32 bit

VRPN

VRPN is required for communication with the camera system.

Locate zip file

Locate the zipped file in the Omnicoor git: omnicoor/4-Software/Dependencies/vrpn_07_31.zip - This zip is the one we are running on Eris as of Spring 2015, and we downloaded it directly from: http://www.cs.unc.edu/Research/vrpn/obtaining_vrpn.html

Check the configuration

Check contents of vrpn_Configure.h - not sure what you are looking for, but it told me to do this step

Compile quaternion libraries

1. cd into the quat directory

2. Open the Makefile and make the following changes

a) Specify the architecture we are using by uncommenting this line:

HW_OS := pc_linux_ia64

b) In order to compile the code for a 32 bit machine, change the following code from:

ifeq ($(HW_OS), pc_linux_ia64)
endif

to:

ifeq ($(HW_OS), pc_linux_ia64)
    CC = gcc -m32
endif

3. Run make in the quat directory

Compile vrpn libraries

1. cd into the top level directory

2. Open the Makefile and make the following changes

a) Specify the architecture we are using by uncommenting this line:

HW_OS := pc_linux_ia64

b) In order to compile the code for a 32 bit machine, change the following code from:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := gcc
    RANLIB := ranlib
endif

to:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := gcc -m32
    RANLIB := ranlib
endif

c) Note: phjones thinks there was a omission in the Makefile and the pc_linux_ia64 was left out by accident. He changed the following code (found at approximately line 807) from:

ifeq ($(HW_OS), pc_linux64)
    SLIB_FILES += vrpn_DevInput.C
    SLIB_INCLUDES += vrpn_DevInput.h
endif

ifeq ($(HW_OS), pc_linux)
    SLIB_FILES += vrpn_DevInput.C
    SLIB_INCLUDES += vrpn_DevInput.h
endif

to:

ifeq ($(HW_OS), pc_linux64)
    SLIB_FILES += vrpn_DevInput.C
    SLIB_INCLUDES += vrpn_DevInput.h
endif

# phjones (phjones@iastate.edu) added ia64.  I think it was
# mistakenly left out.  Without this the sever_src directory
# throws an error about undefined DevInput
ifeq ($(HW_OS), pc_linux_ia64)
    SLIB_FILES += vrpn_DevInput.C
    SLIB_INCLUDES += vrpn_DevInput.h
endif

ifeq ($(HW_OS), pc_linux)
    SLIB_FILES += vrpn_DevInput.C
    SLIB_INCLUDES += vrpn_DevInput.h
endif

3. Run make in the top level directory.

Client code

1. cd into the client_src directory

2. Open the Makefile and make the following changes

a) Specify the architecture we are using by uncommenting this line:

HW_OS := pc_linux_ia64

b) In order to compile the code for a 32 bit machine, change the following code from:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := g++
endif

to:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := g++ -m32
endif

3. Run make in the client_src directory

Server code

1. cd into the server_src directory

2. Open the Makefile and make the following changes

a) Specify the architecture we are using by uncommenting this line:

HW_OS := pc_linux_ia64

b) In order to compile the code for a 32 bit machine, change the following code from:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := g++
    SYSLIBS := 
endif

to:

ifeq ($(HW_OS), pc_linux_ia64)
    CC := g++ -m32
    SYSLIBS := 
endif

3. Run make in the server_src directory

Installing the libraries

1. Copy the following .a files (archived libraries) into /usr/local/lib

vrpn/pc_linux_ia64/libvrpn.a
vrpn/pc_linux_ia64/libvrpnatmel.a
vrpn/pc_linux_ia64/libvrpngpsnmea.a
vrpn/pc_linux_ia64/libvrpnserver.a
    sudo cp vrpn/pc_linux_ia64/libvrpn*.a /usr/local/lib

vrpn/quat/pc_linux_ia64/libquat.a
    sudo cp vrpn/quat/pc_linux_ia64/libquat.a /usr/local/lib

2. Copy ALL the header files from the top level vrpn directory into /usr/local/include

sudo cp vrpn/*.h /usr/local/include

3. Copy quat.h from vrpn/quat/ into /usr/local/include

sudo cp vrpn/quat/quat.h /usr/local/include

4. Make sure to use the -lquat and -lvrpn flags when compiling

Create "/home/shared/MainProject" directory

This can be done by simply typing this command:

sudo mkdir /home/shared/MainProject

Compiling Eris Code

This should be as simple as typing the following commands:

./configure
make

There may be an error regarding a missing file or the makefile configuration is incorrect. If this happens, you may be able to solve it by running the following commands:

automake --add-missing
make clean
./configure
make
autoreconf

Known Issues

Missing libconfig.h

Problem

When the library libconfig-1.3.1 is not installed, this error is found:

configuration.cpp:2:23: error: libconfig.h: No such file or directory

Solution

Follow the steps in the libconfig.so.6 section

Updating VRPN

Problem

vrpn_07.33 is the newest vrpn version at the time I wrote this readme, but I could not get it to work.

Solution

Use vrpn_07.31 because we know it works for our purpose, and we can get it to compile.

VRPN server_src compile error

Problem

If there is a compilation error on the server_src directory of vrpn, it is likely that the issue was an error in editing the main vrpn makefile.

Solution

Double check that you completed step 2.c in the Compile vrpn libraries section.