Hello,
I'm currently working on a project with a Reach M+ (which is a GPS combine to an IMU). This device works with a light Linux version on a ARM processor. With this Linux version, I don't have "apt-get", "nano", etc. so I have to compile my program with a laptop (running on the latest Ubuntu release). My program has to do:
1- Collect data from the IMU.
2- Write these data into a file.
3- Compress the file every hour (So I create a new file per hour).
My program works well until the compression has to be done. So I reduce the size of my code and here is a simply code where I only try the thread:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
// main.cpp
#include <fstream>
#include <iostream>
#include <string>
#include <thread>
using namespace std; // Standard librairy
void compression()
{
cout << "hello" << endl;
}
int main()
{
thread compressionThread(compression);
compressionThread.join();
return 0;
}
| |
So when I run that code, I receive this error (the error number is random):
root@reach:~/6- Test thread# ./reach
hello
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -140905776 Aborted (core dumped)
Here is my Makefile:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
CXX = arm-linux-gnueabi-g++
CXXFLAGS = -Wall -O
CXXFLAGS += -lpthread
CXXFLAGS += -static
EXEC = reach
OBJ = src/main.o
$(EXEC): $(OBJ)
$(LINK.cpp) $^ -o $@ $(CXXFLAGS)
# Cleaning
clean:
$(RM) *~ $(OBJ)
mrproper: clean
$(RM) $(EXEC)
# Linking
| |
I had to add "-static" because if this option is not selected, the reach can't run the program (-sh: ./reach: No such file or directory).
I tried to use gdb to debug my program but I can't install it on the Reach. How can I solve this problem ?
Thank you.