Adding Eigen Library

Joel Sherrill joel at rtems.org
Mon Aug 29 13:18:22 UTC 2016


On Mon, Aug 29, 2016 at 6:56 AM, Sambeet Panigrahi <sambeet161616 at gmail.com>
wrote:

> Hi,
> I tried to link my code in the command line as I was not sure about how to
> do it with the makefile :
>
> sambeet at Holmes ~/NewRockPort/x86/Build/Rock-Port_ana/Tests/Eigen $
> i386-rtems4.11-g++ -B/home/sambeet/NewRockPort/
> x86/Install/rtems/4.11.0-rc3/i386-rtems4.11/pc386/lib/ -specs bsp_specs
> -qrtems -O2 -g  -mtune=i386 -c -I/home/sambeet/NewRockPort/
> x86/Install/eigen/include/eigen2 -o o-optimize/eigen.o eigen.cc
> eigen.cc:19:4: error: expected constructor, destructor, or type conversion
> before '(' token
>    m(0,0) = 3;
>     ^
> eigen.cc:20:4: error: expected constructor, destructor, or type conversion
> before '(' token
>    m(1,0) = 2.5;
>     ^
> eigen.cc:21:4: error: expected constructor, destructor, or type conversion
> before '(' token
>    m(0,1) = -1;
>     ^
> eigen.cc:22:4: error: expected constructor, destructor, or type conversion
> before '(' token
>    m(1,1) = m(1,0) + m(0,1);
>     ^
> eigen.cc:23:8: error: 'cout' in namespace 'std' does not name a type
>    std::cout << m << std::endl;
>         ^
> eigen.cc:24:7: error: expected constructor, destructor, or type conversion
> before '(' token
>    exit( 0 );
>        ^
> These happens usually due to STL being not supported in a g++ version.Does
> rtems-g++ support STL ( vectors,maps etc. only the basic version of STL is
> required for Eigen to work)?
>
>
RTEMS has very good C++ STL support via GCC.

The errors indicate at least 2-3 missing header files.
  + the one for std::cout (e.g. <iostream>
  + the one for exit() (e.g. <cstdlib> or <stdlib.h>)
  + whatever .h file the type for m() is declared as.

If the code compiles on Linux, then this means that somehow the header
files are implicitly being included which is not necessarily standards
conformant. RTEMS tries very hard to be standards conformant which
means no/minimal cases where a .h file is simplicitly included.

Chris' comment about using the RSB to package and install is
correct. You don't build and install packages by hand on Linux,
you install .deb or .rpm files which are carefully constructed to
integrate into the overall OS file system layout. That's what RSB
packages are to RTEMS.

Standard open source packages should have RSB recipes so
they are easily usable.

Each build system has its own way of adding directories to
the include path and libraries to the link command but if the
package is installed in an integrated manner, these are rather
trivial. There should be no additions to the include directory and
only a -lMYLIB added to the link.

--joel


>
>
> On Mon, Aug 29, 2016 at 7:54 AM, Chris Johns <chrisj at rtems.org> wrote:
>
>> On 29/08/2016 11:23, Sambeet Panigrahi wrote:
>>
>>> How do I add the eigen header file to the makefile?Adding CXX flags like
>>> in the code in the initial post is not working.
>>>
>>
>> https://lists.rtems.org/pipermail/users/2016-August/030547.html
>>
>> Chris
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20160829/7bda9723/attachment.html>


More information about the users mailing list