Thursday, June 9, 2011

(How not to) Install IT++ and USRP

Let us start with a rhetorical question: Why is installing anything from source code so complicated?

With that in mind, this post goes about documenting my experience of trying to install the C++ communication library IT++ found here. Why am I installing it? Just to see what it can do and to see if it is easy to use. I am exploring the possibility of a IT++ plus UHD USRP software radio. Why am I taking this approach over GNU Radio? Go and try sending a short packet at a particular moment in time using GNU Radio, and then tell me how you did it and then and only then I'll tell you why :).

After downloading and unpacking the archive into a local directory, one has to first install prerequisites. The prerequisites are blas, lapack, fftw3, gfortran-4.4 and perhaps some others. Those can be installed using an "sudo aptget install " command. Now come the tricky parts. 


xyz@ubuntu-laptop:~/work/itpp-4.2$ ./configure --with-blas=atlas --with-lapack=atlas --with-fft=fftw3
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking build system type... i686-pc-linux-gnu
checking host system type... i686-pc-linux-gnu
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking for style of include used by make... GNU
checking dependency style of g++... gcc3
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU Fortran 77 compiler... yes
checking whether /usr/bin/gfortran-4.4 accepts -g... yes
checking for gcc... gcc
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for ar... ar
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking how to run the C preprocessor... gcc -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking whether we are using the GNU C++ compiler... (cached) yes
checking whether g++ accepts -g... (cached) yes
checking dependency style of g++... (cached) gcc3
checking how to run the C++ preprocessor... g++ -E
checking whether we are using the GNU Fortran 77 compiler... (cached) yes
checking whether /usr/bin/gfortran-4.4 accepts -g... (cached) yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for ld used by g++... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking for g++ option to produce PIC... -fPIC -DPIC
checking if g++ PIC flag -fPIC -DPIC works... yes
checking if g++ static flag -static works... yes
checking if g++ supports -c -o file.o... yes
checking if g++ supports -c -o file.o... (cached) yes
checking whether the g++ linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... no
checking for /usr/bin/gfortran-4.4 option to produce PIC... -fPIC
checking if /usr/bin/gfortran-4.4 PIC flag -fPIC works... yes
checking if /usr/bin/gfortran-4.4 static flag -static works... yes
checking if /usr/bin/gfortran-4.4 supports -c -o file.o... yes
checking if /usr/bin/gfortran-4.4 supports -c -o file.o... (cached) yes
checking whether the /usr/bin/gfortran-4.4 linker (/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether ln -s works... yes
checking for a sed that does not truncate output... (cached) /bin/sed
checking whether to use explicit library dependencies... no
checking for doxygen... yes
checking for latex... yes
checking for dvips... yes
checking for gs... yes
checking for perl... /usr/bin/perl
checking for gdiff... no
checking for gnudiff... no
checking for diff... /usr/bin/diff
checking whether time.h and sys/time.h may both be included... yes
checking cmath usability... yes
checking cmath presence... yes
checking for cmath... yes
checking complex usability... yes
checking complex presence... yes
checking for complex... yes
checking ieeefp.h usability... no
checking ieeefp.h presence... no
checking for ieeefp.h... no
checking whether signgam is declared... yes
checking whether isfinite is declared... no
checking whether isinf is declared... yes
checking whether isnan is declared... yes
checking for std::isfinite... yes
checking for std::isinf... yes
checking for std::isnan... yes
checking for asinh... yes
checking for acosh... yes
checking for atanh... yes
checking for cbrt... yes
checking for erf... yes
checking for erfc... yes
checking for expm1... yes
checking for finite... yes
checking for fpclass... no
checking for isfinite... no
checking for isinf... yes
checking for isnan... yes
checking for lgamma... yes
checking for log1p... yes
checking for log2... yes
checking for rint... yes
checking for tgamma... yes
checking how to get verbose linking output from /usr/bin/gfortran-4.4... -v
checking for Fortran 77 libraries of /usr/bin/gfortran-4.4...  -L/usr/lib/sse -L/usr/lib/gcc/i486-linux-gnu/4.4.3 -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../../../lib -L/lib/../lib -L/usr/lib/../lib -L/usr/lib/gcc/i486-linux-gnu/4.4.3/../../.. -L/usr/lib/i486-linux-gnu -lgfortranbegin -lgfortran -lm
checking for dummy main to link with Fortran 77 libraries... none
checking for Fortran 77 name-mangling scheme... lower case, underscore, no extra underscore
checking for sgemm_ in -latlas... no
checking for sgemm_ in -latlas -lgfortranbegin -lgfortran -lm... no
checking for sgemm_ in -lmkl_core... no
checking for dgemm_ in -lmkl_core... no
checking for sgemm_ in -lacml... no
checking for sgemm_ in -lacml_mp... no
checking for dgemm_ in -lacml... no
checking for dgemm_ in -lacml_mp... no
checking for ATL_xerbla in -latlas... yes
checking for sgemm_ in -lf77blas... yes
checking for cblas_dgemm in -lcblas... yes
checking for cheev_ in -latlas... no
checking for cheev_... no
checking for cheev_ in -lmkl_lapack32... no
checking for cheev_ in -lmkl_lapack... no
checking for cheev_ in -llapack... yes
checking for DftiComputeForward in -lfftw3... no
checking for zfft1dx in -lfftw3... no
checking for fftw_plan_dft_1d in -lfftw3... yes
checking fftw3.h usability... yes
checking fftw3.h presence... yes
checking for fftw3.h... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating itpp/Makefile
config.status: creating itpp/base/Makefile
config.status: creating itpp/base/algebra/Makefile
config.status: creating itpp/base/bessel/Makefile
config.status: creating itpp/base/math/Makefile
config.status: creating itpp/comm/Makefile
config.status: creating itpp/fixed/Makefile
config.status: creating itpp/optim/Makefile
config.status: creating itpp/protocol/Makefile
config.status: creating itpp/signal/Makefile
config.status: creating itpp/srccode/Makefile
config.status: creating itpp/stat/Makefile
config.status: creating doc/Makefile
config.status: creating doc/images/Makefile
config.status: creating doc/tutorial/Makefile
config.status: creating doc/tutorial/src/Makefile
config.status: creating doc/local/Makefile
config.status: creating doc/local/index.doc
config.status: creating doc/doxygen_html.cfg
config.status: creating extras/Makefile
config.status: creating tests/Makefile
config.status: creating win32/Makefile
config.status: creating win32/itpp_acml_tests/Makefile
config.status: creating win32/itpp_mkl_tests/Makefile
config.status: creating itpp.pc
config.status: creating itpp_debug.pc
config.status: creating itpp-config
config.status: creating itpp/config.h
config.status: executing depfiles commands
config.status: executing libtool commands
configure: displaying configuration summary

------------------------------------------------------------------------------
itpp-4.2 library configuration:
------------------------------------------------------------------------------

Directories:
  - prefix ......... : /usr/local
  - exec_prefix .... : ${prefix}
  - includedir ..... : ${prefix}/include
  - libdir ......... : ${exec_prefix}/lib
  - datarootdir .... : ${prefix}/share
  - docdir ......... : ${datarootdir}/doc/${PACKAGE_TARNAME}

Switches:
  - debug .......... : no
  - exceptions ..... : no
  - html-doc ....... : yes
  - shared ......... : yes
  - static ......... : no
  - explicit deps .. : no

Documentation tools:
  - doxygen ........ : yes
  - latex .......... : yes
  - dvips .......... : yes
  - ghostscript .... : yes

Testing tools:
  - diff ........... : yes

Optional modules:
  - comm ........... : yes
  - fixed .......... : yes
  - optim .......... : yes
  - protocol ....... : yes
  - signal ......... : yes
  - srccode ........ : yes

External libs:
  - BLAS ........... : yes
    * MKL .......... : no
    * ACML ......... : no
    * ATLAS ........ : yes
  - LAPACK ......... : yes
  - FFT ............ : yes
    * MKL .......... : no
    * ACML ......... : no
    * FFTW ......... : yes

Compiler/linker flags/libs/defs:
  - CXX ............ : g++
  - F77 ............ : /usr/bin/gfortran-4.4
  - CXXFLAGS ....... : -DNDEBUG -O3 -pipe
  - CXXFLAGS_DEBUG . : -Wall -ggdb -pipe
  - CPPFLAGS ....... :
  - LDFLAGS ........ : -L/usr/lib/sse
  - LIBS ........... : -lfftw3 -llapack -lcblas -lf77blas -latlas -lgfortranbegin -lgfortran -lm

------------------------------------------------------------------------------
Now type 'make && make install' to build and install itpp-4.2 library
------------------------------------------------------------------------------

These steps worked but make check failed 12 out of 50-odd tests. Most of the tests seemed to have to do with linear algebra stuff like svd, and so forth. I gave up after trying many different things.

Since I only wanted to evaluate IT++, I did that by installing the binaries available on Synaptic. Suffice to say I was able to create a simple BPSK transmitter, connect to USRP and see the waveform on the scope. It was easy to put together since the commands are very MATLAB like.


However, since that time I have played around with "sample tagging" in GNU Radio and have decided to invest my time towards a GNU Radio route.