Forum Rule: Always post complete source code & details to reproduce any issue!
Page 3 of 3 FirstFirst 1 2 3
Results 51 to 52 of 52

Thread: Eigen library for linear algebra / Teensy 3.1 / Help needed

  1. #51
    Junior Member
    Join Date
    Oct 2015


    Quote Originally Posted by PaulStoffregen View Post
    I haven't looked at this code (yet). But I am saying at least 2 times before, a very similar error about _kill and _getpid turned out to be related to improper vararg usage, which happened to compile on avr-gcc, even though it's things that are absolutely wrong to do with vararg.

    I have no idea if that's what's really going on here. I might dig into this soon, if it's still unresolved. But if anyone is trying now, maybe knowing improper vararg usage on other libraries showed the same errors might help? I believe one of them was EtherCard. Here's the commit that fixed the problem.
    Hello everyone. First of all, thanks Paul and all the contributors for making the Teensy a great product. I'm also using the EigenArduino Library..after some time I could make it work, when I discovered I should not use stlport-avr, since the Teensy has it owns implementation of the stl.

    After reading some more, I want to say that, besides a lot of warnings related to Eigen, I'm also experiencing compilation errors with kill and getpid and write. Using Arduino IDE 1.6.5 + Teensyduino 1.25 or Arduino IDE 1.6.3 + Teensyduino 1.23, in Ubuntu 14.04. I'm using the EigenArduino library, which is using Eigen 3.06. The problem persists if I try using Eigen 3.2.6 and keeping the EigenArduino header, as suggested by kpc in this same post.

    Code: (example for complex Eigenvalues from Eigen documentation, commented out the output...)

    #include <Eigen30.h>
    #include <Eigen/Eigenvalues>
    using namespace Eigen;
    using namespace std;
    void setup() {
      // put your setup code here, to run once:
    MatrixXcf A = MatrixXcf::Random(4,4);
    //cout << "Here is a random 4x4 matrix, A:" << endl << A << endl << endl;
    ComplexEigenSolver<MatrixXcf> ces;
    //cout << "The eigenvalues of A are:" << endl << ces.eigenvalues() << endl;
    //cout << "The matrix of eigenvectors, V, is:" << endl << ces.eigenvectors() << endl << endl;
    complex<float> lambda = ces.eigenvalues()[0];
    //cout << "Consider the first eigenvalue, lambda = " << lambda << endl;
    VectorXcf v = ces.eigenvectors().col(0);
    //cout << "If v is the corresponding eigenvector, then lambda * v = " << endl << lambda * v << endl;
    //cout << "... and A * v = " << endl << A * v << endl << endl;
    //cout << "Finally, V * D * V^(-1) = " << endl
    //<< ces.eigenvectors() * ces.eigenvalues().asDiagonal() * ces.eigenvectors().inverse() << endl;
    void loop() {
      // put your main code here, to run repeatedly:

    ..../arduino-1.6.5-r5/hardware/tools/arm/bin/arm-none-eabi-gcc -O -Wl,--gc-sections,--relax,--defsym=__rtc_localtime=1445790678 -T ..../arduino-1.6.5-r5/hardware/teensy/avr/cores/teensy3/mk20dx256.ld -mthumb -mcpu=cortex-m4 -fsingle-precision-constant -o /tmp/build3882062423633423646.tmp/sketch_oct25a.cpp.elf /tmp/build3882062423633423646.tmp/sketch_oct25a.cpp.o /tmp/build3882062423633423646.tmp/core.a -L/tmp/build3882062423633423646.tmp -larm_cortexM4l_math -lm 
    ..../arduino-1.6.5-r5/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/libc.a(lib_a-signalr.o): In function `_kill_r':
    signalr.c:(.text._kill_r+0xe): undefined reference to `_kill'
    ..../arduino-1.6.5-r5/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/libc.a(lib_a-signalr.o): In function `_getpid_r':
    signalr.c:(.text._getpid_r+0x0): undefined reference to `_getpid'
    ..../arduino-1.6.5-r5/hardware/tools/arm/bin/../lib/gcc/arm-none-eabi/4.8.4/../../../../arm-none-eabi/lib/armv7e-m/libc.a(lib_a-writer.o): In function `_write_r':
    writer.c:(.text._write_r+0x10): undefined reference to `_write'
    collect2: error: ld returned 1 exit status

    Possible solutions:
    - As suggested in this post by davidthings, adding a similar dummy function for write:
    extern "C"{
      int _getpid(){ return -1;}
      int _kill(int pid, int sig){ return -1; }
      int _write(){return -1;}
    - As suggested here by kpc, defining a dummy abort function:
    void abort() {
    Hope it helps.
    Last edited by aguadopd; 02-19-2016 at 10:59 PM.

  2. #52
    In the event anyone is curious, I have had the Eigen library running the example code shown earlier in this thread for all versions of the library since 3.2.4 posted here :

    One wrinkle cropped up with the beta version of the 3.3.1 package. This was overcome by placing an undef statement at the start of the code, thusly :
    // Example By: RandomVibe
    // Eigen Doc:
    // Quick Reference:
    #ifdef round
    #undef round
    #include <Eigen331b1.h>     // Calls main Eigen matrix class library
    #include <Eigen/LU>             // Calls inverse, determinant, LU decomp., etc.
    using namespace Eigen;    // Eigen related statement; simplifies syntax for declaration of matrices
    Hope this helps someone,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts