0

I'm trying to cross compile a cpp application for my Raspberrypi board from my virtual Ubuntu machine. I first installed the required development tools like this:

sudo apt-get install build-essential
sudo apt-get install g++-arm-linux-gnueabihf
sudo apt-get install gdb-multiarch

Afterward I created the following hello world application:

#include <iostream>
using namespace std;

int main() {
  cout << "Hello Worl from Pi" << endl;
  return 0;
}

I compiled the program like this:

arm-linux-gnueabihf-g++ hello.cpp hello

When I execute the binary I get in the console the output "Speicherzugriffsfehler" which is German and means something like "memory access problem".

What might be the problem?

Marco A.
  • 43,032
  • 26
  • 132
  • 246
andreas42
  • 1
  • 5
  • 3
    Speicherzugriffsfehler == segmentation fault – 463035818_is_not_an_ai May 11 '18 at 15:39
  • 3
    It sounds worse in german. – YSC May 11 '18 at 15:51
  • Add a [`--sysroot`](https://stackoverflow.com/a/18920937/608639) to tell the toolchain where to find the ARM headers and libraries. You might even need `-mfpu=hard` (it depends on [`arm-linux-gnueabihf-g++ -dumpmachine`](https://stackoverflow.com/q/11727855/608639)). Or easier, SSH into your RPI and just do a native compile. – jww May 11 '18 at 23:59

0 Answers0