aws / aws-iot-device-sdk-cpp

SDK for connecting to AWS IoT from a device using C++
http://aws-iot-device-sdk-cpp-docs.s3-website-us-east-1.amazonaws.com
Apache License 2.0
123 stars 111 forks source link

Segmentation Failure while running the pub-sub-sample on board #131

Closed anirudhan-sacrasys closed 5 years ago

anirudhan-sacrasys commented 6 years ago

I have already put this issue up in AWS Developer Forum. Since I didn't get any response there, I am posting it here hoping to get some response.

I have been trying to get the SDK running on the board for more than a week. I cross compiled the AWS IoT C++ SDK and tried to run the binary file 'pub-sub-sample' on my device. All i get is a segmentation fault

  1. I followed the DevGuide.md which came along with the SDK. Modified the ToolchainFile.cmake file and executed as instructed. Please find below the parameters of the board below

Board model: Freescale i.MX6 ULL 14x14 EVK Board Board CPU : ARMv7 Processor revision 5 (ARMv7), cr=10c53c7d Board OS distribution : Debian Jessie Board uname-a parameters : Linux MYS-IMX6UL 4.1.15+ #1 SMP PREEMPT Fri Sep 28 05:44:29 PDT 2018 armv7l GNU/Linux Cross compiler used in native system : arm-linux-gnueabihf-g++

  1. The AWS Embedded C SDK worked fine without any hiccups.But the cross compiled 'pub-sub-sample' executable file from C++ SDK, when run does not give any other output than 'Segmentation Fault'. Any other command entered thereafter resulted in a 'Segmentation Fault' only and the board needs to be restarted. We are not able to try any 'dmesg' or 'gdb' command to get the root cause of failure.

  2. I tried cross compiling and running simple C++ programs involving shared_ptr on the board and did not face any trouble. While the simple programs i write get cross compiled as a 'shared object' the cross compiliation of an SDK resulted in an executable file which is dynamically linked. I don't know if that could be reason for the 'Segmentation Failure'. I use a Filezilla FTP to transfer my compiled files to the board with transfer type 'binary'.

  3. I put cout statements in PubSub.cpp right after int main() to identify up till which point the program runs without trouble. Even those simple print statements are throwing 'Segmentation Failure' error.

Can you please tell the possible causes for such a failure?

anirudhan-sacrasys commented 5 years ago

The problem was with the libstdc++.so library on the hardware device. It was corrupted. Please check your on-board libraries when facing any segmentation issues