AnsweredAssumed Answered

implements c++ code on p1010rdb ,  received  a signal SIGILL

Question asked by bing liu on May 7, 2016
Latest reply on May 7, 2016 by ufedor

Hi,

I run a c++ test program in p1010rdb (QorIQ Linux SDK v1.0) embedded single board, the test code:

/*********************************

#include <stdio.h>

#include <time.h>

#include <stdlib.h>

 

#include <iostream>

#include <string>

#include <vector>

#include <algorithm>

using namespace std;

 

int main(int argc,char *argv[])

{

    std::cout << "hello, world" << std::endl;

   

    printf("\n hello, world .... \n");

 

    string str("test");

    std::cout << "hello, world: " <<str<< std::endl;

    return(0);

}

 

The cross compile tools, /home/freescale-2010.09/bin/powerpc-linux-gnu-gcc and "-lstdc++", but, when I run it, it is return a error log:  /lib/libstdc++.so.6: version `GLIBCXX_3.4.11' not found ,  In/lib directory, execute command strings:

  #strings libstdc++.so.6 | grep GLIBCXX         

GLIBCXX_3.4

GLIBCXX_3.4.1

GLIBCXX_3.4.2

GLIBCXX_3.4.3

GLIBCXX_3.4.4

GLIBCXX_3.4.5

GLIBCXX_3.4.6

GLIBCXX_3.4.7

GLIBCXX_3.4.8

GLIBCXX_3.4.9

GLIBCXX_FORCE_NEW

 

So, I copy a  libstdc++.so.6.0.14 from /home/freescale-2010.09/powerpc-linux-gnu/libc/te500v2/usr/lib  to <rootfs>/lib, and

ln -s  libstdc++.so.6.0.14  libstdc++.so.6, again compilered the test code and implements it under GDB,  received  a signal SIGILL, log:

 

Program received signal SIGILL, Illegal instruction.

0x10000a1c in __exchange_and_add (__mem=0x10012010, __val=-1)

    at /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/ext/atomicity.h:46

46      /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/ext/atomicity.h: No such file or directory.

(gdb) bt

#0  0x10000a1c in __exchange_and_add (__mem=0x10012010, __val=-1)

    at /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/ext/atomicity.h:46

#1  __exchange_and_add_dispatch (__val=-1, __mem=0x10012010)

    at /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/ext/atomicity.h:79

#2  _M_dispose (this=0x10012008, __a=...)

    at /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/bits/basic_string.h:235

#3  ~basic_string (this=0xbffffb58, __in_chrg=<optimized out>)

    at /home/freescale-2010.09/bin/../lib/gcc/powerpc-linux-gnu/4.5.1/../../../../powerpc-linux-gnu/include/c++/4.5.1/bits/basic_string.h:525

#4  main (argc=<optimized out>, argv=<optimized out>) at Main.cpp:22

(gdb)

 

How can I solve this problem, can you give me some help

Outcomes