Adding Eigen Library

Sambeet Panigrahi sambeet161616 at gmail.com
Mon Aug 29 01:07:15 UTC 2016


Hi,
I am trying to test Eigen with RTEMS which is a very efficient library in
c++ for matrix computations. I wrote the following program:

/*
 *  Classic API Eigen
 */

#include <rtems.h> //Contains the RTEMS datatypes
#include <stdlib.h>//Standard C library
#include <stdio.h>//Standard C input ouput library
#include <iostream>
#include "Eigen/Dense" //Eigen library
using namespace std;
using Eigen::MatrixXd;

rtems_task Init(
  rtems_task_argument ignored
)
{
MatrixXd m(2,2);
  m(0,0) = 3;
  m(1,0) = 2.5;
  m(0,1) = -1;
  m(1,1) = m(1,0) + m(0,1);
  std::cout << m << std::endl;
  exit( 0 );
}

/* configuration information */

#include <bsp.h>

/* NOTICE: the clock driver is explicitly disabled */
#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_USE_DEVFS_AS_BASE_FILESYSTEM

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_MAXIMUM_TASKS 1
#define CONFIGURE_MAXIMUM_SEMAPHORES 1

#define CONFIGURE_INIT
#include <rtems/confdefs.h>
/* end of file */

For this to run I need to include the file
/home/sambeet/NewRockPort/x86/Install/eigen/include/eigen2

So I made the following changes to the makefile of example-v2/cxx/cxx_throw
(in bold)

#
#  Makefile
#

#
#  RTEMS_MAKEFILE_PATH is typically set in an environment variable
#

EXEC=eigen.exe
PGM=${ARCH}/$(EXEC)

# optional managers required
MANAGERS=all

# C source names
CSRCS =
COBJS_ = $(CSRCS:.c=.o)
COBJS = $(COBJS_:%=${ARCH}/%)

# C++ source names
CXXSRCS = eigen.cc
CXXOBJS_ = $(CXXSRCS:.cc=.o)
CXXOBJS = $(CXXOBJS_:%=${ARCH}/%)
*CXXFLAGS = -I/home/sambeet/NewRockPort/x86/Install/eigen/include/eigen2*


# AS source names
ASSRCS =
ASOBJS_ = $(ASSRCS:.s=.o)
ASOBJS = $(ASOBJS_:%=${ARCH}/%)

# Libraries
LIBS =

include $(RTEMS_MAKEFILE_PATH)/Makefile.inc

include $(RTEMS_CUSTOM)
include $(PROJECT_ROOT)/make/leaf.cfg

OBJS= $(COBJS) $(CXXOBJS) $(ASOBJS)

all:    ${ARCH} $(PGM)

$(PGM): $(OBJS)
$(make-cxx-exe)


Eigen does not require the inclusion of any separate library, just
including the above file will suffice. This is the natural way of appending
flags in the makefile but it is not working in this case and I get the
following error:

sambeet at Holmes ~/NewRockPort/x86/Build/Rock-Port_ana/Tests/Eigen $ make all
test -d o-optimize || mkdir o-optimize
i386-rtems4.11-g++
-B/home/sambeet/NewRockPort/x86/Install/rtems/4.11.0-rc3/i386-rtems4.11/pc386/lib/
-specs bsp_specs -qrtems   -Wall  -O2 -g    -mtune=i386       -c   -o
o-optimize/eigen.o eigen.cc
eigen.cc:9:39: fatal error: Eigen/Dense: No such file or directory
 #include "Eigen/Dense" //Eigen library
                                       ^
compilation terminated.
make: *** [o-optimize/eigen.o] Error 1

How can I resolve this error and include the eigen file?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160829/0c65159c/attachment.html>


More information about the users mailing list